Chris Spackman – Cryptography

One-Time Pad

The One-Time Pad (OTP) is a symmetric cipher that uses a random key that is as long as the message itself, and the key is used only once. Think of it like two people sharing a notebook full of random letters — each page is used to encrypt one message, then that page is torn out and destroyed. The One-Time Pad is the simplest cipher that is provably unbreakable when used correctly.

Try It

Result

Step-by-Step

How It Works

Each letter in the plaintext is paired with the corresponding letter in the key. To encrypt, add them together using modular arithmetic:

For example, with plaintext H (7) and key K (10): (7 + 10) mod 26 = 17, which is R. To decrypt R (17) with key K (10): (17 − 10) mod 26 = 7, which is H.

Why It Is Unbreakable

If the key is truly random and used only once, the ciphertext reveals nothing about the plaintext. Here is why: for any ciphertext, every possible plaintext is equally likely. If you intercept the ciphertext "RACDU", it could decrypt to "HELLO", "WORLD", "PIZZA", or any other five-letter combination — it depends entirely on the key, and without the key there is no way to know which one is correct.

This is not just "hard to break" like other ciphers — it is mathematically proven to be impossible to break, even with unlimited computing power. Claude Shannon published the proof in 1949, in "Communication Theory of Secrecy Systems." He also showed the price: any cipher with this kind of perfect secrecy needs a truly random key at least as long as the message, used only once. The One-Time Pad is simply the most direct way to meet that requirement.

A Little History

The idea is older than the name. Frank Miller, a California banker, described a one-time key system for telegraph codes in 1882; his work was forgotten until the computer scientist Steven Bellovin rediscovered it in 2011. Gilbert Vernam of AT&T built a teleprinter version in 1917 (patented in 1919) that combined the message with a key punched on paper tape. Joseph Mauborgne of the U.S. Army Signal Corps added the rule that makes it secure: the key must be truly random and never reused. Shannon's 1949 paper then proved that a cipher used this way is perfectly secret.

The Catch

If the One-Time Pad is unbreakable, why does not everyone use it? Because it has serious practical problems:

The Key Distribution Problem

This is the fundamental challenge of symmetric encryption: how do you share the key? The One-Time Pad makes this problem painfully clear because the key is so large.

This problem is exactly what drove the invention of modern cryptography. Two brilliant solutions emerged:

The One-Time Pad shows us why we need these tools. It is the bridge between traditional and modern cryptography.

Things to Try

Disclaimer: these pages are educational demos provided as-is, with no warranty of any kind. The author is not responsible for any consequences arising from their use.

Send comments and bug reports to chris@chrisspackman.com.

Version 0.1.4 — Last updated: 2026-10-25

This page is Copyright © 2025 – 2026 Chris Spackman <chris@chrisspackman.com>.
This web site developed entirely on GNU/Linux with Free / Open Source Software.

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Creative Commons License