Solving the NSA’s Little Puzzle

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: