Classical Cipher Lab
Encode, decode and break history's most famous ciphers — ROT13/5/47, Caesar with a 26-shift brute-force solver, and Vigenère with real cryptanalysis (key-length estimation + chi-square key recovery). A hands-on lab for CTF players, puzzle hunters, students and the curious. Use it as a caesar cipher decoder and encoder, a rot13 decoder, encoder and translator, or a vigenere cipher decoder that recovers a lost key for you.
Honest disclaimer: classical ciphers are not secure encryption — they are broken by hand or in seconds by software. This lab is for learning, puzzles and CTF competitions. For real encryption, use modern AES-256.
I. ROT Encoder–Decoder
Your rot13 decoder, rot13 encoder and rot13 translator in one place: ROT13, ROT5, ROT47, ROT18 and Atbash. ROT13/5/47 are their own inverse — encoding twice returns the original text.
ROT13 rotates letters (A→N); ROT5 rotates digits (0→5); ROT18 = ROT13+ROT5; ROT47 rotates all 94 printable ASCII characters; Atbash mirrors the alphabet (A→Z).
II. Caesar Cipher Encoder & Decoder
A caesar cipher encoder, caesar cipher decoder and caesar cipher translator in one: encode caesar cipher text or decode it by shifting every letter N positions (Julius Caesar used 3). Case and punctuation are preserved.
Encoding with shift N is identical to decoding with shift 26−N. Try shift 13 — that is ROT13.
III. Caesar Brute-Force Solver
The caesar cipher solver: don't know the shift? Try all 26. Each candidate is scored with a chi-square test against English letter frequencies — the lowest score is almost always the correct plaintext.
Click any row to load it as the decoder input. χ² (chi-square) near the English baseline (~30–60 for long text) = likely English.
Letter frequency analysis
Why the solver works: English letters are not equally common. Compare the input's distribution with expected English.
IV. Vigenère Encoder & Decoder
A vigenere cipher encoder and decoder: encrypt with a repeating keyword. Non-letters pass through unchanged; the key advances only over letters.
Classic example: ATTACKATDAWN + key LEMON → LXFOPVEFRNHR.
V. Vigenère Cryptanalysis — break it without the key
The moat of this lab: a real two-stage cryptanalysis pipeline. Stage 1 estimates the key length (Friedman's index-of-coincidence test + column-IC ranking). Stage 2 recovers the key with a chi-square attack on each column — a complete pipeline to break vigenere cipher without the key. Works best on 200+ letters of English text.
VI. Interactive Tabula Recta
The Vigenère square (also called the vigenere square): 26 rows × 26 columns. Find the plaintext letter down the first column, move across to the key letter's column — the intersection is the cipher letter. Click any cell or type a pair below.
Trace the classic: plaintext A with key L gives L; T with key E gives X; T with key M gives F — the first three letters of LXFOPVEFRNHR.
VII. A short history of secret writing
- ~600 BC
Atbash — Hebrew scribes mirror the alphabet (A↔Z). One of the oldest known ciphers, appearing in the Book of Jeremiah. - ~50 BC
Caesar cipher — Julius Caesar shifts the alphabet by 3 for military orders, according to Suetonius. Augustus later used a shift of 1. - 1553 / 1586
Vigenère — Giovanni Battista Bellaso describes the polyalphabetic method; Blaise de Vigenère publishes it in his Traicté des Chiffres. Dubbed le chiffre indéchiffrable. - 1863
Kasiski breaks Vigenère — Prussian officer Friedrich Kasiski publishes the first general attack (Babbage had found it privately in 1854). - 1920s
Friedman formalizes it — William F. Friedman, father of American cryptanalysis, introduces the index of coincidence for key-length estimation. - 1980s
ROT13 — Usenet culture adopts the 13-shift to hide spoilers and punchlines; it survives today in puzzles and CTF warm-ups.
VIII. Worked examples
Caesar cipher shift 3 — “HELLO” → “KHOOR”
Decoding moves them 3 back: KHOOR → HELLO.
ROT13 is its own inverse
ROT13 again → THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG. Apply twice, get the original back — always.
Vigenère — ATTACKATDAWN with key LEMON
Full result: LXFOPVEFRNHR. Notice the two A's in ATTACK became L and O — that is the whole point.
Breaking Caesar without the key
Run the brute-force solver: 25 wrong shifts score high on the chi-square test, shift 7 scores lowest → The treasure is buried under the old oak tree at midnight.
IX. Where these ciphers are used
CTF (capture-the-flag) competitions · puzzle hunts · geocaching clues · escape rooms · cryptography courses · spoiler-hiding in forums. If you are training for CTFs, the Vigenère breaker above is the same pipeline (IC + chi-square) that solves real warm-up challenges.
Need real encryption?
Classical ciphers protect nothing. For actual secrets use AES-256 encryption (modern, authenticated) — or identify a hash if you are analyzing one.