by Jason Marshall
Would you believe it’s possible to send someone a secret message secured with absolutely unbreakable encryption using only a bit of simple arithmetic? Well, it is—the solution is surprisingly simple and was used by British, German, and American spy agencies throughout World War II. Curious to know how it works? You’re in luck because today we’re taking our first steps into the world of secret-agent math.
The podcast edition of this article was sponsored by Go to Meeting. With this meeting service, you can hold your meetings over the Internet and give presentations, product demos and training sessions right from your PC. For a free, 45 day trial, visit GoToMeeting.com/podcast.
Secret Agent Math, Part 1
Here’s the somewhat ridiculous but hopefully amusing scenario: Imagine you’re a secret agent working for your government’s top-secret espionage agency. You’re sitting alone in a restaurant when the waiter approaches your table and slides a small piece of folded paper in front of you. He indicates that the note was sent by a person seated across the room—you take a look and quickly recognize him to be a trusted colleague. The waiter leaves and you unfold the paper. Given your wealth of experience in these situations, you’re not at all surprised to find a senseless looking series of letters scrawled across the paper: “P–B–A”. Having taken stock of the situation, you realize that this sequence of letters is an encrypted message.
How to Decrypt a Secret Message
You pull out a small notepad that was issued to you before leaving on your trip. Its pages contain sequences of completely random numbers between zero and twenty-five. Armed with your notepad and the scrambled secret message, you begin the decryption process. Here’s how it works. Start by looking up the first random number in your notepad—in this case it’s two—and then cross it out so you don’t accidentally use it again. This first number is used to decrypt the first letter of your message. Beginning with the first letter in your message, “P,” count forward through the alphabet two characters—“Q” is one and “R” is two. So “R” is the first letter of your decoded message.
Okay, now that you’ve got that one figured out, all you have to do is repeat the process for each of the final two letters of your message. You look-up the next random number in your notepad—nineteen. So start at the letter “B”—the second letter in the scrambled message—and count forward nineteen letters until, eventually, you reach the letter “U”. This is the second letter in your decoded message. Finally, for the last letter “A,” you see the next random number in your notepad is thirteen. You count forward thirteen letters from “A” and arrive at “N.” So, you’ve now got your entire message decrypted—and it says: “R–U–N.” Run?!
The One-Time Pad Method of Encryption
Alright, time out. I know this scenario is probably pretty alarming, and you’re no doubt eager to learn the fate of your dramatized alter-ego. But before we get to that, let’s take a minute to talk about this encryption method called the “one-time pad” that played a major role in sending secret messages throughout much of the 20th century. The name “one-time pad” comes from the fact that the series of random numbers in the notepad must be used only one time. If a pad is reused, patterns can emerge that give away the random numbers in the pad, and the encryption can then be broken quite easily by an intercepting party. Additionally, these numbers must be absolutely random (not just sort of random) or, once again, patterns can develop that make it easy to figure out the contents of the pad—and, if someone knows the numbers in your pad, your encryption is useless.
Secret Agent Math, Part 2
Now, let’s get back to the story. Recall that you’ve just deciphered a secret message telling you to “Run!” You ponder for a moment whether or not the message is a joke—if your running was that urgent, why wouldn’t your colleague just yell? But then you remember that this colleague is known for strictly over-following standard industry encryption protocols, so you realize it is a real message and make a mad dash for the door. But having taken so long to comprehend the urgency of the message, you’re grabbed and hustled into the trunk of a car and driven away—leaving your colleague to ponder the folly of his ways. Apparently, he now realizes, encryption isn’t always necessary—sometimes simple solutions are better. But, your alter-ego’s misfortune in our drama is your own good-fortune in real life since, if for some bizarre reason you ever need to secretly share information with someone, you now can do it using a one-time pad!
The Math Behind One-Time Pad Encryption
Before wrapping-up, let’s take a minute to talk a little more about the math behind one-time pad encryption. Start by assigning each letter of the alphabet a corresponding integer value between 1 and 26. A=1, since “A” is the first letter of the alphabet, B=2, since “B” is the second letter, and so on until you get to Z=26, the last letter of the alphabet. If you take the integer value that corresponds to a particular scrambled letter in your encrypted message (say the letter is “P” with an integer value of 16) and add it to the associated random number from a one-time pad (say the number is two), then you get a new integer—in this case 16 + 2 = 18—which can then be converted back into the letter “R,” which you’ll recognize to be the first decrypted letter in the message from our story.
How to Solve Math Problems Smartly
That’s all well and good, but here’s an interesting case: What would happen if the scrambled letter you were trying to decrypt was “Y,” and the corresponding random number was 25? If we count forward through the alphabet from “Y,” we’ll obviously get to “Z,” but then what? Well, in this case, the answer is to loop back around and start again at “A.” That’s the way the one-time pad system is defined to work. So you could start at “Y,” count forward to “Z,” jump back to “A,” and then proceed 23 more letters forward and eventually arrive at “X.” But how about this: Instead of counting forward 25 letters from “Y,” couldn’t you also just count backward one letter? And isn’t counting backward one letter a lot easier? And a lot less error prone too? It is.
So what’s my point here? Well, in math, as in life, there’s usually more than one way to solve a problem—and some ways are easier than others. So here’s the quick and dirty tip: work smart. Simply yelling “Run!” instead of going to the trouble of sending an encrypted message would be smart. Counting one letter backward through the alphabet instead of twenty-five forward would be smart too. Think before acting and you’ll solve more problems while working less—that’s a pretty tough combination to beat!
Wrap Up
And speaking of beat...up: Whatever happened to our favorite secret agent? Will math save the day? Be sure to check out the next “Secret-Agent Math” episode to find out.
Thanks again to our sponsor this week, Go To Meeting. Visit GoToMeeting.com/podcast and sign up for a free 45 day trial of their online conferencing service.
Please email your math questions and comments to .........You can get updates about the Math Dude podcast, the “Video Extra!” episodes on YouTube, and all my other musings about math, science, and life in general by following me on Twitter. And don’t forget to join our great community of social networking math fans by becoming a fan of the Math Dude on Facebook.
Until next time, this is Jason Marshall with The Math Dude’s Quick and Dirty Tips to Make Math Easier. Thanks for reading, math fans!
|