Cryptography 101: Low-Tech Cryptanalysis Explained

Well, with Bitcoin going mainstream, public resentment against the NSA at an all-time high, and people not having a clue what Cody Wilson of Defense Distributed means by labeling himself a Crypto Anarchist, it looks like a few posts on cryptography and Crypto Anarchy are in order.  There will probably be five posts; this one will be an intro to cryptanalysis, the next will explain how public key encryption works, after that I will do another one on elliptic curve and quantum cryptography schemes. From there a post will be devoted to a primer on Crypto Anarchy and the last post will be a categorical list of software tools for any beginning Cypherpunk.


Now for some beginning cryptanalysis. To put it bluntly, this post will be an introduction to code breaking that will look at some very simple means of encoding and sending “secret” messages by hand. As it turns out these are pretty trivial to break, but their biggest drawback becomes apparent if you try to use such low-tech methods over the world wide web.


Let’s start with the traditional substitution cipher. There’s nothing very sophisticated about it; you simply take a letter of the alphabet and replace it with something else. This could be another letter, a symbol you made up, or what have you. The most famous yet very simple example is the Caesar Cipher. Each letter of the alphabet is replaced by a letter three spaces to the left of it; the letter D is written as A, E is written as B, and so forth. Here’s what the cipher looks like as well as how it “encodes” a message:


How a typical substitution cipher works.

How typical substitution ciphers work. A letter is replaced with something else.


Simple enough right? Now let’s look at another method called a transposition cipher. Rather than replacing a letter of the alphabet with something else, you simply change where the letters are actually located on the message sheet itself. Here’s a simple example:


One of many transposition ciphers. Location is what matters.

One of many transposition ciphers. Location is what matters.


So now we know the two main low-tech methods for encoding messages, but breaking them is pretty simple to do.


The means of breaking these two general approaches to making “secret codes” varies greatly. For substitution ciphers the longer the message is (or the more material you can intercept over time), the easier it becomes to decipher the meaning of the text. While a number of various techniques can be applied for doing so, they all usually stem from just two strategies: frequency analysis and letter pairs.


Frequency analysis takes advantage of the fact that each letter of the alphabet will appear at different rates; the letter “E” for example is the most commonly used letter of the alphabet and chances are the most common letters/symbols in a message will be vowels. This is why it cost money to suggest a vowel on “Wheel of Fortune” – filling in a vowel makes it much easier to guess the puzzle. Letter pairs of course tend to be two vowels as well. Plugging those in can help you decipher a message with some trial and error. The more material you have to work with (longer messages, more messages, or both) the more successful the techniques will be.


Transposition ciphers on the other hand are a different story. They are almost always easier to break if the message is very short. In the case of the rail fence example pictured above, it only seems easy because the visible message (25 letters) isn’t concealed by bogus letters that hide how the letters in the message (25 total) have been transposed. The obvious way to try break the cipher would be to take a given letter, and see if a pattern can be found with other corresponding letters that eventually form a word. More complicated means exist for breaking various transposition ciphers, but all that’s beside the point of this post.


These two approaches to encoding messages have their own distinct pros and cons. What they both have in common however is that they simply lack the level of security needed to encrypt information sent over the internet. This is because any recipient of an encoding message must have the cipher needed to decode it, and sending it over the internet where a malicious third party could intercept it defeats the whole purpose of using the cipher in the first place.


What we need is something that allows someone to send messages to you that are encoded that you can decrypt, but does not require you to send the necessary key for decryption over any information channel an adversary might be listening into. My next post will explain how asymmetric encryption – better known as public key cryptography – solves this dilemma.