Chapter 03 · Perfect secrecy
Unbreakable, provably: the one-time pad
There is a cipher that no amount of computing power can break, and Claude Shannon proved it in 1949. He also proved its price: a truly random key as long as everything you will ever send, used only once. Reuse it, as the Soviets did, and the message pours out.
In this chapter
Every cipher of the last two chapters fell because the ciphertext carried some trace of the plaintext: letter frequencies, a repeating key, a letter that never encrypts to itself. Is there a cipher whose ciphertext carries no trace at all? In 1882 a Californian banker, Frank Miller, published a telegraph code that added a list of random numbers to the message and threw the list away after use. Nobody noticed. In 1917 Gilbert Vernam, an engineer at AT&T, built the electrical version: the five-bit codes of a teleprinter combined, bit by bit, with the codes of a punched key tape. Army captain Joseph Mauborgne added the two conditions that make it perfect: the tape must be random, and it must never be reused. The result is the one-time pad.
The one-time pad
On bits, the combination is the exclusive or, : and . It is its own inverse, , so encryption and decryption are the same operation:
On letters, the same idea is Vigenère with a random key as long as the message: a key that never repeats leaves Kasiski and Friedman nothing to measure.
Shannon's definition
During the war Claude Shannon, at Bell Labs, worked on the SIGSALY secure telephone and wrote a classified report on the theory of secrecy, published in 1949 as Communication Theory of Secrecy Systems. It made cryptography a branch of mathematics. Model the message , the key and the ciphertext as random variables.
A cipher is perfectly secret if seeing the ciphertext does not change what an adversary believes about the message: for every message and every ciphertext with ,
If the key is uniform over and independent of , then is uniform over and independent of .
Proof
For any and , given happens exactly when , which has probability whatever is. So , and by Bayes' rule .
No computer, now or ever, quantum or not, can do better than guess. The proof does not depend on any assumption about the attacker's power; this is information-theoretic security. But it has a price.
In any perfectly secret cipher there are at least as many keys as possible messages: . In particular, to send random bits with perfect secrecy you need bits of key.
Proof
Fix a ciphertext that can occur. Each key decrypts to exactly one message, so at most messages are possible given . If , some message with is impossible given : .
That is why the one-time pad is rare. The key must be generated truly at random, carried to the other side in advance by a trusted courier, stored safely, and destroyed after use. It was used where the cost was worth it: the Washington–Moscow hotline of 1963 ran on one-time tapes, as did spies' radio messages, read from tiny pads of random digits.
The two-time pad
The pad must never be reused, and the reason is one line of algebra:
The key cancels, and what remains is the combination of two natural-language texts, which is full of redundancy. Guess a likely word in one message (a crib), XOR it into at every position, and where the guess is right a readable fragment of the other message appears. Each fragment suggests a longer guess.
This happened. Under wartime pressure the Soviet pad factory printed some pages twice in 1942. Starting in 1943, the US Army's Signal Intelligence Service (Gene Grabeel first, then the linguist Meredith Gardner) exploited the duplicates in the Venona project, eventually reading parts of about 3,000 messages and exposing Soviet spies in the Manhattan Project, among them Klaus Fuchs. The same mistake reappears in modern systems whenever a stream cipher or CTR mode reuses a nonce: in 2017 the KRACK attack forced Wi-Fi devices to reinstall a key and reuse their nonces.
Entropy and the unicity distance
Shannon also measured how much a ciphertext reveals when the key is shorter than the message. The tool is the entropy he had just defined for communication: for a random variable with probabilities ,
the average number of bits needed to describe it. A uniformly random letter carries bits, but English carries only about to bits per letter, because it is highly predictable: the rest, about bits per letter, is redundancy . Each ciphertext letter therefore gives the attacker about bits of information about the key.
For a cipher whose keys are uniformly random, the length of ciphertext beyond which only one key gives a meaningful plaintext is about
For monoalphabetic substitution, bits and , so letters: any longer substitution ciphertext has, in principle, a unique solution.
For a one-time pad grows with the message and is infinite; for a 128-bit AES key, a couple of blocks of English already determine the key in principle. Determine it, not find it: finding it would still take trials. That difference is the whole of modern cryptography.
From perfect to computational security
Since perfect secrecy needs impractical keys, practical ciphers aim at something weaker: being infeasible to break for an attacker with bounded resources, even though breaking them is possible in principle. Shannon gave the two design principles that every block cipher of the next chapter follows:
- Confusion: make the relation between the key and the ciphertext as complex as possible, so that statistics of the ciphertext say nothing simple about the key (non-linear substitutions).
- Diffusion: spread the influence of each plaintext bit over many ciphertext bits, so that the redundancy of the language is dissipated (permutations and mixing).
In 1982 Shafi Goldwasser and Silvio Micali gave the modern definition, semantic security: whatever an efficient adversary can compute about the message from the ciphertext, it could compute without it. It is Shannon's definition with “every adversary” replaced by “every efficient adversary”, and it underlies every security proof since.
Further reading
- Claude E. Shannon, “Communication Theory of Secrecy Systems”, Bell System Technical Journal 28(4), 1949.
- Steven M. Bellovin, “Frank Miller: Inventor of the One-Time Pad”, Cryptologia 35(3), 2011.
- Robert L. Benson, The Venona Story, NSA Center for Cryptologic History (2001).
- Shafi Goldwasser and Silvio Micali, “Probabilistic Encryption”, Journal of Computer and System Sciences 28, 1984.