Cryptography Lab

From Caesar's cipher to HTTPS — 2000 years of keeping secrets.

Interactive companion to Issues 2 & 5

Station 1: Caesar Cipher

Shift every letter by the same amount. Simple — but it fooled Caesar's enemies for years.

The Cipher Wheel
Shift 3
3
Encrypt
Decrypt
🔒
Crackable in seconds — only 25 possible keys
History: Julius Caesar used this cipher to communicate with his generals. It's simple — but it fooled his enemies for years. Each letter is shifted by the same fixed amount. With only 25 possible shifts, you can try them all in under a minute.
Challenge: Crack the Code
This message was encrypted with a Caesar cipher. Can you find the shift value?
WKH TXLFN EURZQ IRA
THE QUICK BROWN FOX (Shift = 3)

Station 2: Substitution Cipher

Remap every letter to a different one. 403 septillion possible keys — but still crackable.

Letter Mapping

Click two cipher letters (bottom row) to swap them, or hit Randomize.

Plain:
Cipher:
Frequency Analysis Tool

Compare cipher letter frequency (green) with expected English frequency (orange). If "X" appears ~12% of the time, it's probably "E"!

Expected English Ciphertext
🔒
Crackable in minutes — frequency analysis breaks it
History: Substitution ciphers were used for centuries across Europe and the Middle East. Arab mathematician Al-Kindi invented frequency analysis to crack them in the 9th century — the first known systematic code-breaking technique.
Challenge: Break This Cipher
This paragraph was encrypted with a random substitution. Use the frequency chart above and your wits to crack it. Click a cipher letter in the bottom row, then click another to swap — when a letter maps correctly, it lights up green.
Your decryption mapping — click two to swap:
Cipher:
Your guess:
0 / 26 letters correct

Station 3: XOR Encryption

The single operation at the heart of all modern encryption.

Bit-Level XOR

Toggle bits in the message and key rows. The XOR result updates instantly — same bits produce 0, different bits produce 1.

Message:
0
1
0
0
1
0
0
1
^ ^ ^ ^ ^ ^ ^ ^
Key:
1
0
1
0
1
0
1
0
Result:
0
0
0
0
0
0
0
0
Message: I (0x49) Key: * (0x2A) Result: c (0x63)
XOR is its own inverse! message XOR key = ciphertext. Then ciphertext XOR key = message.
Knowing ANY TWO of (message, key, result) gives you the third.
String Mode

Type a message and a key. The key repeats to match the message length. XOR once to encrypt, XOR again to decrypt.

Step 1: Message XOR Key = Ciphertext
Step 2: Ciphertext XOR Key = Original Message!
🔒
XOR with short key: Crackable — patterns repeat
🔒
XOR with key = message length (one-time pad): Unbreakable!
Modern use: XOR is the heart of modern encryption. AES, ChaCha20, and the HTTPS keeping this page secure all use XOR at their core. The trick isn't the operation — it's generating keys that are truly unpredictable.
Challenge: XOR Decrypt
This hex ciphertext was XOR'd with a repeating key. The key is a common 3-letter word for something you use to open a door.
For reference, AES-256 uses a 256-bit key — that's 2256 possible combinations. Would take all the computers on Earth billions of years to crack.

The Cipher Timeline

2000 years of keeping secrets

Caesar Cipher
~50 BC
Al-Kindi's
Frequency Analysis
~850 AD
Substitution
Ciphers
Medieval
Bletchley Park /
Enigma
1940s
DES / Public Key
Crypto
1970s
HTTPS / AES
Today

From Caesar to HTTPS: 2000 years of keeping secrets.