# Kasiski test

This online calculator performs Kasiski examination of an entered text using trigrams in attempt to discover a key length

The polyalphabetic substitution ciphers were described around 14th century (with the Vigenère cipher dated 1553 being the best-known example). It was the successful attempt to stand against frequency analysis. They were easy to understand and implement, and they were considered unbreakable until 1863, when Friedrich Kasiski published his method of attacking polyalphabetic substitution ciphers, now known as **Kasiski examination** aka **Kasiski's test** or **Kasiski's method**.

The idea of this test is to try to deduce the length of the keyword used in cipher. To do this, cryptanalyst looks for repeated characters in text (trigrams or more) and measures the distance between them. If these repeated characters are not by coincidence, then they correspond to the some characters repeated in the original text as well (i.e. "the"), and the distance between them is a multiply of the key length. The most frequent greatest common divisor of all occurrences is the most likely key length.

Having the possible key length, cryptanalyst then breaks ciphered text into columns, which correspond to series of simple substitution Caesar ciphers, and breaks them using frequency analysis to uncover the keyword.

The calculator below examines an entered text for repeated trigrams, then calculates most probable length of a key. It displays length and the percentage of found distances which can be obtained by multiplying this key length. It also displays trigram statistics - those that were repeated, how many times they were repeated and where the first occurrence can be found.

Though it is worth to mention, that Kasiski's method was somewhat superseded by the attack using Index of Coincidence (known as **Friedman test** or **kappa test**) developed in 1920s, which is implemented in our Vigenère cipher breaker.

## Comments