How the Vigenère cipher works
Choose a keyword, say LEMON. Write it repeatedly above your message:
Key: L E M O N L E M O N L E
Plain: A T T A C K A T D A W N
Cipher: L X F O P V E F R N H R
Each key letter stands for a Caesar shift: A means shift by 0, B by 1, up to Z by 25. So the first letter is shifted by L (11), the second by E (4), and so on, starting the keyword again when it runs out.
Notice the two Ts in ATTACK. One becomes X and the other F. That is the whole point: a single plain letter no longer maps to a single cipher letter, so counting letter frequencies across the whole message tells an attacker very little.
To decrypt, shift each letter back by its key letter.
How to break it
The weakness is the repetition. A five-letter keyword means every fifth letter was shifted by the same amount. Pull out letters 1, 6, 11, 16… and you are holding an ordinary Caesar cipher, which is trivial.
So the attack has two steps:
- Find the key length. Try splitting the text into 2, 3, 4… interleaved slices. At the right length, each slice suddenly shows the lumpy letter frequencies of real English.
- Solve each slice as a Caesar cipher. The shift that makes a slice look most like English is that key letter.
The breaker here does both, then polishes the result by testing small changes to the key against a model of English four-letter sequences. A longer message and a shorter key make it more reliable.
History
The cipher was published by Giovan Battista Bellaso in 1553. It earned the French nickname le chiffre indéchiffrable and kept that reputation for about three hundred years.
Charles Babbage broke it in the 1850s but never published. Friedrich Kasiski, a Prussian infantry officer, published the first general method in 1863. During the American Civil War the Confederacy used a brass Vigenère disc with a small handful of keyphrases, among them “Manchester Bluff” and “Complete Victory”, and the Union regularly read its messages.
Questions people ask
Can a Vigenère cipher be decoded without the key?
Yes, provided the message is a good deal longer than the keyword, roughly twenty or more letters of message per key letter. The breaker on this page works out the key length and then each key letter from letter statistics.
How do I find the length of the key?
Two classic methods. Kasiski examination looks for repeated chunks of ciphertext; the distances between them tend to be multiples of the key length. The index of coincidence splits the text into every 2nd, 3rd, 4th… letter and checks which split makes each slice look like ordinary English letter frequencies.
Is the Vigenère cipher ever unbreakable?
Only in one extreme case. If the key is truly random, as long as the message, and never used again, it becomes a one-time pad, which is provably unbreakable. Any shorter or reused key can be attacked.
Did Vigenère invent it?
No. Giovan Battista Bellaso described it in 1553. Blaise de Vigenère published a different and stronger cipher, the autokey, in 1586, and in the nineteenth century Bellaso's simpler cipher was mistakenly given Vigenère's name.