frequency analysis2

Code Breakers Wanted by the NSA

The American National Security Agency have just launched a new code breaking challenge.  The tweet above is the first in their series for those interested in a career in code breaking.  The NSA are possibly in search of some good publicity after the revelations of Edward Snowden with regards to just how much data they collect on citizens, and people who can crack all their codes may get a chance to work with the organisation.

The first code above looks like quite an easy one – based on a Caesar shift (where we shift letters along by a given amount).  The only difficulty is deciding how many letters to shift the alphabet along by.  To help we can use a frequency analysis table like that below:

frequency analysis

This counts how often each letter occurs in the code.  We can see that the most common letters are C I and P.  It’s a good chance that one of these corresponds to the letter E (the most common letter in the English alphabet).

C to E corresponds to a shift of 2.  But if we try this in the first word we get:

vrh as the first 3 letters – not very promising!

I to E corresponds to a shift of -4.  Trying this with the first word we get:

plb as the first 3 letters – again not likely!

P to E corresponds to a shift of -11.  Trying this with the first word we also get gibberish.  So we could continue with this method, but if we do, we’ll not be able to break the code.  It’s not a Caesar Shift – but a more complicated substitution cipher, where every code letter is randomly assigned an alphabet letter.  If the message was long enough, the frequency analysis would still help us.

frequency analysis3

This shows that the most frequent letters in the English alphabet are e,t,a,0,i.  We could then to match the letter frequencies with all the code letters by trial and error til we found a match.  However, the message is quite short so instead there is an online tool that will do all this analysis for us and work out the most likely solutions:

frequency analysis4

From these suggestions we can see that the solution is actually:

Want to know what it takes to work at NSA? Check back each Monday in May as we explore career essentials to protect our nation

(notice that I does indeed go to E – as we thought it might do based on frequency analysis.  C also goes to T and P also goes to A.  Therefore using frequency analysis the 3 most frequent letters in the code word correspond to the 3 most frequent letters in the solution).

Let’s see what new messages are posted next Monday.