Principle of Enigma machine

Source: Internet
Author: User
Tags reflector repetition

ENIGMA

Enigma appears to be a box filled with intricate and sophisticated components. But if we open it, we can see that it can be broken down into fairly simple parts. The following figure is the most basic part of it, and we can see its three parts: keyboard, rotor and monitor.

In the photo above Enigma, we see the bottom part of the horizontal panel is the keyboard, a total of 26 keys, the keyboard arrangement is close to the computer keyboard we use now. To make the message as short and more difficult to decipher, spaces and punctuation are omitted. We only drew six keys in the. Physical photos, the keyboard is the display, it is marked by the same letter of the 26 small lights, when a key on the keyboard is pressed, and the letter is encrypted after the ciphertext corresponding to the small lights on the display light up. In the same way, we only drew six small lights. At the top of the display are three rotors, their main part hidden under the panel, in which we only draw a rotor temporarily.

The keyboard, the rotor and the monitor are connected by wires, and the rotor itself is integrated with 6 lines (26 in the real thing), and the keyboard signals correspond to the different lights on the monitor. As we can see, if the a key is pressed, then light B will light up, which means that a is encrypted as B. Similarly, we see that B is encrypted into a a,c encrypted into a d,d encrypted into a f,e encrypted into a e,f encrypted into C. So if we type Cafe (coffee) on the keyboard, DBCE will be displayed on the monitor in turn. This is one of the simplest encryption methods, each letter is replaced by one by one corresponding to another letter, such encryption is called "Simple replacement password."

The simple replacement password appeared early in history. The famous "Caesar Act" is a simple substitution method that corresponds to each letter and the letter it has in a number of places in the alphabet. For example, if we take the three positions, then the one by one correspondence of the letters is shown in the following table:

Letter-List: ABCDEFGHIJKLMNOPQRSTUVWXYZ

Password alphabet: defghijklmnopqrstuvwxyzabc

So we can get the ciphertext from the clear text: (Veni, Vidi, Vici, "I come, I see, I conquer" is the Jules Kei of the conquest of the Wang Fanasis to the old house proclaimed the famous)

PlainText: Veni, Vidi, Vici

Ciphertext: Yhal, YLGL, YLFL

Obviously, there are only 26 possibilities for this simple method, which is not enough for practical application. The general rule is a relatively random one by one correspondence, such as

Letter-List: ABCDEFGHIJKLMNOPQRSTUVWXYZ

Password alphabet: jqklzndowecpahrbsmyitugvxf

You can even define a password letter graphic yourself without using the Latin alphabet. However, the ciphertext obtained by this method is quite easy to be cracked. By the year Nineth century, the Arab code deciphering experts have mastered the use of statistical alphabet frequency method to crack the simple replacement password. The principle of cracking is simple: in each phonetic language, each letter appears in a different frequency, for example, in English, E appears much higher than the other letters. So if we get enough ciphertext, by counting the frequency of each letter, we can guess one of the letters in the cipher corresponds to which letter in the code (and, of course, by deciphering the basic password of the context). Conan Doyle in his famous Sherlock Holmes "Dancing Man" in detail the use of frequency statistics Sherlock Holmes deciphering the Dance of the human code of the process.

So if the role of the rotor is simply to change one letter to another, it doesn't mean much. But everyone may have guessed that the so-called "rotor", it will turn! This is the most important design of Enigma-when a key is pressed on the keyboard, the corresponding ciphertext is displayed on the display, then the direction of the rotor automatically rotates the position of a letter (in the middle is the rotation of 1/6 laps, and in the actual rotation of 1/26 turns). The following indicates a continuous type of 3 B cases:

When the first type of B, the signal through the rotor line, light a light up, release the key, the rotor rotates a box, the corresponding password of the letters changed; the second time you type B, the letter it corresponds to is 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 decomposition of the rotor, and we can see the wires installed in the rotor.

Here we see the key to Enigma encryption: This is not a simple replacement password. The same letter B can be replaced by different letters at different positions in the clear text, while the same letter of different positions in the ciphertext can represent different letters in the plaintext, and the frequency analysis method is useless here. This type of encryption is known as a "duplex replacement password."

But we see that if you type 6 letters in a row (26 letters in the object), the rotor will go all the way back to the original direction, and the code will be repeated at first. In the process of encryption, repetition is dangerous, which allows the person trying to decipher the password to see something regular. So we can add another rotor. When the first rotor rotates a full circle, it has a tooth on it to toggle the second rotor, making it move in the direction of a letter position. Look at the following (for the sake of simplicity, now we represent it as a flat form):

Here (a) we assume that the first rotor (the one on the left) has turned a full circle, the D light on the monitor is on when the B key is pressed, and when the B key is released, the tooth on the first rotor rotates the second rotor at the same time, so (b) The second time you type B, the encrypted letter is F, and when you release the key B again, Only the first rotor rotates, so (c) The third time you type B, the letter B corresponds to B.

We see that in such a way, the original encoding will be repeated after 6*6=36 (26*26=676 in kind). In fact, there are three rotors in the Enigma (the German Navy used Enigma and even four rotors in the latter part of the Second World War), and the number of non-repetitive directions reached 26*26*26 = 17,576.

Not only that, but also a reflector was cleverly added at one end of the three rotors, and the same letters in the keyboard and the display were wired together. The reflector, like the rotor, connects one letter to another, but it does not turn. At first glance, such a fixed reflector does not seem to be useful, it does not increase the number of encodings that can be used, but linking it to decoding will reveal the ingenuity of the design. See:

We saw 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 what it is. We just need to know that when a key is pressed, the signal is not directly from the keyboard to the display (if this is not encrypted), but first through the three rotors connected to a line, and then go through the reflector back to three rotors, through another line to reach the monitor, for example, when the B key is pressed, the light is the D lamp. Let's see if we press the B key instead of the D key, then the signal just follows the B key in the opposite direction when it is pressed, and finally arrives at the B light. In other words, in this design, the reflector does not increase the possible non-repetition direction as the rotor does, but it can make the decoding process and the coding process exactly the same.

Reflective Device

Imagine sending a message with enigma. The sender first adjusts the direction of the three rotors so that they are in one of the 17,576 directions (in fact the initial direction of the rotor is the key, which must be pre-agreed between the transceiver), then type the clear text in turn, and write down the shiny letters, The encrypted message can then be sent out in the form of a telegram, for example. When the receiving party receives the message, using an identical enigma, according to the original agreement, the direction of the rotor is adjusted to the same initial direction as the originator, and then type the ciphertext received in turn, and then write down the shiny letters in order to get the plaintext. So the process of encrypting and decrypting is exactly the same-it's all part of the reflector. To think about it, it's easy to see that one of the side effects of a reflector is that a letter will never be encrypted to itself, because one of the letters in the reflector is always connected to another different letter.

Reflector and three rotors mounted in the Enigma

So the initial direction of the rotor determines the encryption method of the whole cipher. If there is an enemy listener in the communication, he will receive the complete ciphertext, but because he does not know the initial direction of the three rotors, he will have to experiment in one direction to find the key. The problem is that the number of 17,576 initial directions is not too large. If the person trying to decipher the cipher adjusts the rotor to a certain direction, then type in the beginning of the cipher to see if the output is like a meaningful message. If not, 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, you can find all the possible initial directions of the rotor in about two weeks. If the opponent uses many machines to decipher at the same time, then the required times will be greatly shortened. This level of secrecy is not enough.

Of course we can add more rotors, but we see that the probability of starting each additional rotor is multiplied by 26. In particular, increasing the rotor will increase the volume and cost of enigma. However, the encryption machine must be portable (in fact its final size is 34cm*28cm*15cm) rather than a giant with more than 10 rotors. In the design of the Enigma, the three rotors of the machine can be disassembled and exchanged, so that the likelihood of the initial direction becomes six times times the original one. Assuming that the number of three rotors is 1, 2, 3, then they can be put into 123-132-213-231-312-321 six different positions, of course, now send and receive messages in addition to pre-agreed to the initial direction of the rotor itself, but also agreed to the use of these six permutations.

Secondly, a connecting plate is also designed between the keyboard and the first rotor. The plate allows the user to connect a letter to another letter with one line, so that the letter's signal is converted to another letter before it enters the rotor. This connection can have up to six (later Enigma has more connections), so that the 6 pairs of letters can be exchanged, and the other letters that are not plugged in will remain unchanged. In the enigma of the above, we see that the connection plate is below the keyboard. Of course, the connection on the Board is also to send and receive information on both sides need to pre-agreed.

In the above, when the B key is pressed, the light c is lit.

So the initial direction of the rotor itself, the mutual position between the rotors, and the condition of the connecting plate connection make up all the possible keys, let's calculate how many of them altogether.

The different orientations of the three rotors make up the different possibility of 26*26*26=17576;

The different relative positions of three rotors are 6 possibilities;

The number of 22 exchange 6 pairs of letters on the connection plate is very large, there are 100391791500 kinds;

So a total of 17576*6*100391791500, about 10000000000000000, that is, 100 million kinds of possibilities.

As long as the agreement on the above-mentioned key, the two sides using Enigma can be very easy to encrypt and decrypt. But if you don't know the key, it's completely impossible to try to find the key in front of this huge possibility. We see that the connection plate contributes the most to the increase in probability, so why bother to design the rotor or something like that? The reason is that the connection plate itself is a simple replacement password system, the entire encryption process, the connection is fixed, so it is very easy to use the frequency analysis method to decipher. Although the rotor system is not very likely to provide, but in the process of encryption they keep rotating, so that the entire system into a duplex replacement system, frequency analysis of it can no longer be powerless, at the same time, the connection plate makes the number of possibilities greatly increased, so that the violent deciphering method (that is, a method to try all possibilities) deterred.

PS: Transferred from Sina Weibo.

Interested in manual programming to realize the deciphering of the students please see zoj1009

Principle of Enigma machine

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.