# Vigenère cipher breaker

This online calculator tries to decode Vigenère cipher without knowing the key. It uses the index of coincidence technique.

If you came here, you probably already know that is Vigenère cipher. If not, you can first check the Vigenère cipher. In short, Vigenère cipher is a series of Caesar ciphers, and is classified as polyalphabetic substitution cipher. For almost three centuries it remained unbreakable, until 1863, when Friedrich Kasiski published a general method of deciphering Vigenère ciphers.

You can use the link above to encode and decode text with Vigenère cipher if you know the key. This calculator below is different. It actually tries to break the Vigenère cipher using text statistics. The technique used here to break the cipher is known as **Friedman test** or **kappa test**, invented in 1920s, and it is based on **Index of Coincidence** or IOC. It is used to find most likely key length. Then frequency analysis is used to break separate Caesar ciphers, which are simple single substitution ciphers.

The application of the Index of Coincidence for the breaking of Vigenère cipher is described in Wikipedia.

In short, the proceduce is the following:

- IOC is used to find out most likely key length. Text is broken to columns, corresponding to tested key length, and then average IOC for all columns is calculated. The key length at which IOC is highest is the probably cipher key length (or product of the multiplication of the key length).
- Determined key length is used to form columns of text - and we know that text in each column is ciphered by separate Caesar cipher. Now we need to try all possible combinations of Caesar cipher (26 for the English alphabet) and for each result compute the frequencies of letters and their correlation to average frequencies of letters in an English text. The Caesar cipher which gives the highest correlation is probably the Caesar cipher used in Vigenère cipher. Series of such Caesar ciphers gives us the Vigenère cipher key.

As you can see with default calculator input data below, it could work very well. However, it is only the approximation. It can misfire for short text (of course, accuracy increases with the size of the text) or if the key is very long or contains repeated patterns. That's why I've included couple of additional options to this decoder.

Consider the following:

Click to set example dataAs you can see, the determined key is **NOOC**. However, deciphered text has little sense. So, it is time to click the **Show another possible solutions** button. If you do so, you will see the table which lists most possible keys for each tried key length (by default, up to 30). It is easy to spot that **NONCNNON** key gives much more sense. Note, that it has length of 8 (which is multiplication of 4) and repeating pattern NON--NON. No wonder our most possible solution misfired.

Yet the deciphered text still has some typos. So, it is the time to complete the puzzle and use **Guess key** option. By looking at the typos in text, you can easily guess that 5th letter in the **NONCNNON** key is wrong. Guess key allows you to quickly try another variant. Enter **NONCANON** and enjoy the completely deciphered text. Puzzle is solved.

On the final note: I've tried to make this breaker universal. Click **Edit frequencies** button and you will have access to alphabet and frequencies used in calculator. This allows you to tweak the letter frequencies or to change the alphabet at all. You can tweak frequencies if you suspect the specialized text - it is known that specialized texts (i.e. scientific) have different letter frequencies than regular texts, because of different vocabulary. And you can change the alphabet if you suspect non-English text (i.e. Spanish). **If you want to change the alphabet, use uppercased letters and place them in alphabetic order.**

## Comments