ArticleslgStudy

computer science

Kasiski examination

Kasiski examination is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Kasiski examination rather than just read about it. In short: In cryptanalysis, Kasiski examination (also known as Kasiski's test or Kasiski's method) is a method of attacking polyalphabetic substitution ciphers, such as the Vigenère cipher. It was first published by Friedrich Kasiski in 1863, but seems to have been independently discovered by Charles Babbage as early as 1846.

Key takeaways

  • Kasiski examination belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Kasiski examination to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Kasiski examination from memory before moving on to harder problems.

Reference excerpt

In cryptanalysis, Kasiski examination (also known as Kasiski's test or Kasiski's method) is a method of attacking polyalphabetic substitution ciphers, such as the Vigenère cipher. It was first published by Friedrich Kasiski in 1863, but seems to have been independently discovered by Charles Babbage as early as 1846.

How it works In polyalphabetic substitution ciphers where the substitution alphabets are chosen by the use of a keyword, the Kasiski examination allows a cryptanalyst to deduce the length of the keyword. Once the length of the keyword is discovered, the cryptanalyst lines up the ciphertext in n columns, where n is the length of the keyword. Then each column can be treated as the ciphertext of a monoalphabetic substitution cipher. As such, each column can be attacked with frequency analysis. Similarly, where a rotor stream cipher machine has been used, this method may allow the deduction of the length of individual rotors. The Kasiski examination involves looking for strings of characters that are repeated in the ciphertext. The strings should be three characters long or more for the examination to be successful. Then, the distances between consecutive occurrences of the strings are likely to be multiples of the length of the keyword. Thus finding more repeated strings narrows down the possible lengths of the keyword, since we can take the greatest common divisor of all the distances. The reason this test works is that if a repeated string occurs in the plaintext, and the distance between corresponding characters is a multiple of the keyword length, the keyword letters will line up in the same way with both occurrences of the string. For example, consider the plaintext:

the man and the woman retrieved the letter from the post office

The word "the" is a repeated string, appearing multiple times. If we line up the plaintext with a 5-character keyword "beads" :

bea dsb ead sbe adsbe adsbeadsb ead sbeads bead sbe adsb eadsbe the man and the woman retrieved the letter from the post office

The word "the" is sometimes mapped to "bea", sometimes to "sbe" and other times to "ead". However, it is mapped to "sbe" twice, and in a long enough text, it would likely be mapped multiple times to each of these possibilities. Kasiski observed that the distance between such repeated appearances must be a multiple of the encryption period. In this example, the period is 5, and the distance between the two occurrences of "sbe" is 30, which is 6 times the period. Therefore, the greatest common divisor of the distances between repeated sequences will reveal the key length or a multiple of it.

A string-based attack The difficulty of using the Kasiski examination lies in finding repeated strings. This is a very hard task to perform manually, but computers can make it much easier. However, care is still required, since some repeated strings may just be coincidence, so that some of the repeat distances are misleading. The cryptanalyst has to rule out the coincidences to find the correct length. Then, of course, the monoalphabetic ciphertexts that result must be cryptanalyzed.

A cryptanalyst looks for repeated groups of letters and counts the number of letters between the beginning of each repeated group. For instance, if the ciphertext were FGXTHJAQWNFGXQ, the distance between FGX groups is 10. The analyst records the distances for all repeated groups in the text. The analyst next factors each of these numbers. If any number is repeated in the majority of these factorings, it is likely to be the length of the keyword. This is because repeated groups are more likely to occur when the same letters are encrypted using the same key letters than by mere coincidence; this is especially true for long matching strings. The key letters are repeated at multiples of the key length, so most of the distances found in step 1 are likely to be multiples of the key length. A common factor is usually evident. Once the keyword length is known, the following observation of Babbage and Kasiski comes into play. If the keyword is N letters long, then every Nth letter must have been enciphered using the same letter of the keytext. Grouping every Nth letter together, the analyst has N "messages", each encrypted using a one-alphabet substitution, and each piece can then be attacked using frequency analysis. Using the solved message, the analyst can quickly determine what the keyword was. Or, in the process of solving the pieces, the analyst might use guesses about the keyword to assist in breaking the message. Once the interceptor knows the keyword, that knowledge can be used to read other messages that use the same key.

Superimposition Kasiski actually used "superimposition" to solve the Vigenère cipher. He started by finding the key length, as above. Then he took multiple copies of the message and laid them one-above-another, each one shifted left by the length of the key. Kasiski then observed that each column was made up of letters encrypted with a single alphabet. His method was equivalent to the one described above, but is perhaps easier to picture. Modern attacks on polyalphabetic ciphers are essentially identical to that described above, with the one improvement of coincidence counting. Instead of looking for repeating groups, a modern analyst would take two copies of the message and lay one above another. Modern analysts use computers, but this description illustrates the principle that the computer algorithms implement. The generalized method:

The analyst shifts the bottom message one letter to the left, then one more letters to the left, etc., each time going through the entire message and counting the number of times the same letter appears in the top and bottom message. The number of "coincidences" goes up sharply when the bottom message is shifted by a multiple of the key length, because then the adjacent letters are in the same language using the same alphabet. Having found the key length, cryptanalysis proceeds as described above using frequency analysis.

External links Cryptanalysis: Breaking a Vigenère ciphertext with Kasiski's test on YouTube - A video that shows how to break a Vigenère ciphertext using the Kasiski examination

References

Worked examples

Example 1 — a first encounter with Kasiski examination

Start with the simplest possible case. Write down what Kasiski examination claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Kasiski examination before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Kasiski examination ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Kasiski examination

In research
Kasiski examination appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Kasiski examination in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Kasiski examination is common in secondary-school and first-year university syllabi. It links to neighbouring topics Cryptographic attacks, so understanding it makes those chapters shorter.
In everyday life
Look for Kasiski examination outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Kasiski examination” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Kasiski examination in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Kasiski examination means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Kasiski examination out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Kasiski examination in simple terms?

In cryptanalysis, Kasiski examination (also known as Kasiski's test or Kasiski's method) is a method of attacking polyalphabetic substitution ciphers, such as the Vigenère cipher. It was first published by Friedrich Kasiski in 1863, but seems to have been independently discovered by Charles Babbage…

Why does Kasiski examination matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Kasiski examination?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Kasiski examination.

Tags

  • Cryptographic attacks

Keep exploring