#_ITandME blog

NSA CryptoChallange


So I've been working these crypto challanges the NSA puts out every week for a while, but it's gotten to be a little dull because I can usually crack them by simple linguistics rather than determining some kind of mathimatical formula to derive the substitution cipher method they use, so I'm taking the time now to work on finding the scheme once the code is cracked...just to make things more interesting.




06/22/2016

Today I spent cracking the code (which only took me around 20 minutes), then formatting the ciphertext to match with it's corresponding plaintext, then sorting out duplicate pairs. Below is my code:
(I'm not revealing any answers to the puzzles here. Output is example only.)

                
                # formatting deciphered text
                # nsa-cryptChallange- contains the encrypted data
                # nsa-decryptChallange- contains the plaintext data
                # Both docs are the same char length since it is a one-for-one substitution cipher of some kind
                # while loop used so that cipher text can be echo'ed along side corresponding deciphered text,
                # then the pairs are sorted and duplicate pairs are removed.
                #
                count=1;
                while [ $count -le $(cat nsa-cryptChallange-oct22 | wc -l) ];
                do
                        echo $(cat nsa-decryptChallange-oct22 | head -$count | tail -1)"       "$(cat nsa-cryptChallange-oct22 | head -$count | tail -1);
                        count=$(( $count + 1 ));
                done | sort -u
                
                

Here's what it spits out when complete:

                
                decipher cipher
                ,       ,
                .       .
                0       0
                1       1
                2       2
                5       5
                a       y
                b       j
                c       x
                d       m
                e       a
                .
                .
                .
                
                

My hope now over the next few days is to programmatically determine the appropriate shift-cipher algorythm that matches this output...perhaps I will fail but I figure it is worth a shot.