A couple of months ago the NSA’s Facebook and Twitter accounts posted this image, alongside the message “Can you crack the code? Check back Thursday for your next clue”:
It seemed like an intriguing thing to play with, and a lot of people offered up some interesting suggestions to try. I ended up going down the route of converting the numbers to binary and then seeing if they could be converted to ASCII characters, but that was fruitless. Also tried things like Homophonic ciphers, but nothing seemed to pan out, and the reason that was the case was revealed with the second image, which was posted with the message “Have you heard of an OTP?”:
An OTP is a One-time pad, which is information-theoretically secure. That is, when properly used, an adversary doesn’t have enough information to break the encryption. When they are broken it is from the reuse of the same OTP, which can allow for a frequency analysis attack.
So, that brings us to solving the NSA’s little puzzle. With both the cipher text and the key available to us (taken from the images via OCR), this is accomplished using the following Javascript code:
You can copy and paste that into your browser’s dev tools to see it run, but for those not interested in doing that, here’s what you get:
applytodaymynsatojoinextraordinarypeopledoingextraordinarywork
Adding some spaces and capitalization to make it more readable:
Apply today my NSA to join extraordinary people doing extraordinary work
The “my” seems strange, and most people ended up assuming that it was the result of an error on the NSA’s part. The following seems slightly better:
Apply today at NSA to join extraordinary people doing extraordinary work
Hey I can’t understand programming properly…so can you please say the logic/algorithm behind it.
The write up on Wikipedia is probably better than anything I could provide. Check out the example here:
https://en.wikipedia.org/wiki/One-time_pad#Example
Hey did you apply for the job?..
No. Just thought it was a fun thing to try and figure out.