This section provides an example illustrating the use of the Caesar encryption algorithm. To make it easier to follow the steps that need to be performed with CrypTool, the example is illustrated with a number of screenshots.
First of all, to acquaint ourselves with the Caesar encryption algorithm we will open a document, encrypt it and then decrypt it again. We will then try to get the computer to work out the key with which a plaintext is encrypted.
Therefore, we open the file CrypTool-en.txt
out of the directory CrypTool\examples
via the menu File \ Open.
We will now encrypt this document using the Caesar encryption algorithm. To do this, we select the menu Crypt/Decrypt \ Symmetric (classic) \ Caesar/Rot-13. Then the following which this dialog box appears. The key we enter is the letter A
. Additionally, we change the options how to interpret the alphabet characters: The first alphabet character is set to 1 (if we set the first character to 0 and use A as key, then the resulting ciphertext is the same as the plaintext).
Clicking on the Encrypt button opens a new window that contains the encrypted text. On closer examination of the text it becomes apparent that the letters have been shifted by one position, so that the initial word, CrypTool
, is now DszqUppm
.
The plaintext version of this encrypted document can now be obtained by selecting Crypt/Decrypt \ Classical \ Caesar again. In the dialog box which now appears we enter the key with which the document was encrypted (A
). This time we do not want the text to be encrypted, but instead to be decrypted. Therefore the Decrypt button must be selected.
Clicking on the Decrypt button tells CrypTool to go ahead and decrypt the text. The plaintext appears immediately.
We have seen how a text is encrypted using the Caesar encryption algorithm and then decrypted again.
Under the classical Caesar encryption algorithm only the letters are encrypted. During encryption, the lower case letters were converted to upper case letters and encrypted, but all the other characters such as punctuation characters and formatting characters (blank characters and line breaks) were omitted.
In the classical encryption algorithms CrypTool retains the formatting by default. This can be disabled via the menu option Options \ Text Options. In the following dialog box the option Keep characters not present in the alphabet unchanged and the option Distinguish between uppercase and lowercase must be disabled.
We now return to the window containing the plaintext (by clicking on it with the mouse) and encrypt this document once again with the Caesar encryption algorithm, using the key A
. From the results one can see immediately that the encrypted text has the same content as the previous version but this time it contains only upper case letters and the formatting has been removed. For example, the first characters in the encrypted text are once again DSZQUPPM
(the ciphertext of CrypTool
).
To improve legibility, blocks of five characters have been created and a space has been inserted after every fifth character.
We would like to save this document under a different name. Select File \ Save As to access the dialog box used for saving a document under a new name. As file name we enter CrypTool.Caesar.txt
.
The decryption operation works in exactly the same way as described above. We decrypt this document once again and the plaintext version is restored. This of course now consists only of a sequence of upper case letters. Because no distinction is made any longer between upper and lower case letters, and especially because of the absence of formatting, this text is more difficult to read. However, if we compare the document briefly with the original text, we can see that it is the same text. The original text begins with the words, ”CrypTool is a program which will enable you …” These words appear once again in the first line of the decrypted text.
Having now learned the steps involved in encrypting and decrypting a document, we would like to take a look at the security of the Caesar encryption algorithm. To do this, all the windows should be closed apart from the window containing the plaintext and the version of the encrypted text in which the formatting is retained. The only two windows now open should be the following:
First, make the window containing the plaintext the active window again by clicking on it with the mouse. We now have the entropy (accessed via the menu selection Analysis \ General \ Entropy) and
the frequency distribution of the letters (Analysis \ General \ Histogram) calculated.
We repeat the same procedure after making the other window active. We can see immediately that both documents have the same entropy.
When we examine the histogram of the encrypted document we can see that the letter frequencies have merely been shifted by one position. That means that this old encryption algorithm is not secure. (Moreover there are only 26 possible keys, and of these the Z
shifts the text by 26 positions so that the ”encrypted” text is actually identical with the unencrypted text. Hence there are really only 25 keys!)
The Caesar encryption algorithm can be broken easily by a ciphertext-only attack. To perform such an attack, restore the window containing the encrypted text to the active window and select Analysis \ Ciphertext-only \ Caesar. The text will automatically be analyzed.
By analyzing the superposition it is possible to discover the key which was used to encrypt this document. In this case it was the letter A
.
When you click on the Decrypt button in the message window, the plaintext appears, i.e. the text that has been decrypted with the key A
that was discovered.
So CrypTool managed successfully to find the key with which the document had been encrypted. The only information it needed to do this was the encryption algorithm.