Current location - Quotes Website - Excellent quotations - What is the working principle of the enigma machine developed by Germany during World War II?
What is the working principle of the enigma machine developed by Germany during World War II?

ENIGMA looks like a box filled with complex and delicate components. But if we open it up, we can see that it can be broken down into quite simple parts. The picture below is a schematic diagram of its most basic parts. We can see its three parts: keyboard, rotor and display.

In the photo of ENIGMA above, we see that the lower part of the horizontal panel is the keyboard, with 26 keys per keyboard, and the keyboard arrangement is close to the computer keyboard we use now. To keep the message as short as possible and more difficult to decipher, spaces and punctuation are omitted. In the schematic we have only drawn six keys. In the actual photo, the display is above the keyboard. It consists of 26 small lights marked with the same letters. When a key on the keyboard is pressed, the small light corresponding to the encrypted ciphertext of this letter is on. The display lights up. Likewise, we only drew six small lights on the schematic. Above the display are three rotors, their main parts hidden under the panel. In the schematic diagram we have only drawn one rotor for the time being.

The keyboard, rotor and display are connected by wires. The rotor itself also integrates 6 lines (26 in the actual version), which corresponds the keyboard signals to different small lights on the display. In the schematic diagram, we can see that if the a key is pressed, the light B will light up, which means that a is encrypted into B. Similarly, we see that b is encrypted into A, c is encrypted into D, d is encrypted into F, e is encrypted into E, and f is encrypted into C. So if we type cafe (coffee) on the keyboard, DBCE will be displayed on the monitor. This is one of the simplest encryption methods. Each letter is replaced by another letter in a one-to-one correspondence. This encryption method is called "simple substitution cipher".

Simple replacement passwords appear very early in history. The famous "Caesar's method" is a simple substitution method, which corresponds each letter to the letter in the following positions in the alphabet. For example, if we take the last three positions, then the one-to-one correspondence of letters is as shown in the following table:

Plain code alphabet: abcdefghijklmnopqrstuvwxyz

Password alphabet: DEFGHIJKLMNOPQRSTUVWXYZABC

< p> So we can get the cipher text from the plain text: (veni, vidi, vici, "I come, I see, I conquer" is the famous saying declared by Jules Caesar to the Roman Senate after conquering King Pharnasis of Pontus )

Plain text: veni, vidi, vici

Cipher text: YHAL, YLGL, YLFL

Obviously, this simple method has only 26 possibilities , not enough for practical application. Generally, a relatively arbitrary one-to-one correspondence is specified, such as

Plain code alphabet: abcdefghijklmnopqrstuvwxyz

Password alphabet: JQKLZNDOWECPAHRBSMYITUGVXF

You can even define a password yourself Alphabet graphics instead of Latin letters. However, the ciphertext obtained using this method is still quite easy to crack. As late as the ninth century AD, Arab codebreakers had mastered the method of counting the frequency of letter occurrences to break simple substitution ciphers. The principle of cracking is very simple: in each Pinyin language, the frequency of each letter is different. For example, in English, the number of occurrences of e is much higher than that of other letters. So if we obtain enough ciphertext, by counting the frequency of each letter, we can guess which letter in the password corresponds to which letter in the plain code (of course, we also need to figure out the context and other basic password-breaking methods). Conan Doyle described in detail the process of Holmes using frequency statistics to decipher the code of dancing figures in his famous Sherlock Holmes detective collection "The Dancing Man".

So if the role of the rotor is just to replace one letter with another, it doesn't mean much. But you may have guessed that the so-called "rotor" will rotate! This is the most important design of ENIGMA - when a key on the keyboard is pressed, the corresponding cipher text is displayed on the display, and then the direction of the rotor automatically rotates by one letter (in the schematic diagram it is rotated 1/6 turn, while in reality it turns 1/26 turn). The schematic diagram below shows the situation of typing three b's in succession:

When b is typed for the first time, the signal passes through the connection in the rotor, and the light A lights up. After releasing the key, the rotor rotates one frame. , the password corresponding to each letter changes; when you type b for the second time, the letter corresponding to it becomes C; similarly, when you type b for the third time, the light E flashes.

The left side of the photo is a complete rotor, and the right side is an exploded rotor. We can see the wires installed in the rotor.

Here we see the key to ENIGMA encryption: this is not a simple replacement cipher.

The same letter b can be replaced by different letters when it is in different positions in the plaintext, and the same letter in different positions in the ciphertext can represent different letters in the plaintext. The frequency analysis method has no place here. This encryption method is called a "double substitution cipher".

But we see that if you type 6 letters in a row (26 letters in the real thing), the rotor will make a complete turn and return to the original direction. At this time, the encoding will be repeated as before. In the encryption process, the phenomenon of repetition is very dangerous, which can make people trying to decipher the code see regular things. So we can add another rotor. When the first rotor rotates a full circle, a tooth on it moves the second rotor, causing its direction to rotate one letter position. Look at the schematic diagram below (for simplicity, we will now represent it in planar form):

Here (a) in the diagram we assume that the first rotor (the one on the left) has made a complete rotation, When the b key is pressed, the D light on the display lights up; when the b key is released, the teeth on the first rotor also drive the second rotor to rotate one space at the same time. Therefore, when b is typed for the second time in (b), the encrypted letters are F; when you release key b again, only the first rotor rotates, so when you type b for the third time in (c), the letter B corresponds to b.

We have seen that using this method, it takes 6*6=36 (26*26=676 in reality) letters before the original encoding is repeated. In fact, there are three rotors in ENIGMA (the ENIGMA used by the German Navy in the late World War II even had four rotors), and the number of non-repeating directions reaches 26*26*26 =17576.

Not only that, a reflector is cleverly added to one end of the three rotors, and the same letters in the keyboard and display are connected with wires. The reflector, like the rotor, connects one letter to another, but it does not rotate. At first glance, such a fixed reflector seems of little use. It does not increase the number of codes that can be used, but when you link it with decoding, you will see the ingenuity of this design. See the image below:

We see here that the same letters in the keyboard and monitor are connected by wires. It's actually a very clever switch, but we don't need to know the details of it. We only need to know that when a key is pressed, the signal is not transmitted directly from the keyboard to the display (if so there would be no encryption), but first passes through a line connected by three rotors, and then passes through the reflector and back again The three rotors reach the display through another line. For example, when the b button is pressed in the picture above, the D light lights up. Let's see if you press the d key instead of the b key at this time, then the signal will travel in the opposite direction of when the b key is pressed above, and finally reach the B light. In other words, under this design, although the reflector does not increase the number of possible non-repeating directions like a rotor, it can make the decoding process exactly the same as the encoding process.

      Reflector

Imagine you want to send a message using ENIGMA. The sender must first adjust the directions of the three rotors so that they are in one of the 17576 directions (in fact, the initial direction of the rotors is the encryption key, which must be agreed upon by both the sender and the receiver in advance), and then type in the plaintext in sequence, and put the flash Write down the bright letters in order, and then the encrypted message can be sent out by, for example, a telegram. When the recipient receives the message, he uses the same ENIGMA to adjust the direction of the rotor to the same initial direction as the sender according to the original agreement, then types in the received ciphertext in sequence, and turns the blinking Write down the letters in sequence, and you will get the plain text. So the encryption and decryption processes are exactly the same - this is the role of the reflector. Thinking about it for a moment, it's easy to see that a side effect of reflectors is that a letter can never be encrypted into itself, because a letter in a reflector is always connected to a different letter.

The reflector and three rotors installed in ENIGMA

Therefore, the initial direction of the rotor determines the encryption method of the entire ciphertext. If there is an enemy listening in the communication, he will receive the complete ciphertext, but since he does not know the initial directions of the three rotors, he will have to experiment in each direction to find the key. The problem is that 17576 initial directions is not a very large number. If someone trying to decipher a cipher text adjusted the rotor in a certain direction and then typed in the beginning of the cipher text, see if the output looked like a meaningful message. If it doesn't look like it, then try the next initial direction of the rotor... If it takes about a minute to try one direction, and he works 24 hours a day and night, then he can search all possible initial directions of the rotor in about two weeks. . If the opponent uses many machines to decipher it at the same time, the time required will be greatly shortened. This level of confidentiality is not sufficient.

Of course, you can add more rotors, but we see that the possibility of the initial direction of each additional rotor is only multiplied by 26. In particular, adding rotors increases the size and cost of ENIGMA.

However, this encryption machine must be portable (in fact its final size is 34cm * 28cm * 15cm), rather than a behemoth with a dozen rotors. In Enigma's design, the three rotors of the machine can be disassembled and exchanged with each other, so that the possibility of initial orientation becomes six times greater than before. Assuming that the three rotors are numbered 1, 2, and 3, they can be placed in six different positions: 123-132-213-231-312-321. Of course, both parties sending and receiving messages must pre-agree on the initial direction of the rotor itself. , and also agree to use one of these six arrangements.

Secondly, a connecting plate is designed between the keyboard and the first rotor. This connection board allows the user to connect a letter to another letter with a wire, so that the signal of that letter is converted into the signal of the other letter before entering the rotor. There can be up to six such connections (later ENIGMA has more connections), so that the signals of 6 pairs of letters can be interchanged, and the other letters that are not connected to the connections remain unchanged. In the actual picture of ENIGMA above, we see that this connection board is under the keyboard. Of course, the connection status on the connection board also needs to be agreed in advance by both parties sending and receiving information.

In the diagram above, when the b key is pressed, the light C lights up.

So the initial direction of the rotor itself, the mutual position between the rotors, and the connection status of the connecting board constitute all possible keys. Let us calculate how many there are. kind.

The different directions of the three rotors constitute 26*26*26=17576 different possibilities;

The different relative positions between the three rotors constitute 6 possibilities;

p>

The number of possibilities for exchanging 6 pairs of letters on the connecting board is very huge, 100391791500;

So there are 17576*6*100391791500, which is about 10000000000000000, that is, one Billions of possibilities.

As long as the above-mentioned key is agreed upon, both the sender and the receiver can use ENIGMA to encrypt and decrypt very easily. But if you don't know the key, it is completely impossible to try to find the key one by one in the face of this huge possibility. We see that connecting plates contribute the most to the increase in possibilities, so why go to all the trouble of designing something like a rotor? The reason is that the connection board itself is actually a simple replacement cipher system. During the entire encryption process, the connection is fixed, so it is very easy to decipher using frequency analysis method alone. Although the rotor system does not offer many possibilities, they rotate continuously during the encryption process, turning the entire system into a duplex replacement system, and frequency analysis can no longer do anything about it. At the same time, the connection plate makes the possibility The number has greatly increased, making brute force deciphering methods (that is, the method of trying all possibilities one by one) prohibitive.