plaintext  shift  ciphertext  


Explanation Caesar shift encryption encrypts a message by replacing each character with the character x places further down in alphabetical order (wrapping back to the top if needed). The number x, called the shift index, is a secret key to be shared between the two communicating parties. The possible shift indices are 025, though a shift index of 0 is not a great idea, since it leaves the message unchanged! Cracking a Caesar shift encrypted message boils down to figuring out the shift index. The letter e is the most common character in English text. If you noticed that h was the most common character in the ciphertext, you might guess that h is what the letter e got shifted too, and deduce that the shift index is three. The idea of cryptanalysis by frequency analysis just makes that idea more systematic. In this demo, we use the English letter frequencies given in the table to the left, and the letter frequencies we observe in the ciphertext and deduce the most likely shift index in the following way: For each possible shift index i, we construct the plaintext that would result from shift index i, and compute how likely that plaintext would be given the English letter frequencies. Whichever shift produced the highest likelihood is our best guess. 