# The Black Chamber

The strength of the Vigenère Cipher is that the same letter can be encrypted in different ways. For example, if the keyword is KING, then every plaintext letter can be encrypted in 4 ways, because the keyword contains 4 letters. Each letter of the keyword defines a different cipher alphabet in the Vigenère Square. The 'e' column of the square is highlighted to show how encipherment depends on which keyword letter is defining the encryption. Similarly, whole words will be enciphered in different ways - the word 'the' could be enciphered as DPR, BUK, GNO and ZRM depending on its position relative to the keyword. Although this makes cryptanalysis difficult, it is not impossible.

The important point to note is that if there are only four ways to encipher the word 'the', and the original message contains several uses of the word 'the', then it is inevitable that some of the four possible encipherments will be repeated in the ciphertext. This is demonstrated in this example, in which the line "The Sun and the Man in the Moon", has been enciphered using the Vigenère cipher and the keyword KING.

The word 'the' is enciphered as DPR in the first instance, and then as BUK on the second and third occasions. The reason for the repetition of BUK is that the second 'the' is displaced by 8 letters with respect to the third 'the', and 8 is a multiple of the length of the keyword. In other words, the second 'the' was enciphered according to its relationship to the keyword, and by the time we reach the third 'the', the keyword has cycled round exactly twice, to repeat the relationship.

Babbage's vital breakthrough was to realise that repetitions in the ciphertext indicated repetitions in the plaintext and that the space between such repetitions hinted at the length of the keyword. The following example explains how you exploit this observation to crack the Vigènere Cipher.