◄ WORLD V · SONNY 5DART 196 · a helldive at the net

THE VERNAM CIPHER XOR with a key; if the key is random and once, it is unbreakable

The simplest cipher and the only provably unbreakable one: XOR the plaintext with a key stream, c = p ⊕ k; decrypt with the same XOR, p = c ⊕ k. If the key is truly random, as long as the message, and never reused, it is the one-time pad — Shannon proved it leaks zero information. Every one of those three conditions is load-bearing; break one and it collapses.

THE TECHNIQUE c = p xor k ; reuse k and c1 xor c2 = p1 xor p2

XOR is its own inverse, so encryption and decryption are the identical operation. But watch the fatal failure: reuse the key on two messages and their XOR leaks the XOR of the plaintexts — the key cancels out entirely: live demo


HISTORY & CREDIT Vernam 1917; OTP earlier: Miller 1882

“Gilbert Vernam invented the one-time pad.” — he invented the XOR machine cipher (1917), but the one-time, perfect-secrecy idea was published by Frank Miller in 1882, 35 years earlier; and the “truly random, one-time” requirement is Mauborgne’s. Vernam’s name is on the XOR, not the proof. cited

1882 · Frank Miller — a codebook scheme with a non-repeating one-time key: the one-time-pad idea, decades before Vernam.
1917–19 · Gilbert Vernam (AT&T) — the XOR teleprinter cipher (patent 1919); Mauborgne adds the random, one-time key, making it unbreakable.
1949 · Claude Shannon — proves perfect secrecy: with a random one-time key, the ciphertext is statistically independent of the plaintext.

Perfect secrecy has a perfect price: the key must be as long as all the messages and never reused, so you have merely moved the secret-sharing problem, not solved it — which is why the OTP is used only where key distribution is already solved (a red phone, a numbers station). Vernam 1917 / Shannon 1949

RECOMMEND FOR I-13 self-inverse, and the reuse leak, computed

On the canonical compiler XOR round-trips, and key reuse leaks the plaintext XOR — the key cancels:

$ i13 run vernam.i13 # c = p xor k ; p = c xor k p = 200 k = 173 c = 101 back = 200 -- XOR is its own inverse p2 = 88 c2 = 245 -- reuse k: c xor c2 = p xor p2 (k cancels!)
Recommend: the Vernam cipher is LIT and one XOR on I-13 — verified c = p ⊕ k = 101 decrypts back to p = 200 (XOR self-inverse), and that reusing the key is fatal: c ⊕ c2 = p ⊕ p2 because k cancels. It is the corpus’s XOR operator at its most consequential — provably unbreakable as a one-time pad (Shannon), provably broken the instant you reuse the key. Ship it only with the three conditions stated (random, message-length, once); it is a demonstration of perfect secrecy and its impossible price, not a general cipher.