Friday, April 24, 2015

Agent Carter: The One-Time Pad

I recently decided to watch Agent Carter. Sure, the reason I got into the Marvel Cinematic Universe was the simple fact that Joss Whedon was creating a show set in it, but by now I have become invested in the entire MCU and watching a non-Whedon show set in the universe was the logical next step.
Agent Carter started off pretty good, but today I watched an episode that made me ragequit the series. It was episode 5 (The Iron Ceiling) in which the main characters received an encoded message that wasn't meant for them. Their cryptographer couldn't handle it, so Carter came to the rescue. She mentions it's a one-time pad, says that the puzzle piece the cartographer was missing was that the original message was in Russian. And then, she continues to break the encryption in under 20 seconds.

WAIT. What? That's NOT how a one-time pad works!

A one-time pad is the one method of cryptography that is unbreakable. In fact, it's been proved mathematically that it is impossible to break. Actually, if you know how a one-time pad works, you should be able to come to that same conclusion.

The one-time pad may be unbreakable, but it has some other properties that are the cause for it not really being used in the digital world. Personally I quite like the one-time pad, so perhaps I will write about it in more depth some other time. I like to think about how it can be used in this day and age or even in the future. For example, I'd use it if I were in professional espionage even today. I've also thought of a very good way to use it in a futuristic galactic empire, where it would be especially important because the technology of another empire might be very far ahead of your own.

Another thing I like to think about is the limitations of the system. One of the problems is that you have to keep your "pad" or cryptographical key secret, which is a challenge after you die. Technology can help there, but technology wasn't around during the days of Agent Carter. You would have to keep the key either on you or store it in a safe place. Considering that, it really isn't that much of a stretch it was somewhere in the apartment where they also found the typewriter on which they received the message. Not the smartest move to keep them together, but an easy mistake to make, really.

One of the advantages of tv series is that after rageplugging you can just later pick up where you left once you've cooled down. It had never been mentioned or seen on screen, but both Carter and the cryptographer must have had the pad, which had been retrieved from the original owner's apartment. It's a bit of a stretch I needed to add to make sense of things, but I'm willing to do that. Unlike someone truly breaking a one-time pad message like that, it's not outside my realm of suspension of disbelieve.

As a final note, I did google "Agent Carter one-time pad", expecting to find other people ranting about this same thing. I was a little let down to find less than a handful of people were complaining about this. The one-time pad is really one of the most basic things of encryption and honestly, I feel that every computer scientist should know at least a little about encryption. I'll just choose to believe that very few computer scientists have seen the episode. However, one of the posts in question mentioned a solution similar to mine, but dismissed it because the cryptographer should have recognized the Cyrillic alphabet. The thing that counters this, though, is that the one-time pad can take many forms. It is often explained in a simple form that uses alphabetical operations, but - for example - in the digital age those operations for a simple bitwise XOR makes a lot of sense, because it would allow encryption of any type of data. Likewise, there are definitely variants that hide the fact that the message was in Russian and in fact using one of those makes a lot of sense if your intended receiver is (or was) doing espionage in the United States...