The Principle of the Enigma | Tony Sale's Codes and Ciphers |
This is Page 1 of Tony Sale's sequence of pages explaining the Enigma machine.
This page gives an introduction to substitution ciphers and the principle underlying the Enigma.
In all cipher systems one assumes that the message has been intercepted. The objective is then to make it impossible, or at any rate very difficult and time-consuming, for the interceptor to decrypt the message.
In any practical cipher system, it must also be assumed that the interceptor will at some point find out the general system that is being used. Security of the message resides in preventing the interceptor from finding out the message key, the specific details of exactly how the system was configured for sending that particular message.
It is vital that there is a secure way of communicating the message key to the intended recipient.
Another necessity for a useful cipher system is that there should be a vast number of different possible message keys, i.e. different ways in which the system could have been configured when the message was enciphered. Otherwise the interceptor can simply try them all out.
The simplest substitution is Caesar's cipher:
ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG
....ABCDEFGHIJKLMNOPQRSTUVWXYZ
To encipher, the letter on the bottom row is written down as the substitution for the text letter on the top row.
To decipher, the received cipher is looked up in the bottom row and the text letter read off from the top row above it.
In this case the message key, which the recipient needs to know, is just the displacement between the two alphabets.
This is a simple example of a cipher system which shows an immediate flaw: there are only 26 possible message keys and so anyone can just try them out. (Example: crack FDHVDU)
A more sophisticated system uses a random series of characters for the lower alphabet.
ABCDEFGHIJKLMNOPQRSTUVWXYZ
IPHBOSFCQZJNTWGLMYRXDKEUVA
Now the recipient has to know the substitution alphabet, and this sequence of letters is in effect the message key.
There are a huge numbers of possible substitutions (actually 403,291,461,126,605,635,584,000,000 for an alphabet of 26 letters.)
But such encipherments are still easily broken by using common-sense facts such as that E is the most common letter, THE the most common word, and so forth. It is very worthwhile noting that having a large number of possible keys does not in itself provide security. (This is really the same principle as allows you to solve crossword anagrams. There are vast numbers of possible permutations of the letters, but most of them can be eliminated because they lead to impossible words.)
In the nineteenth century various schemes for polyalphabetic systems were invented. In these, there is more than one substitution alphabet and they are used in rotation, or by some other rule. The message key then has to give the total system involving the alphabets used and the rule for using them. If the rule is simple then statistical methods can still easily break the cipher; and the problem about making such systems more complex is that the encipherment then requires a large handbook and hours of error-prone labour.
By the twentieth century it became possible to carry out substitutions by using electrical connections to mechanise the dreary and difficult work of looking up tables in a handbook. This is what led to the Enigma.
It enciphers a message by performing a number of substitutions one after the other. Scherbius's idea was to achieve these substitutions by electrical connections.
Figure 1 |
Figure 1 shows just a few of the 26 wires which will give the effect of the substitutions given earlier as a look-up table. For instance there is a wire from Q in the top row to M in the bottom row. Thus an electrical voltage applied to the Q terminal on the top row will appear at the M terminal on the bottom row.
A simple way to implement this is to have 26 press switches (keys), one for each letter of the alphabet, connecting a battery to the top letter terminal where the key is pressed. The voltage then flows through the connecting wires to finally light one of a set of lamps connected one to each letter of the alphabet on the bottom row. Thus if the key on the top Q terminal is pressed, the lamp on the bottom M terminal will light. This shows that M is the 'substitution' for Q for this configuration.
The next idea is that it is not much more difficult to compose substitutions which are to be performed one after the other. The bottom row of terminals can simply be connected to the entry terminals of another set of wires, as in figure 2.
The voltage appearing at the M terminal carries on to the R terminal on the bottom row. Thus the wirings have achieved a 'substitution' first from Q to M and then from M to R. figure 2 |
Now this as it stands is no advance at all, since we might as well have combined the two substitutions into one, but this is where the ancient Caesar shift takes on a new twentieth century application. Suppose the second set of wirings is displaced by 2 letters, as in Figure 3:
figure 3 |
In figure 3, an input at letter Q results in a lamp L lighting.
Each choice from the 26 possible shifts now gives rise to a completely different substitution alphabet.
Engineer this with spring loaded connections between wheels and hey presto! you have the basis of the Enigma machine.
The next step is have a third wheel in series, as different relative displacements of the wheels will then give rise to 26x26=676 different substitution alphabets. However the Enigma machine was given another element of complexity by the inventor Willi Korn, who added a reflector.
Thus in total seven substitutions are performed in succession by the basic Enigma: by the three wheels, then by the reflector swapping, then by the three wheels in the reverse direction.
You can look at this in more detail in the EXAMPLE.
One effect of this extra complexity is that there are now 26x26x26=17,576 different substitution alphabets arising from different positions of the wheels moving with respect to the fixed reflector.
But in one respect the addition of the reflector made the Enigma a simpler system. The reflector made the Enigma machine reciprocal. If in some given position of the wheels, A is enciphered to Q, then in the same configuration, Q will be enciphered to A. This knowledge is of considerable use to the interceptor who is trying to break the system.
A further downside of the reflector is that no letter can ever encipher to itself. This severe cryptographic weakness was much exploited first by the Poles and then by Bletchley Park.
There is an operational advantage to a reciprocal cipher system: the Enigma does not need to be switched from 'encipher mode' to 'decipher mode' and this prevents the inevitable errors that will occur from time to time when an operator forgets to switch over. However the German military were to pay a very heavy price for this small advantage.
Continue to the next page to see how the Enigma was put together and how it was given a further layer of complexity for German military use.
This page is created by Tony Sale (tsale@qufaro.demon.co.uk) the original curator of the Bletchley Park Museum |
Web-editing by Andrew Hodges, biographer of |