On this page
Most ciphers can be broken with enough computing power. The one-time pad cannot, and that is a theorem, not a hope. Here is the rule, a worked example you can do by hand, the proof, and why it fails in real life.
What is a one-time pad?
A one-time pad combines a message with a secret key that is truly random, exactly as long as the message, and used only once.
In binary, the combining step is XOR (exclusive or): 0 ⊕ 0 = 0, 0 ⊕ 1 = 1, 1 ⊕ 0 = 1 and 1 ⊕ 1 = 0. XOR is addition modulo 2, and it undoes itself: (M ⊕ K) ⊕ K = M, because K ⊕ K = 0. So the receiver decrypts with the same key. XOR is also the trick behind the winning strategy in the game of Nim.
How do you encrypt a letter with a one-time pad?
Take the letter H. In ASCII it is 72, or 01001000 in binary. Toss a coin eight times for the key.
Message M (the letter H): 01001000
Key K (eight coin tosses): 11010110
Ciphertext C = M ⊕ K: 10011110
Decryption C ⊕ K: 01001000, which is H again
Now be the attacker. You hold 10011110 and suspect the message was I (01001001). The key that would give this is C ⊕ I = 11010111, a perfectly valid key. In fact, for each possible 8-bit message M exactly one key, C ⊕ M, produces 10011110. With 256 equally likely keys, the ciphertext fits all 256 possible messages equally well.
What did Shannon prove about perfect secrecy?
Shannon's Communication Theory of Secrecy Systems appeared in the Bell System Technical Journal in October 1949. A footnote in the paper's text says the material first appeared in a confidential report dated 1 September 1946.
Shannon defined perfect secrecy as the condition that, after the enemy intercepts the cryptogram, the probabilities of the possible messages are identically the same as before. In plain words: reading the ciphertext must not change your guess about the message at all.
Our example shows why the one-time pad passes. The chance of seeing C, given message M, is the chance that the key was C ⊕ M: 1/256 whatever M is. Every message produces C equally often, so Bayes' rule leaves each message's probability where it started; if all messages were equally likely before, they stay equally likely after. In the same paper, Shannon calls the letter version, a never-repeating random key added mod 26, the Vernam system, and writes that this type of perfect secrecy is realized by it.
Why is reusing a one-time pad key fatal?
Encrypt two messages with the same key and the key cancels: C1 ⊕ C2 = (M1 ⊕ K) ⊕ (M2 ⊕ K) = M1 ⊕ M2. Send O (01001111) with our key and you get 10011001. XOR the two ciphertexts and you get 00000111, which is exactly H ⊕ O. Guess a likely word in one message and you read the other, and the key.
This happened at scale. According to an NSA history of the Venona project, the US Army's Signal Intelligence Service, known as Arlington Hall, began examining encrypted Soviet telegrams on 1 February 1943. The KGB's manufacturing centre had apparently reused some one-time pad pages, which gave Arlington Hall an opening. Progress was slow: of nearly 1,300 KGB New York to Moscow messages in 1942, only 23 were decrypted and translated; 1943 yielded over 200.
From 1948 to 1951, the decrypts helped uncover atomic spies including Klaus Fuchs and Julius Rosenberg. The programme formally ended on 1 October 1980 and was declassified in 1995.
Why isn't the one-time pad used everywhere?
Shannon's own result is the reason. He showed that perfect secrecy requires, when the number of messages is finite, at least as many possible keys as messages, and that the key must be generated at the same rate as the message, or faster. For messages of unlimited length, he wrote, it needs an infinite amount of key. And any key, he noted, must travel from sender to receiver by means nobody can intercept.
In practice, a perfect one-time pad needs all four of these:
a key that is truly random, not produced by a formula
a key at least as long as the message
a key used once, then destroyed
a key delivered in secret before the message is sent
To send a long video secretly, you would first have to deliver an equally long random key by a safe route, which is the problem you were trying to solve. So everyday encryption uses short keys and relies on problems that are hard to compute, such as those built on modular exponentiation. Why a key must carry as much uncertainty as the message is a question about Shannon entropy.
If XOR, modular arithmetic or conditional probability is the step that feels shaky, the Fermi Concept Library gives every concept in mathematics and computing its own lesson, so you can patch the gap and come back to Shannon's argument.



