Codes date back almost as far as writing, and for looser definitions of the word “code,” probably even further. There’s a repetitive quality to that lengthy history: an unbreakable code is devised, used for some variable period of time, and then it turns to, in fact, be quite breakable. But it’s not always technological advances that undo codes; it’s perhaps more common that the flaws are not in the codes, but in the people using them.
For an example of the human element in codebreaking, take Allied efforts to crack the German Enigma machine during World War II. Enigma-encrypted messages should have been secure and unbreakable, but human error interceded. Every Enigma-encrypted message began with a repeated three letter sequence, so cryptanalysts knew there was repetition in the first six letters. Weather reports were always issued at the same time each day and with the same format. In other words, structure and predictability—non-randomness—weakened the code.
The problem for codebreakers was that Enigma is so complex that human idiosyncrasy alone wasn’t enough to crack it. Enter mathematician / codebreaker / singular genius Alan Turing, who set to work identifying its flaws. For example, Enigma encrypted messages in layers, but those layers functioned independently. This meant that rather than trying to decode the final output that’s been encrypted at multiple levels, the decryption could be handled independently for each level, vastly reducing the number of possible keys. Even that wasn’t enough to make it breakable, so Turing did some rather arduous mathematical hoop-jumping to isolate statistical patterns in certain letter combinations, thanks to how the hardware worked. By combining these insights, the number of possible keys for decrypting a message could be reduced to a few thousand, or a few hundred on a good day, which is close enough that manually trying them all would often work. (Weirdly, the German Navy used more secure Enigma protocols that were never cracked; but I don’t know why only the Navy used them).
The critical part, and what I never understood before, is that the Enigma was never “cracked” with a foolproof algorithm that was always guaranteed to work. Instead, it was a stack of weaknesses—both human and technical—that could be used to whittle down the number of possible keys each day to some number that could be tested manually. Sometimes it worked, and sometimes it didn’t. On top of all that computers didn’t exist, at least until Turing also helped develop electromechanical “bombes” to test possible decryptions. To have isolated any one of those weaknesses was a remarkable intellectual feat; Turing did them all.
• • •
The design of the “bombes” was mostly an implementation of Charles Babbage’s “Difference Machine,” a mechanical computer from the 1820s. Babbage was a polymath who realized that a) the logarithm tables he was using for his work were fraught with error and b) the calculations could, in theory, be performed mechanically; this at a time when “computers” was a term for people who computed things. Babbage dabbled with multiple designs over the next few decades, but never completed any.
Babbage had a notoriously short attention span; he was an intellectual vagabond and total curmudgeon. In the field of cryptography, he broke the Vigenère cipher, which was considered unbreakable. Apparently an early devotee of “big data,” he also recorded and tabulated anything and everything, once counting all of the panes of broken glass in a factory to write a paper titled Table of the Relative Frequency of the Causes of Breakage of Plate Glass Windows. He later spent 80 days writing down everything that annoyed him, presumably muttering to himself the entire time about “damn kids and their music,” yielding the paper Observations of Street Nuisances.
In that paper, he especially took organ grinders to task: “It is difficult to estimate the misery inflicted upon thousands of persons, and the absolute pecuniary penalty imposed upon multitudes of intellectual workers by the loss of their time, destroyed by organ-grinders and other similar nuisances.” I suppose that’s understandable, because his whole family was killed in a tragic organ-grinding (not that kind of organ-grinding) accident (note: not actually true). He also invented the opthamaloscope, which he didn’t bother to publicize and was subsequently “rediscovered” by Helmholtz. He developed the flux capacitor, the design coming to him in a fugue state experienced after falling off his toilet while trying to hang a picture. He had a chain of video game stores named after him. But his crowning achievement is probably the invention of the cow-catcher:
In sum, Babbage was the king of curmudgeons. Look at how intensely irritated he looks just sitting for a daguerrotype!
Back to the Enigma: what made the Enigma (and virtually any other type of cryptography) susceptible to decipherment was that the same key that encrypted messages also decrypted them. As a practical matter, this presents an issue to the code users, since the key must be distributed but can’t itself be encrypted, otherwise you’d need a key for the key and it’s keys all the way down. Depending on how many keys you have to distribute and where, this issue can range from “minor annoyance” to “complete logistical nightmare” (see: the military).
The issue was solved in the 1970s with asymmetric encoding, which, not surprisingly, military researchers kept to themselves for years before it was discovered by the public. In asymmetric coding, everyone has two keys, one public and one known only to them. Senders look up the recipient’s public key and encrypt the message using that key. And, because of fancy abstruse math (specifically, deriving prime factors of extremely large numbers), the private key is the only one that will decrypt the message. For large enough keys, the sun will burn out and we’ll find solid evidence of bigfoot before the right key can be guessed. “Public key encryption” made it possible for simplified, wide scale encryption of messages.
• A Roman method for sending secret messages was to shave someone’s head, tattoo the message to their scalp, then wait for the hair to grow back. Life moved slower back then.
• Quantum computers! ”Anyone who says the understand quantum mechanics does not understand quantum mechanics.” – Richard Feynman. Try not to think too hard about it.
• This book is pretty rad.