Search for a tool
Kasiski's Test

Tool for analyzing repetitions in ciphertext, determining the key length, and decrypting the Vigenère cipher

Results

Kasiski's Test -

Tag(s) : Cryptanalysis

Share
Share
dCode and more

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!


Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!


Feedback and suggestions are welcome so that dCode offers the best 'Kasiski's Test' tool for free! Thank you!

Kasiski's Test

Kasiski Examination

 





See also: Vigenere Cipher

Answers to Questions (FAQ)

What is the Kasiski examination? (Definition)

The Kasiski examination is a classical cryptanalysis method published by Friedrich Kasiski in 1863.

The purpose of the test is to estimate the period P of the cipher, that is, the probable length of the key used in a periodic polyalphabetic cipher such as the Vigenère cipher.

Once P has been estimated, the ciphertext can be divided into P subtexts. Each subtext then corresponds to the same alphabetic shift and can be analysed as an independent Caesar cipher.

The method relies on searching for repetitions in the ciphertext in order to recover clues about the periodicity of the key.

The technique had also been discovered independently by Charles Babbage around 1854, without any official publication at that time.

What is the principle behind the Kasiski examination?

The test relies on a periodicity property of the Vigenère cipher. If the same n-gram from the plaintext appears several times and is encrypted with the same position in the key, then the resulting encrypted n-gram will be identical.

The distance between these repetitions in the ciphertext is then often a multiple of the period P.

The principle consists of identifying repeated sequences in the ciphertext, measuring the distances between them, then searching for common factors likely to correspond to P.

Some repetitions may nevertheless appear by chance, which introduces noise into the analysis and can produce false candidates.

How is the Kasiski examination applied?

The Kasiski examination is generally applied in several steps:

— identify repeated sequences in the ciphertext

Example: In ABCDEFABCGHIJ, ABC is repeated twice (position 1 and position 7)

— measure the distances between these repetitions

— factorise these distances

Example: The distance between 2 ABC is 6, the factors of 6 are 2 and 3

— identify the factors that appear most frequently

The most frequent factors constitute plausible candidates for the period P.

The result must then be confirmed using other methods, particularly the index of coincidence.

The principle consists of dividing the ciphertext into P subtexts and then calculating the index of coincidence for each one. If the obtained values approach those of a natural language, then the tested period becomes more credible.

What are the limitations of the test?

The Kasiski examination becomes unreliable when exploitable repetitions are rare or absent. Several situations strongly limit its effectiveness:

— a key that is long relative to the size of the message, or even as long as the text itself (one-time pad)

— the autokey Vigenère cipher, whose key is not periodic

— texts that are too short to produce enough repetitions

What role did the Kasiski examination play in the history of cryptanalysis?

The Kasiski examination marked a major milestone in the history of cryptanalysis.

Before this method, the Vigenère cipher was sometimes considered indecipherable.

Kasiski's work demonstrated that a periodic polyalphabetic cipher could be attacked systematically through the analysis of repetitions.

This discovery contributed to the development of modern statistical cryptanalysis and deeply influenced the methods used until the 20th century.

Source code

dCode retains ownership of the "Kasiski's Test" source code. Any algorithm for the "Kasiski's Test" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Kasiski's Test" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Kasiski's Test" or any other element are not public (except explicit open source licence). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.

Cite dCode

The content of the page "Kasiski's Test" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source (Creative Commons CC-BY free distribution license).

Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).

To cite dCode.fr on another website, use the link: https://www.dcode.fr/kasiski-test

In a scientific article or book, the recommended bibliographic citation is: Kasiski's Test on dCode.fr [online website], retrieved on 2026-06-02, https://www.dcode.fr/kasiski-test

Need Help ?

Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!

Questions / Comments

Feedback and suggestions are welcome so that dCode offers the best 'Kasiski's Test' tool for free! Thank you!


https://www.dcode.fr/kasiski-test
© 2026 dCode — The ultimate collection of tools for games, math, and puzzles.
 
Feedback