For nearly 300 years, the Vigenère cipher was considered unbreakable. It earned the nickname le chiffre indéchiffrable — “the indecipherable cipher.” It resisted every attack that worked against simple substitution ciphers because it uses multiple alphabets, which flattens the telltale frequency distribution that makes monoalphabetic ciphers so easy to crack.
But in the 19th century, Charles Babbage and Friedrich Kasiski independently discovered that the repeating key creates patterns — and patterns can be exploited. Parker Hitt described practical attacks in his 1916 Manual for the Solution of Military Ciphers, and William Friedman later formalized the mathematics with the Index of Coincidence.
If you are not familiar with how the Vigenère cipher works, start with the Vigenère cipher page first. This page walks you through a complete attack, step by step, using exactly the tools a real cryptanalyst would use.
The attack has five steps:
The first question is always: what kind of cipher is this? The Index of Coincidence (IC) answers that in a single number. English text has an IC around 0.067 because some letters (E, T, A) appear far more often than others. If a cipher preserves that uneven distribution (like a simple substitution or transposition), the IC stays near 0.067. If it flattens it (like the Vigenère), the IC drops toward 0.038 — the value for random text.
If the same plaintext letters happen to line up with the same key letters, they produce the same ciphertext. This creates repeated sequences (trigrams, tetragrams, etc.) in the ciphertext. The distances between these repeats are always multiples of the key length.
The Kasiski examination finds these repeated sequences, measures the distances between them, and looks for the most common factor. That factor is the most likely key length.
Each distance between repeated trigrams is factored, and the factors are tallied. The factor that appears most often is the most likely key length.
Once we know (or guess) the key length, we split the ciphertext into that many columns. Each column contains every nth letter starting from a different position. Because each column was encrypted with a single key letter, each column is effectively a simple Caesar cipher.
If we chose the right key length, the IC of each column should be near 0.067 (English). If the ICs are low, the key length guess is probably wrong.
Each column is a Caesar cipher — every letter in the column was shifted by the same amount (the corresponding key letter). We test all 26 possible shifts for each column and pick the one whose frequency distribution best matches English, using the chi-squared statistic. The shift with the lowest chi-squared value is the best match.
The shift number tells us the key letter: shift 0 = A, shift 1 = B, shift 2 = C, and so on. When we line up all the column shifts, we get the key.
We now have the recovered key. Applying it to the ciphertext should produce readable English.
This five-step process is essentially what Kasiski published in 1863 and what Friedman refined in the 1920s. The Index of Coincidence was Friedman's great contribution — it gave cryptanalysts a rigorous mathematical test where before they had relied on intuition and experience. But the core insight — that a repeating key creates exploitable patterns — goes back to Babbage in the 1850s.
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.1 — Last updated: 2026-07-02
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.