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.
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
“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
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
On the canonical compiler XOR round-trips, and key reuse leaks the plaintext XOR — the key cancels: