Game Theory Tuesday: Three Ways to Protect Your Email Privacy Using Low-Tech Encryption (Caesar Cipher, Vigenère Cipher, Three-Pass Protocol)
posted by Presh | 13 May 2008
Emails worry me
I wrote half as many emails the day after meeting the company legal staff. I learned that emails are often discoverable in court, and it was rumored company email was being scanned. This whole episode annoyed me, because as a consultant, I enjoyed the convenience of email.
But I didn’t want to join the crowd of world dumbest emails. Here are some examples, described in a CNN article about emails:
- “Can I quit now? Can I come home?” Brown wrote to Cindy Taylor, FEMA’s deputy director of public affairs, the morning of the hurricane. A few days later, Brown wrote to an acquaintance, “I’m trapped now, please rescue me.” ….
- In a Massachusetts class-action suit over the dangers of the diet drug combination Phen-Fen, the court allowed this e-mail from a company executive to be admitted: “Do I have to look forward to spending my waning years writing checks to fat people worried about a silly lung problem?”
- Chevron settled a lawsuit for $2.2 million that involved an interoffice e-mail giving 25 reasons why beer is better than women.
- Former star investment banker Frank Quattrone was convicted of obstructing federal investigations into stock offerings at Credit Suisse First Boston. Central to the case was an e-mail Quattrone forwarded telling employees it was “time to clean up those files” after he learned of the investigation.
- More than 500 of former West Virginia Gov. Bob Wise’s intimate e-mails with a state employee were obtained under the Freedom of Information Act and made public in 2003. The employee’s husband filed for divorce and Wise didn’t seek re-election in 2004.
The stories provide two lessons. First, if you’re doing something very bad, your email will likely be discovered and reviewed. Second, if you write messages that could be taken out of context, watch out.
I imagine the second situation is the worry for us law-abiding and hard-working people. Computer programs might flag our emails, which could be later used against us. Although avoiding email would be best, it’s s not always practical.
The ancients tell us a possible answer
What’s the answer? Searching for solutions, I wondered about our ancients and thought about a solution they came up with: why not send messages in code, just like war generals did?
Coded emails might be the right solution. A small barrier would probably get around automatic computer scanners. And it’s a quick, free, time-effective solution. Computer programs have made the encoding a breeze. And it’s possible to choose which emails to encode, so it’s time-effective. For me, I can continue writing 99 percent of your emails the same way and just encode the few sensitive or important ones.
What code should be used? This is the question that drives the game of encryption, which battles between two opposing forces of security and accessibility. Security suggests strong codes to ward off eavesdroppers who could overhear and crack the code. Accessibility suggests easy codes so intended recipients can figure out the message quickly.
Finding the right balance is the art of encryption. We’ve recently seen digital media rights face this challenge: too little encryption allows for piracy, but too much annoys the end user, as Sony learned a few years ago.
I’ve thought about this issue and come up with three practical ways to encode emails. Each method is more secure than the previous one, but consequently requires more work.
Caesar Cipher
- Turns key words into garbled code; might work against automatic text software (Gmail, company mail)
- Easy to implement
Suppose you want to tell a friend about your new car, but you don’t want Gmail to start sending you ads about cars. Or suppose you want to tell your friend you’re leaving a company in a month, but you don’t want automatically scanning software to flag you.
What method can you use to thwart text recognition software?
The answer is that you can encode your message using the Caesar Cipher. This is a simple encryption where you shift every letter by a certain number of letters. The coded message is easily decipherable, but it looks like garbage to automatic software.
Here’s an example. If you had a 1 letter shift for instance, then the encoding would be:
A—>B
B—>C
C—>D
D—>E
E—>F
….
For instance, the text “car” would become “dbs,” and the word “quit” would become “rvju.”
Here is how you might send a decoded message to a friend.
Hi Bob,
For security reasons, I’ve encoded my message. Go to http://www.simonsingh.net/The_Black_Chamber/caesar.html and decode my message using a shift of 1 letter. Thanks.
“J CPVHIU B OFX DBS. MFU’T ESJWF JU UIJT XFFLFOE”
When Bob receives the message, he can visit the Caesar Cipher, copy the message, and have it automatically decoded:
You can shift by any other numbers of letters too.
The Caesar Cipher is quick and seems like it would beat many automatically scanning tools.
But there is a basic flaw with the Caesar Cipher. Any human that reads the message could easily decode it. Simple shifting is among the easiest of codes to crack.
So a more powerful method is needed, and that’s idea behind the next technique.
Vigenère Cipher
- Turns key words into garbled code; might work against automatic text software (Gmail, company mail)
- Might defeat human eavesdroppers
- Medium hard to implement
The Vigenère Cipher is essentially Caesar Cipher 2.0. It uses a variable shift based on a keyword, which is explained in more detail below.
Implementation is just as easy as the Caesar Cipher. Here is how you might send a message:
Hi Bob,
For security reasons, I’ve encoded my message. Go to http://sharkysoft.com/misc/vigenere/ and decode my message. The key word is the name of the movie we saw last week. Thanks.
“q schshg i esj oae. tvh’f prvdv wg fhva nsrweal”
The extra security layer is adding a key word that is known only to Bob and not an eavesdropper. Bob would know you two saw the movie “Iron Man” together, and thus he could go and decipher the message:
How does the Vigenère Cipher work? It’s essentially a Caesar Cipher with a variable key shift determined by a key word (or password). The description on Wikipedia is nice, and I paraphrase it below.
Imagine you want to encode the message:
COLLEGE DEBT
The person writing the message would first choose a key word, like “help.” If the key word is shorter than the message, then keep repeating it until it’s long enough (computer programs like Sharky’s Vigenère Cipher does this for you). The encoding key word would be:
HELPHEL PHEL
The plain text is then encoded using the Vigenère square, which indicates how letters translate. (image from user:Matt Crypto)
The top row of letters is for the plain text, the left hand column of letters is for the key word, and the middle characters are the encoded letters. For instance, the letter “C” on the top row and the letter “H” on the left column translate to the letter “J” in cipher text.
Repeating the process for all letters, here is the coded, or cipher, text that would result:
Plain text: COLLEGE DEBT
Key word: HELPHEL PHEL
Cipher text: jswalkp slfe
The Vigenère Cipher does have a practical flaw: the receiving person has to know the key word. If you put the key word in the email, the message is no more secure than the Caesar Cipher. If you can’t communicate it, the message becomes incomprehensible.
Also, you might not even want to reveal your key word to the other party if it happens to be a special password that you use for other accounts.
So is there a way you can send an encoded message without revealing your key word?
Amazingly, there is a way. The extra restrictions are the other person needs a key word and the message has to travel three times.
The Three Pass Protocol (Shamir Three-Pass Protocol)
- Turns key words into garbled code; might work against automatic text software (Gmail, company mail)
- Might defeat human eavesdroppers
- Protects your secret key word
- Hard, possibly annoying, to implement
How is it possible to send a message without revealing your key word? An example will illustrate the method developed by Adi Shamir around 1980.
Let’s suppose Alice wants to send Bob a message. Assume each person has a secret password to lock the message (also known as a private key). Here is how the message can be sent, without exchanging keys or giving up security:
–Alice first locks the message and sends it to Bob.
–Upon receipt, Bob locks the message again and sends it back to Alice.
–Alice then removes her lock and sends the message back to Bob.
–At this point, Bob has the message, and it only has his lock. He can simply unlock it and read it.
As the diagram illustrates, the message always has at least one lock during transit to block eavesdroppers, and neither Alice nor Bob has to reveal passwords to each other.
Here is how the three-pass protocol might work in practice for an email, if Alice uses the key word “wonderland” and Bob uses the key word “office space”:
Correction: The following method is NOT a three-pass protocol. But it serves as an instructive example of something that looks secure but it not. Try working through it and then read Eyal’s explanations in the comment section.
Step 1: Alice encrypts the message and sends it to Bob (“pass one”)
Hi Bob,
For security reasons, I’ve encoded my message. Go to http://sharkysoft.com/misc/vigenere/ and encode the message again with your password, and send it back to me:
“e pbxkye a ahs qnu. pve’s quejr lx ksif zasxhru”
Step 2: Bob “super-encrypts” the message with his own key, and sends back to Alice (“pass two”)
Hi Alice,
“s ugfmcw p ajw esz. xxi’k fugnf qc sumx oaubvwz”
Step 3: Alice decodes the message with her own key, and sends back to Bob (“pass three”)
Hi Bob,
“w gtcill p nga qfw. tgx’k srkzs ny bjmk legossi”
Step 4: Upon receipt, Bob decodes the message with his own key, and he gets the message
Bob gets the message “i bought a new car. let’s drive it this weekend”
As you can see, the steps for a Three-Pass-Protocol are annoying (but remember the above is not a correct implementation).
(Other locking mechanisms can be used as long as they are commutative. That means the order of the locks doesn’t matter; this is necessary because Alice needs to unlock hers after Bob puts on his lock. The Vigenere Cipher is a shifting of letters, so it’s equivalent to addition, which is commutative.)
I hope these methods might serve you well. With so much attention to privacy, I’m sure there are other cost effective methods too.
How do you protect your email privacy?
Previous post: Line Etiquette Pays: How I Accidentally Saved Money at the Grocery Store
Next post: Thinking about the 401(k) Account: Should I Have One? How Much Should I Contribute? What are the Risks? Trying to Interpret the Experts
Previous game theory post: Two Nice Articles on Risk
Next game theory post: Thinking about the 401(k) Account: Should I Have One? How Much Should I Contribute? What are the Risks? Trying to Interpret the Experts
Possibly related posts:










13 Responses to “Three Ways to Protect Your Email Privacy Using Low-Tech Encryption (Caesar Cipher, Vigenère Cipher, Three-Pass Protocol)”
You should look into Enigmail, it uses OpenPGP and integrates directly with Mozilla Thunderbird (open source as well).
http://enigmail.mozdev.org/home/index.php
It’s free and completely seamless/transparent to the user.
By Michael Dowdell on May 13, 2008
Buying a car and seeing iron man in one weekend… excellent work, Bob.
By Robbie on May 13, 2008
Thanks for the discussion, Presh. This is basically my area of expertise so it is fun to see a post on the topic. Especially when it is clear and lucid. I love that these methods require no intentional, prior coordination to work. Unfortunately, the price is paid in the strength of the defense it provides. This is an unfortunate fundamental limitation and not a complaint about your solutions.
One key point that deserves highlighting is that these three solutions probably wouldn’t have helped in the cases cited by CNN. I say probably because I don’t know by what means or under what circumstances those emails were recovered. The third could have helped in some of them, but I suspect that if they gave it enough thought to use this method, they would have simply not sent the message in the first place.
For those interested in further reading about the history of writing in codes and ciphers, I would suggest Simon Singh’s “The Code Book”.
By Paul on May 13, 2008
Michael Dowdell: Thanks for the suggestion. I suspect there are similar add ons for commercial software like Outlook and Lotus Notes that companies use.
Paul: I completely agree these suggestions wouldn’t help the people in the CNN story. These people did such bad things that someone would have spent the time to decode them. The low-tech solutions are more about the small stuff: preventing a friend from hearing about a surprise bday, or keeping a mother’s day gift secret. I can’t tell you how many times these electronic messages get caught, especially since many people get the email on their cell phones.
On that note, perhaps I should cover the high-tech encryption methods in the future. I’ll be sure to get your opinion on that
Simon Singh writes well, so I’m interested in that book. Thanks.
By Presh Talwalkar on May 13, 2008
Presh, you have a real talent for making difficult ideas so transparent that people will wonder why there was any fuss to begin with!
Very useful explanatory post.
By michael webster on May 13, 2008
I have the Singh book, have a book I just need to read?
By michael webster on May 13, 2008
Hi Presh,
Thanks for the post. The beginning of the post is great.
You are certainly correct, many emails should be encrypted, whether your saying something stupid or embarrassing (in this case, actually, sometimes its better to say nothing at all), or you are sending important data, like customer records, patent applications, financial records, etc.
On the other hand, the methods you chose for encrypting messages were, well, rather dated. They are all both laborious to implement and easy to crack (compared to, say, RSA or El-Gamal, which for all practical purposes are uncrackable… its much easier to guess someones).
I would suggest using the Gnu Privacy Guard, which is an open standard based on OpenPGP, with your choice of email client: http://www.gnupg.org/related_software/frontends.en.html#mua
(this page includes enigmail, which Michael Dowdell suggested earlier in the comments)
You can also use Gwebs MailCloak at http://www.gwebs.com/mailcloak.html to encrypt MSN, Yahoo, Gmail, and more, also with GnuPG.
By Alex Miller on May 13, 2008
Michael Webster: Thanks for the glowing comment
As for good books I recommend, nothing comes to mind lately. But I’ll think about it and get back to you.
By Presh Talwalkar on May 14, 2008
Alex Miller: I agree with you, and thank you for the detailed information! I am going to check these tools out.
By Presh Talwalkar on May 14, 2008
Your three-pass example doesn’t work. Your goal was to improve on the Vigenère Cipher by hiding the password. If you take a look, however, subtracting the output of step 2 from step 1 gives you “office space” and subtracting the output of step 3 from step 2 gives you “wonderland”. With Vigenère, knowing the password lets you decrypt, but knowing the start and ending texts also gives you the password.
A working three-pass is like this: Print up the message and put it in a box. Lock the box and send it to your friend, have him put a lock on the box and send it back. Now remove your lock and send it to your friend again. There is always at least one padlock on the box, so it’s safe in transit. Unlike with the cipher, however, seeing the box before and after it has been opened doesn’t give you any clue to how the key looks.
By Eyal on Aug 25, 2008
Eyal: Thanks for the comment, but perhaps I’m missing something. As I understand it, it can be hard to deduce the key merely from the output because keys can have variable length. I read that if the key is randomly generated and as long as the message, then it is very, very hard and theoretically impossible to crack. This is not my specialty so help would be greatly appreciated.
By Presh Talwalkar on Aug 26, 2008
You claim that Vigenère with three-pass is superior to Vigenère with one-pass because it protects the secret word. But does it?
Bob received this on pass 1:
e pbxkye a ahs qnu. pve’s quejr lx ksif zasxhru
After pass 3 he decoded:
i bought a new car. let’s drive it this weekend
Put the former in “input”, the latter in “key” and hit decode. The output is:
w onderl a ndw ond. erl’a ndwon de rlan dwonder
Mathematically, the cipher is based on input+key=output, where each letter is converted to 0-25 and back again. If you know any two of the variables, you can determine the third because addition is both commutative and the inverse is easy to compute (subtraction). An operation that is commutative and reversible but not easily reversible would keep the password secret.
The most common operation that fits the bill is exponentiation in a prime number field, as in: the remainder of (x to the power of y) when divided by some prime number p. You can raise x to the power of y and then to the power of z, or swap the order of y and z with the same result.
Regular exponentiation has an inverse, the logarithm, but no one knows how to do it quickly when it is modulo a prime number. (Modulo means taking the remainder.) That inverse operation is called the discrete logarithm and Diffie-Hellman encryption is based on its difficulty. No fast solution exists but neither has it been proven that a fast solution does not exist. So we really don’t know!
The note about the encryption being perfect if the key is long enough and never re-used and never exposed is true, but by both encrypting and decrypting the message, Alice has used the key twice! (That form of perfect encryption is called one-time pad.)
By Eyal on Aug 26, 2008
Eyal:
Thank you for the comprehensive and understandable response. I especially overlooked that you can use the same cipher to decode the password since it is an addition/subtraction cipher method, which you point out is quickly reversible.
I’ll make a correction in the article and point people towards your comment. Thanks again!
By Presh Talwalkar on Aug 27, 2008