In the notes from which I'm studying I read about Kasisky test:

"Key observation: Two identical segments of $l ≤ L$ plaintext letters, will be encrypted to the same $l ≤ L$ ciphertext letters."

Where $L$ is the length of the keyword in the sense that

$$k=(k_0, k_1, . . . , k_{L−1}) \ with \ k_j \in (0, . . . , 25)$$

Is the cypher keyword with, obviously, the number $0, ... 25$ representing each one a different letter of the english alphabet ($A=0, B=1,...,Z=25$)

But if I think about an example like this one

$ptx: $ "Our is the fury" $\Rightarrow$ "Ouristhefury"

$key: $ "$BCDEF$"

Which denoting the $ptx$ as

$$ptx = p_0p_1... , p_i,... $$

applies the encryption:

$$c_i = (p_i + k_{i \pmod L}) \pmod {26} $$

Represented with a table:

$$\begin{array}{|c|c|c|} \hline \text{$ptx$} & \text{O} & \text{u} & \text{r} & \text{i} & \text{s} & \text{t} & \text{h} & \text{e} & \text{f} & \text{u} & \text{r} & \text{y} \\ \hline \text{$key$} & \text{B} & \text{C} & \text{D} & \text{E} & \text{F} & \text{B} & \text{C} & \text{D} & \text{E} & \text{F} & \text{B} & \text{C} \\ \hline \text{$ctx$} & \text{p} & \text{w} & \text{u} & \text{m} & \text{x} & \text{u} & \text{j} & \text{h} & \text{j} & \text{z} & \text{s} & \text{a} \\ \hline \end{array}$$

Following the definition above the two segments "ur" should be encrypted to two equal letters in the cypertext, but instead they are encypted respectively to:

  • "wu", first occurrence
  • "zs", second occurrence

I think that they're encrypted into the same two letters of the $ctx$ only when the two couples of $ptx$ letters are located in positions where the same shift occurs (same letter of the keyword).

So my question is: is there some imprecision in the statement from my notes or I'm interpreting something wrong?


1 Answer 1


There is imprecision in what is stated in your notes. The Kasisky test only works if the corresponding letters in the two segments are separated by a distance that is a multiple of the key length (in other words they are encrypted by the same letter in the key). For example (source Wikipedia):

[crypto] is short for [crypto]graphy.

Note that the key here is $5$ letters long and the distance between corresponding letters in the two segments is $20 = (5*4)$ so the corresponding ciphertext segments will also be the same. It is also worth observing that there is no need for $l \le L$ as seen in the above example.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.