If this tool helped you, you can buy us a coffee ☕
Estimate the key length of classical ciphers like the Vigenère cipher by analyzing repeated ciphertext sequences to assist in decryption.
Enter text to start test

CRC16 Checksum Calculator
Online CRC16 checksum tool to calculate 16-bit cyclic redundancy check values for text, Hex, and Base64 data to verify data integrity.

Caesar Cipher Encoder & Decoder
Easily encrypt and decrypt text using the Caesar cipher (shift cipher) with custom alphabets and shift values online.

Random Number Generator
Generate random integers or decimals within a specified range, featuring duplicate removal, sorting, and formatted output.
When you encounter a ciphertext encrypted by a classical polyalphabetic substitution cipher like the Vigenère cipher, decryption is nearly impossible without knowing the key length. The Kasiski examination is a classic cryptanalysis technique designed to solve this exact problem. It works by scanning the ciphertext for repeated letter sequences (usually 3 or more letters) and calculating the distances between these repetitions to deduce the key length used during encryption. The core principle is simple: if repeated sequences appear in the ciphertext, and these repetitions occur because the same words or phrases in the original plaintext were encrypted by the same parts of the key, then the distance between the repeated sequences is highly likely to be a multiple of the key length. By analyzing the greatest common divisors of the distances between all repeated sequences, the most probable key length can be estimated, laying the groundwork for subsequent decryption steps like frequency analysis. In short, the Kasiski examination is a statistical algorithm for estimating key length.
Q: Are there any requirements for the ciphertext length in a Kasiski examination?
The longer the ciphertext, the more reliable the results. Usually, hundreds of characters are needed to effectively identify non-coincidental repeating patterns. Ciphertexts that are too short may lead to misjudgments due to insufficient statistical samples.
Q: Is the "Possible Key Length" provided in the test results unique?
Not necessarily. This is the most common question about the Kasiski examination. The answer is no; the tool usually outputs one or more candidate lengths. For example, for a given ciphertext, the tool might output "3, 6, 9", where 3 is the most likely key length, and 6 and 9 are its multiples. You need to cross-verify this with other techniques, such as the Index of Coincidence (Friedman test), to determine the final correct length.
Please use plain text ciphertext for your input and avoid including irrelevant explanatory text or special formatting. The tool's analysis is based on exact matches of letter sequences; non-alphabetic characters (like numbers and punctuation) may be ignored or interfere with the results. The results of the Kasiski examination are probabilistic estimates, not definitive conclusions, especially when the ciphertext is short or repeating patterns are not obvious. Please do not use this tool to process ciphertexts containing real sensitive information. Although the analysis is performed on the browser's front end, data privacy should always be a priority.
In practical cryptanalysis, the Kasiski examination is often used in conjunction with the Friedman test (Index of Coincidence). The former estimates the key length from the perspective of "repetition intervals," while the latter verifies it from the perspective of "statistical characteristics of letter distribution." Combining the two can significantly improve accuracy. A typical workflow is: first, use this tool to get a few candidate key lengths (e.g., 5, 10, 15), then group the ciphertext according to each candidate length, and calculate how well the frequency distribution of letters in each group matches standard English letter frequencies (Index of Coincidence). The length with the highest match is the most likely true key length. Additionally, the effectiveness of the Kasiski examination is greatly reduced for ciphertexts that intentionally include a large number of "null characters" or use non-standard alphabets.