| plaintext | shift | cyphertext | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Explanation Ceasar 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 0-25, though a shift index of 0 is not a great idea, since it leaves the message unchanged! Cracking a ceasar 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 cyphertext, you might guess that h is what the letter e got shifted too, and deduce that the shift index is three. The idea of cryptoanalysis 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 cyphertext 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 liklihood is our best guess. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||