Cryptography

Vigenère Cipher Explained: How It Worked and Was Broken

11 min read
By
Vigenère Cipher Explained: How It Worked and Was Broken

NovelCrypt

In 1553, the Italian cryptographer Giovan Battista Bellaso described a method of encrypting letters that would earn a legendary reputation. For nearly three centuries, no published technique could break it, and European cipher rooms called it "le chiffre indéchiffrable" — the indecipherable cipher. History attached the name of Blaise de Vigenère to it, and the Vigenère cipher has carried that name ever since.

The cipher's story matters because its defeat marks the exact moment cryptography stopped being about clever tricks and started being about statistics. Understanding how the Vigenère cipher was broken teaches you more about modern cryptanalysis than any textbook definition, because the weaknesses that destroyed it — key reuse and pattern leakage — are the same weaknesses modern algorithms are engineered to eliminate.

What Is the Vigenère Cipher

The Vigenère cipher is a polyalphabetic substitution cipher. That phrase hides a simple idea: instead of shifting every letter by the same amount, it shifts each letter by a different amount according to a repeating keyword.

Start with what came before. The Caesar cipher shifts every letter of the plaintext by a fixed number — say three — so HELLO becomes KHOOR. It is trivial to break, because an attacker can try all 25 shifts, and even without that, letter frequencies give it away immediately. If you see a ciphertext where X appears most often, you can bet X decrypts to E.

The Vigenère cipher fixes exactly this. You choose a keyword — say LEMON — and convert it into shifts: L is 11, E is 4, M is 12, O is 14, N is 13 (using A as 0). Then you encrypt the first letter with the first shift, the second letter with the second shift, and so on. When you run out of keyword letters, you start again from the beginning of the key.

How Encryption Works, Step by Step

Take the classic example: plaintext ATTACKATDAWN with keyword LEMON.

Write the key above the plaintext, repeating it: LEMONLEMONLE. Now shift each plaintext letter by its key letter. A shifted by L (11) gives L. T shifted by E (4) gives X. A shifted by M (12) gives L. C shifted by O (14) gives Q. And so on, producing the ciphertext LXFOPVEFRNHR.

The same plaintext letter encrypts to different ciphertext letters depending on where it falls in the key. ATTACK begins with two Ts, but one encrypts with L and the other with M, so they produce different output. That single property destroyed the primary weapon of classical cryptanalysis: frequency analysis. If you want to see what an attacker could do with a simpler shift, our guide on how to break the Caesar cipher walks through the brute-force approach that fails here.

Why Codebreakers Were Stuck for 300 Years

Frequency analysis had broken every serious cipher in Europe since the Arab polymath Al-Kindi described it in the ninth century. Cryptographers built defenses like homophones and nulls, but a determined analyst always recovered the underlying letter frequencies. The Vigenère cipher was different.

Because each key position defines its own substitution alphabet, the ciphertext has no single frequency profile. If the key is six letters long, the letter E in the plaintext could appear as six different ciphertext letters. Analysts were not facing one scrambled alphabet — they were facing six interleaved ones without knowing where one ended and the next began. The ciphertext looked flat and random, closer to noise than to language.

The cipher held its reputation until the nineteenth century, when two men independently noticed that "indecipherable" was too strong a word.

The Kasiski Examination: Finding the Key Length

Friedrich Kasiski, a Prussian officer, published the attack in 1863. Charles Babbage had found the same core idea around 1854 but never published, so credit went to Kasiski.

The insight starts with an observation: when the same word appears twice in the plaintext and both occurrences align with the same part of the key, they encrypt to identical ciphertext. Kasiski looked for repeated ciphertext fragments and measured the distance between their starting positions.

Suppose repeats occur 12, 6, and 18 letters apart. The key length must divide all those distances — and the greatest common divisor of 12, 6, and 18 is 6. That is the key length. The repeats do not need to be long; three or four matching letters are enough, and in any substantial message they appear naturally from common words and repeated digraphs.

Why does this work? Because a repeating key is a pattern, and patterns leak. If the key is six letters long, then every sixth ciphertext letter was encrypted with the same shift. The cipher's one structural weakness — key reuse — is what gives the attack its foothold.

Splitting the Text: The Frequency Kill

Once the key length is known, the cipher collapses. Write the ciphertext in rows of six columns. Every letter in column one was encrypted with the same shift — the first key letter. The same holds for every other column.

Each column is now just a Caesar cipher, individually solvable with the frequency analysis that has worked since the ninth century. Find the most common letter in column one, assume it decrypts to E, compute the shift, and you have the first key letter. Repeat for each column and the entire keyword LEMON falls out. Then decrypt the whole message mechanically.

The full attack needs no secret information, no brilliant guess, and no lucky hunch — only arithmetic. If you want to see how far classical ciphers could go before modern designs replaced them, our comparison of classical ciphers vs modern encryption shows why shifting letters by any scheme is fundamentally insufficient.

The Friedman Test: A Statistical Refinement

The Kasiski examination depends on finding repeats, which becomes unreliable on short messages. In the 1920s, William Friedman introduced a cleaner statistical tool: the index of coincidence, the probability that two randomly chosen letters from a text are identical.

English text has an index of coincidence of about 0.067, because common letters repeat. Random text sits near 0.038, since every letter is equally likely. Now take a Vigenère ciphertext and test different assumed key lengths: split the text into that many columns and measure the index of coincidence within each column. For the correct key length, every column still behaves like English — around 0.067. For wrong lengths, the values fall toward the random floor. The correct key length announces itself statistically, even without a single repeated fragment to find.

A Worked Break, Compressed

Consider a ciphertext of a few hundred letters where the word sequences QDV and QDVM appear at positions 47, 179, and 323 apart. Distances of 132 and 144 share a greatest common divisor of 12, suggesting a twelve-letter key. Split the text into twelve columns; each shows a healthy index of coincidence near 0.06. Frequency analysis on each column yields shifts that spell out a readable keyword. With the keyword in hand, the entire plaintext decrypts in one pass. That is the complete attack — it is why no serious system has used a repeating-key cipher since.

The Lesson for Modern Cryptography

The Vigenère cipher failed for one reason: its key repeated. Every modern stream cipher is built on the opposite principle — a keystream that never repeats within a message. This is why nonce and initialization vector reuse is treated as a catastrophic bug in modern systems, not an inconvenience. Reusing a keystream exposes relationships between plaintexts, exactly as Vigenère key reuse exposed relationships between letters. Our guide on what an IV is and why reusing it is dangerous covers the modern version of this failure.

The one-time pad is the direct descendant of this story: a Vigenère-style cipher where the key is truly random, as long as the message, and never reused. Remove any one of those conditions and you are back to a breakable repeating-key cipher.

Try It Yourself

You can experiment with shifting ciphers using the NovelCrypt Caesar cipher decoder. Encrypt a short message with a keyword of your own, then count letter frequencies in the ciphertext. Then encrypt a second message with the same keyword and see if you can find repeated fragments between the two — that is the Kasiski examination in miniature, and it demonstrates why key reuse is the cardinal sin of stream ciphers.

The Bottom Line

The Vigenère cipher combined multiple shift alphabets under a repeating keyword and held off cryptanalysis for three centuries because it flattened the frequency patterns attackers relied on. It fell when Kasiski and Babbage realized that repeated ciphertext fragments reveal the key length, and that a known key length turns the cipher into several trivially solvable Caesar ciphers. Friedman's index of coincidence made the attack work even without repeats. The structural lesson — never let a keystream repeat — is written into every modern cipher. The Vigenère cipher was never truly indecipherable; it was merely ahead of statistics.

Frequently Asked Questions

Why was the Vigenère cipher considered unbreakable for so long?

It flattened letter frequencies. In a simple substitution cipher, the letter E always maps to the same ciphertext letter, which is easy to spot. The Vigenère cipher shifts each letter by a different amount depending on the key, so E becomes many different letters. Without statistics that could reveal the key length, codebreakers had no foothold.

Who actually broke the Vigenère cipher?

Charles Babbage worked out the method around 1854 but never published it. Friedrich Kasiski independently published the same technique in 1863, so the attack is named after him. The Kasiski examination finds the key length by measuring the spacing of repeated ciphertext fragments. William Friedman later refined key-length detection with the index of coincidence in the 1920s.

Is the Vigenère cipher related to the one-time pad?

Yes — the one-time pad is a Vigenère-style cipher with one critical difference: the key is truly random, as long as the message, and never reused. When you remove those three properties, a one-time pad degenerates into a Vigenère cipher, which is breakable. The Vigenère cipher is essentially a one-time pad with a short, repeating key.

Can the Vigenère cipher be secure today?

No. With modern computing, breaking a Vigenère cipher takes milliseconds. Even a long key phrase is ultimately a repeating pattern, and repeating patterns leak. It remains worth studying because its failure modes — key reuse and statistical leakage — are the same failure modes that modern cryptography is engineered against.

Try NovelCrypt Tools

Experience military-grade encryption for your sensitive data. Create self-destructing messages, encrypt files, or explore our experimental lab tools.

Explore NovelCrypt