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 only cipher that is provably unbreakable when used correctly.
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.
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 "RIJVS", 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. No other cipher can make this claim.
If the One-Time Pad is unbreakable, why does not everyone use it? Because it has serious practical problems:
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.
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 — Last updated: 2026-02-21
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.