Substitution Cipher
Suggested experiment |
Overview
The Simple Substitution Cipher is a generalization of the Shift Cipher and the Affine Cipher. The key consists of 26 letters in some particular order, which give the ciphertext for each possible plaintext character from "a" to "z". Click NEW KEY to generate a random key, and CLEAR KEY to erase it. Given the key, you can enter plaintext into the INPUT TEXT box and click ENCRYPT to see the ciphertext. Or just click SECRET to let the computer choose a random plaintext message and key.You can use the two tabs to help you discover the key, clicking DECRYPT after each change to see how well the current key is working. Or you can give up and click SHOW KEY to see the entire key.
Letter Frequency
Click on the LETTER FREQUENCY tab to see the frequency of standard english text (black) and the ciphertext (red). Notice that the tallest black bar is for "e", so "e" is the most common letter in typical plaintext. If you then see that the tallest red bar is for "u", you might guess that the ciphertext "u"corresponds to the plaintext "e". You can then continue guessing starting with the second most common character.Rather than manually looking for the Nth smallest black and red bar, you can look at the bottom graph, which is the same as the top graph, except the bars are sorted by height. The leftmost black bar is "e", so if the leftmost red bar is "u", you might guess that "e" encrypts to "u". To put this guess (and the other 25 analagous guesses) into the key, click SET KEY. You can then click on DECRYPT to see how well this guess worked. If the plaintext and ciphertext are too long to fit on the screen at the same time, you can click on "<" and ">" to move the text left or right, or ">>" to start back over at the beginning.

