How enigma cryptographic machine works

Source: Internet
Author: User
Tags reflector

Note: This article is based on the rise and fall of Enigma

 

Enigma

 

Enigma looks like a box filled with complex and exquisite components. However, if we open it, we can see that it can be broken down into several simple parts. The figure below is the most basic part of it. We can see three parts of it: keyboard, rotor, and display.

 

 

In the above enigma photo, we can see that the lower part of the horizontal panel is the keyboard, a total of 26 keys, the keyboard is arranged close to the computer keyboard we are currently using. In order to make messages as short as possible and more difficult to decrypt, spaces and punctuation marks are ignored. In, we only drew six keys. In a physical photo, the display is above the keyboard. It consists of 26 small lights with the same letter. When a key on the keyboard is pressed, the light corresponding to the encrypted ciphertext of the letter is on the display. Similarly, we drew only six small lights. There are three rotor s above the display, their main parts are hidden under the panel, and we only draw one rotor at the moment.

The keyboard, rotor, and display are connected by wires, and the rotor itself is also integrated with six lines (26 in the real world) to map the keyboard signal to different small lights on the display. We can see that if you press the key, the light B will be on, which means that a is encrypted into B. Similarly, we can 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. Therefore, if we type cafe (coffee) on the keyboard, dbce will be displayed in turn on the display. This is one of the simplest encryption methods. Each letter is replaced by a one-to-one matching method, which is called "simple password replacement ".

Simple Password replacement has appeared for a long time in history. The famous "Caesar method" is a simple replacement method, which maps each letter to the letter in the last several positions of the alphabet. For example, if we take the last three positions, the one-to-one correspondence of letters is shown in the following table:

English alphabet: abcdefghijklmnopqrstuvwxyz

Password alphabet: defghijklmnopqrstuvwxyzabc

So we can get the ciphertext from the plain text: (Veni, vidi, vici, "I come, I see, I conquer" it was announced to the old man of Rome after the master of rules Caesar conquered the king of bonassis.Famous saying)

Plaintext: Veni, vidi, vici

Ciphertext: yhal, ylgl, ylfl

Obviously, there are only 26 possibilities for this simple method, which is insufficient for practical application. Generally, it specifies a random one-to-one correspondence, for example

English alphabet: abcdefghijklmnopqrstuvwxyz

Password alphabet: jqklzndowecpahrbsmyitugvxf

You can even define a password and a letter, instead of a Latin letter. However, the ciphertext obtained by using this method is quite easy to crack. No later than the 9th century, the Arabic cryptographic experts have mastered the method of counting the occurrence frequency of letters to break through simple password replacement. The principle of cracking is simple: in each pinyin language, each letter appears at a different frequency. For example, e appears more frequently than other letters in English. Therefore, if enough ciphertext is obtained, the occurrence frequency of each letter is calculated, we can guess which letter in the password corresponds to the letter in the clear code (of course, we also need to figure out the context and other basic password decryption methods ). Conan Doyle described in detail the process of using frequency statistics to crack dancing humanoid passwords in his famous Sherlock Holmes episode "dancing man.

So if the role of the rotor is only to replace one letter with another, it doesn't mean much. But you may have guessed that the so-called "Rotor" will turn! This is the most important design of Enigma-when a key on the keyboard is pressed, the corresponding ciphertext is displayed on the display, then, the rotor is automatically rotated to the position of a letter (in the center, 1/6 turns, and in reality, 1/26 turns ). The following describes how to type Three B consecutively:

 

 

When I type B for the first time, the signal goes through the link in the rotor. When the light a is on and the key is opened, the rotor turns one cell and 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 shines.

 

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

 

Here we see the key to Enigma encryption: this is not a simple password replacement. The same letter B can be replaced by different letters in different locations of the plain text. The same letter in different locations in the password can represent different letters in the plain text, the frequency analysis method is useless here. This encryption method is called "password replacement ".

But we can see that if we type 6 letters (26 letters in the object) in a row, the rotor will turn around and return to the original direction, then the encoding will be repeated. In the encryption process, repetition is very dangerous, which allows people trying to crack the password to see the regularity. So we can add another rotor. When the first rotor rotates in a full circle, it has a tooth on it to move the second rotor so that it can rotate a letter in the direction. Take a look at the following (for the sake of simplicity, we now represent it as a plane form ):

 

 

In the figure (a), we assume that the first rotor (the one on the left) has been fully rotated. Press the B key and the d light is on the display; when the B key is opened, the tooth on the first rotor also drives the second rotor to rotate a grid at the same time. Therefore, when B is typed for the second time, the encrypted letter F is used; when the key B is released again, only the first rotor is rotated. Therefore, when B is typed for the third time in the (c) diagram, B Corresponds to B.

We can see that the original encoding will be repeated only after 6*6 = 36 (26*26 = 676 in physical form) letters are used. In fact, there are three enigma rotor (the German Navy used enigma or even four rotor in the later stage of World War II), and the number of non-repeated directions reaches 26*26*26 = 17576.

In addition, a reflector is cleverly added at the end of the three rotor, and the same letter on the keyboard and the display is connected with a wire. Like a rotor, a reflector connects a letter to another letter, but it does not rotate. At first glance, it seems that such a fixed reflector is useless and does not increase the number of codes that can be used. However, when we associate it with decoding, we can see that this design is ingenious. See:

 

 

We can see that the same letter in the keyboard and display is connected by a wire. In fact, it is a clever switch, but we do not need to know its specific situation. 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 is no encryption), but first through a line connected by three rotor, then return to the three rotor through the reflector, and then reach the display through another line. For example, when the key B is pressed, the light is D. Let's see if we press the d key instead of the B key, then the signal will pass in the opposite direction when the B key is pressed, and finally reach the B light. In other words, in this design, although the reflector does not add possible non-repetitive directions as the rotor does, it can make the decoding process exactly the same as the encoding process.

 

Reflectors

 

Imagine sending a message with Enigma. The sender must first adjust the direction of the three rotor so that they are in one of the 17576 directions (in fact, the initial direction of the rotor is the key, which must be agreed by both parties ), then, enter the plain text in sequence, and write down the shiny letters in sequence. Then, the encrypted messages can be sent by telegraph, for example. After receiving the message, the recipient uses the same Enigma to adjust the rotor direction to the same initial direction as the sender according to the original conventions, and then enters the received ciphertext in sequence, then, you can write down the shiny letters in order to obtain the plaintext. Therefore, the encryption and decryption processes are exactly the same-this is the role of reflectors. For a moment, it is easy to understand that, one side effect of reflectors is that a letter will never be encrypted into itself, because a letter in the reflectors is always connected to another different letter.

 

Reflectors and three rotor mounted 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 because he does not know the initial direction of the three rotor, he has to experiment one by one to find the key. The problem is that the number of 17576 initial directions is not too large. If the attacker attempts to decrypt the ciphertext, adjust the rotor to a certain direction, and then type the starting section of the ciphertext to see if the output is meaningful. If not, try the next initial orientation of the rotor ...... If it takes about one minute to give a try, and it takes him 24 hours to work day and night, he can find all possible initial directions for the rotor in about two weeks. If the opponent uses many machines to decrypt the code at the same time, the time required will be greatly shortened. This degree of confidentiality is insufficient.

Of course, you can add more rotor, but we can see that the possibility of adding an initial rotor is multiplied by 26. In particular, increasing the rotor will increase the size and cost of the Enigma. However, this encryption machine must be easy to carry (in fact, its final size is 34 cm * 28 cm * 15 cm), rather than a giant with more than a dozen rotor. In the enigma design, the three rotor of the machine can be disassembled and exchanged, so that the initial direction of the possibility is changed to six times the original. Assume that the three rotor numbers are 1, 2, and 3, they can be placed in six different positions: 123-132-2017-231-312-321, of course, in addition to pre-specifying the initial direction of the rotor, both parties need to agree on the use of these six arrangements.

Secondly, a connection board is designed between the keyboard and the first rotor. This connection Board allows the user to connect a letter with another letter with one link, so that the signal of this letter will be converted into another letter before entering the rotor. A maximum of six enigma connections can be established (more connections can be established in the later stage). This allows 6 pairs of letters to be exchanged, and other letters without connections remain unchanged. In the physical environment of the above Enigma, we can see that the connection board is under the keyboard. Of course, the connection status on the Connection Board is also required by both parties to send and receive information in advance.

 

In the above, when the B key is pressed, the light C is on.

 

As a result, the initial orientation of the rotor itself, the interaction between the rotor, and the connection of the connecting plate constitute all possible keys. Let's calculate the total number of keys.

The three rotor may have 26*26*26 = 17576 different directions;

There are 6 possibilities for different relative positions between the three rotor;

On the Connection Board, there are a huge number of 6 pairs of letters to be exchanged, with 100391791500 types;

So there is a total of 17576*6*100391791500, about 10000000000000000, that is, 0.1 billion million possibilities.

as long as the key mentioned above is agreed, the sender and receiver can use Enigma to easily encrypt and decrypt the key. However, if you do not know the key, it is completely impossible to try to find it one by one in the face of this huge possibility. We can see that the Connection Board contributes the most to the increase in possibility. Why is it so troublesome to design rotor and other things? The reason is that the Connection Board itself is actually a simple password replacement system, and the connection is fixed throughout the encryption process, so it is very easy to use frequency analysis to decrypt it. Although the rotor system is not likely to provide much, they rotate constantly during the encryption process, making the entire system a duplex replacement system, and the frequency analysis method can no longer do anything about it, at the same time, the Connection Board greatly increases the number of possibilities, making brute force deciphering (that is, trying all possible methods one by one) discouraged.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.