Example illustrating encryption using binary addition

This section provides an example illustrating the use of binary addition for encryption. To make it easier to follow the steps that need to be performed with CrypTool, the example is illustrated with a number of screenshots.

A text document will be used to illustrate encryption through binary addition and a Ciphertext Only attack on this method. It will be shown that with many encrypted documents it is easy to work out the key and hence the plaintext as well. However, if the plaintext is compressed prior to encryption, the key and the plaintext cannot be worked out directly with CrypTool as the frequencies of the individual characters prior to encryption (but after compressing) are not known. On the other hand, certain properties of uncompressed documents, such as texts, are known and can therefore be utilised in the analysis.

The example presented here functions in a manner similar to a binary document containing, for example, a graphic image (in contrast to the text document used in this example). In an example illustrating encryption using the Exclusive-OR, the steps performed are similar to those described here except that the file that is encrypted is a graphic image in the form of a bitmap, i.e. a binary document.

First of all we load part of the CrypTool Help text entitled ”Introduction to CrypTool”, which will be found in the CrypTool-en.txt file. To open this document in CrypTool, select File \ Open.

szenarioadd1.gif

Before the document is encrypted, let us examine the frequency distribution of the characters as presented in the form of a histogram. Select Analysis \ General \ Histogram).

szenarioadd2.gif

One can see from the histogram that the character which occurs most frequently is the letter E. This is true of many German and English texts. This information will be utilised later on during our attack.

First of all, make the text document the active window again by clicking on it with the mouse. To now encrypt the document using binary addition, select Crypt/Decrypt \ Symmetric (classic) \ Addition. Now enter 12 34 AB CD into the dialog box which opens as the key.

szenarioadd3.gif

Click theEncrypt button, and a new window opens containing the encrypted document.

szenarioadd4.gif

A ciphertext-only attack will now be performed. To do this, with the document encrypted in the last step as the active window, select Analysis \ Ciphertext-Only \ Addition, and the autocorrelation will be calculated and displayed.

szenarioadd5.gif

Following a click on the OK button the Automatic Analysis dialog box appears, in which we are told that the key length is calculated to be 4. As we saw at the beginning, the commonest character is the letter E. The hexadecimal value of E is 45 (see ASCII Table). If, however, we return briefly to the plaintext, we notice that the character which occurs most frequently is not the upper case letter E, but the lower case letter e. In most texts, the lower case letter e is the character which occurs most frequently. In shorter texts it could also be the space, which has a hexadecimal value of 20. The hexadecimal value of e is 65. This we enter into the Expected most common character field in the Automatic Analysis dialog box.

szenarioadd6.gif

CrypTool has been able to find the key, as can be seen from the next box. The only information that was needed to do this was the fact that the character which occurred most frequently in the plaintext was the lower case letter e.

szenarioadd7.gif

A click on the OK button produces a new window containing the plaintext.

szenarioadd8.gif

The key 12 34 AB CD, with which the text document was originally encrypted, is displayed in the window title bar.

In this case it was no problem for CrypTool to work out the key and hence the plaintext version of an encrypted document as we did have some information about the encrypted document, namely that it contained text. We also knew that the lower case letter e is often the character that occurs most frequently in textual documents.

But if the text is compressed prior to encryption then we will not be able to draw any conclusions from the frequency distribution of the characters in the text about the frequency distribution of the compressed text, since the compression process not only reduces the size of a file but alters the frequencies of the individual characters so that they no longer reflect the frequencies of the characters in the original text. This means that we do not know the commonest character and cannot help CrypTool with the analysis.

To compress the document, it must be made the active window again.

szenarioadd1.gif

It can now be compressed by selecting the menu option Compress \ Zip.

szenarioadd19.gif

The rate of compression is displayed, following which the compressed document is shown.

szenarioadd9.gif

For this document too, let us first take a look at the histogram (Analysis \ General \ Histogram).

szenarioadd10.gif

One can see immediately that the compression process produces a quite different histogram profile from the one previously obtained for the uncompressed document. The characters are much more evenly distributed than in the unencrypted document.

While it is possible to attempt to analyze an encrypted, compressed document, because we do not know which character occurs most frequently in a compressed document, we cannot provide CrypTool with any help during the analysis and must therefore use the default value of 00 as the character which occurs most frequently.

Make the compressed document the active window once again and then encrypt it, using the same key as before: 12 34 AB CD.

szenarioadd3.gif

Following input of the key and a click on the OK button, the window with the encrypted document appears as usual.

szenarioadd11.gif

We now invoke the Analysis function again and see that the autocorrelation process has not been as accurate as before in its estimate of the length of the key as before.

szenarioadd12.gif

CrypTool in fact returns an incorrect key length of 34.

szenarioadd13.gif

Given this key length, it is not possible to find the correct key either.

szenarioadd14.gif

A mouse click on the OK button produces a display, incorrect of course, of the plaintext document. This document bears no similarity with the original compressed, but unencrypted document.

szenarioadd15.gif

Finally, we would like to check whether it is possible to arrive at a readable version of the text document from the compressed and then encrypted document. To do this we need to know the key with which the document was encrypted (12 34 AB CD) and the encryption algorithm (binary addition). First of all we make the compressed, encrypted document the active window again.

szenarioadd11.gif

We now decrypt the document with the known key. Make sure you select the Decrypt option in the dialog box i.e. so that there is a dot in the radial button to the left the field. This is achieved by clicking on the field.

szenarioadd18.gif

Clicking the OK button produces the unencrypted, but still compressed document.

szenarioadd16.gif

The document can now be decompressed by selecting Compress \ UnZip, and the original text is displayed once more.

szenarioadd17.gif