A Journey Through the Flames of War in the Republican Era
Chapter 113 Enigma Cipher Machine (1)
Yu Dawei studied in the United States and Germany in his early years, specializing in mathematics, mathematical logic, ballistics, and military science. During his time in Germany, he served as an advisor to the Ministry of Military Affairs of the Nationalist Government of China, responsible for liaison and cooperation between the two countries' defense industries. Naturally, he had some knowledge of the German Enigma cipher machine, used both commercially and militarily.
Yu Dawei also knows that cryptography and mathematics are closely related and share a common lineage.
He asked in bewilderment, “The Enigma cipher machine has been in use for nearly 20 years, and the military version, which was further improved and developed from the commercial version, has been the standard cipher machine in the German army for ten years.”
"The Germans are very confident that they have mastered the world's most advanced, secure, and unbreakable communication encryption system. According to the information we have, the principle of this cipher machine is mathematically unbreakable."
"The three rotors have a total of 26x26x26 = different cipher tables. These three rotors are designed to be able to swap positions with each other, resulting in 6 different arrangements. The key space increases to x6 = approximately 100,000. The plugboard swaps 6 pairs of letters with wires, which increases the number of ciphers by 100 billion times, bringing the key space to 100 trillion, an astronomical number. Brute-force cracking is considered impossible."
Song Hongfei said, "Mathematically speaking, that is indeed the case. However, deciphering codes is not the same as mathematical calculation. Defects in machine design, as well as some fixed habits and loopholes in usage, can all be used as breakthroughs. There is a lot to be done in this regard."
Yu Dawei, who had little knowledge of cryptography, could hardly contain his shock and almost exclaimed, "You mean there are actually several vulnerabilities? This is truly earth-shattering, unbelievable!"
The Enigma machine is a device that uses a combination of mechanical rotors and circuit systems to achieve complex encryption and decryption. The brilliance of the Enigma machine lies in the fact that while it can perform high-strength double substitution encryption, it also achieves almost the ultimate in portability and ease of operation. It was widely used in German military and diplomatic radio communications.
Historically, the Germans produced as many as 10 Enigma machines of various models, greatly enhancing the strength of the German army, navy, air force, and intelligence agencies.
The Enigma machine's structure mainly consists of a scrambling rotor, a reflector, a connector, a keyboard, and indicator lights. Its security lies in its "double substitution cipher" feature, with its core components being the rotor, connector, and reflector.
Each time the sender presses a button, the rotor continues to rotate, and through different connection lines, the input letter will be randomly replaced with another letter, so that the encrypted letter will be different each time.
If there is only one rotor, then it is a fixed password table, and the encryption method is a simple single-letter substitution encryption, which is easily cracked in cryptography.
However, using multiple rotors simultaneously creates a "double substitution cipher" encryption method that is very difficult to crack. In this way, the same plaintext letter can have different ciphertext letters, and the same ciphertext letter may represent different plaintext letters. This design is ineffective even if an adversary performs word frequency analysis on the intercepted ciphertext.
Operators of the German Enigma machine received a codebook every month, specifying the key to be used each day of the month. This "daily key" was changed every day and contained three parts: the arrangement of the three rotors, the initial position of the rotor letters, and the settings of the plugboard.
Song Hongfei said, "The intelligence agency of a major power can easily obtain these things through espionage: first, the principles and internal structure of the Enigma machine, including the wiring of each rotor; second, the German military's operating procedures for the Enigma machine."
Yu Dawei nodded. He knew that it wasn't impossible for a country's intelligence agency to obtain such things.
Song Hongfei added, "But to decipher the cipher, one must also know the daily initial settings of the cipher machine—that is, the daily key. The Germans wanted to ensure that the other side would still be unable to crack the code even if the cipher machine and codebook were leaked, so they took some precautions."
When sending coded messages using the Enigma machine, the sender would set a "daily key," and then randomly type in three letters. These three letters would become the "message key" for sending the ciphertext. To prevent accidental operation, the German military stipulated that these three letters be typed repeatedly, and they would be converted into six other encrypted letters.
Then, the sender resets the rotor to these 3 letters, and then enters the plaintext in sequence to obtain the ciphertext. That is, each time a message is sent, a message key is first generated using the daily key, then the plaintext is encrypted using this message key, and the 6-letter key is appended to the beginning of the ciphertext and sent to the receiver.
When the recipient decrypts the message, they first set the "daily key" according to the codebook, and then enter the first 6 letters of the ciphertext. Due to the clever function of the reflector, plaintext input yields ciphertext, and ciphertext input yields plaintext, thus obtaining the plaintext of these 6 encrypted letters, which is the sender's 3-letter "message key".
Then, the receiver sets the rotor to this information key, and then inputs the ciphertext into the cipher machine in sequence to obtain the decrypted plaintext.
“This step has two flaws,” Song Hongfei said slowly. “First, the sender needs to attach the information key to the beginning of the ciphertext, which allows a third party to know that these 6 letters are the password—that is, the setting of the 3 rotors. Second, these 6 letters are entered consecutively, which is a serious error in cryptography.”
Song Hongfei knew that it was by exploiting this weakness that the Polish General Staff's Cryptography Bureau had deciphered a large number of German Enigma system codes as early as the early 30s.
Here's something quite interesting: At the time, the victorious powers of World War I, Britain and France, didn't pay enough attention to Germany, which was restricted by the Treaty of Versailles. Faced with Germany's new cipher machine, they only scratched the surface and quickly gave up trying to decipher it. But for Poland, sandwiched between its two powerful neighbors, Germany and the Soviet Union, who were eyeing it with predatory intent, intelligence was a matter of national survival. The immense fear of national subjugation fueled a tremendous drive. While Poland was militarily insignificant, it made considerable achievements in cryptanalysis.
Poland first managed to acquire a commercial ENIGMA cipher machine and figure out its principles. Later, they obtained information from France, leaked by an insider within the German cryptographic communications apparatus, detailing the ENIGMA machine's operating principles, internal circuitry, and operating procedures, thus enabling them to replicate the military-grade cipher machine.
Repetition is the enemy of cryptography. The most obvious repetition in the ENIGMA cipher machine is that the first three letters of the information key are repeated twice to form a six-letter encryption. Polish cryptographers used this as a breakthrough.
宋鸿飞道:“这开头的6个密文字母,第1个和第4个字母都是由同一个明文字母加密而来。同样的,第2个和第5个、第3个和第6个也是如此。这个‘多打一遍’看似要求严谨的操作,却形成了重复的明文和密文对照组合。”
Yu Dawei listened quietly, lost in thought.
Although he had some knowledge of the German Enigma machine and had marveled at its advanced and ingenious design, he had never analyzed it as deeply as Song Hongfei.
“After the sender sets the ‘daily key,’ let’s assume that the ‘message key’ he enters arbitrarily is the three letters XYZ.” Song Hongfei pondered as he wrote and drew on a blackboard in Yu Dawei’s office with chalk. “Entering XYZXYZ twice in a row, let’s assume that we get the six ciphertexts GANDER.”
"The first ciphertext letter G and the fourth letter D are the same plaintext X, which are encrypted differently after the rotor rotates three times. Its essence is letter substitution. This substitution relationship is represented by the function fn. That is, the substitution relationship after one rotation is represented by f1, after two rotations it is f2, and so on."
"XYZ is encrypted twice, which can be written as:
X(f1) = G,
Y(f2) = A,
Z(f3) = N,
X(f4)=D,
Y(f5) = E,
Z(f6) = R,
An Engelma machine has a very important characteristic—it is reflexive. If inputting the plaintext letter X results in the ciphertext letter G, then with the same configuration, inputting the letter G will result in the letter X. This is precisely its decryption principle: X(f1) = G, G(f1) = X.
“Using the first function (f1) from before, that is, X(f1)(f1)=X, which means that a letter being replaced twice by the same function (fn) will result in itself.”
"Substituting the fourth encryption function X(f4)=D, that is, X(f1)(f1)(f4)=D, we get G(f1)(f4)=D, and the key letter X is canceled out! In other words, the connection between the ciphertext G and D is actually unrelated to the information key, but only related to the daily key of the cipher machine on this day."
"The meaning of G(f1)(f4)=D is the correspondence obtained by replacing a letter once through the initial setting of the cipher machine, and then rotating the rotor three times and replacing it again. Its essence is still a kind of substitution. It is denoted as a group GD. Similarly, the other two groups AE and NR can be obtained."
"If the enemy intercepts a large number of German telegrams every day, they can perform similar operations on the first 6 letters of each telegram to obtain more pairwise letter combinations until all 26 letters are matched."
"That's brilliant!" Yu Dawei was utterly stunned. At this moment, his thoughts were racing like wild horses.
Yu Dawei's eyes lit up: "What a brilliant breakthrough! Based on these 26 pairs of letter combinations, for a cipher machine in a certain configuration, we can treat this configuration as a whole and test whether each letter, after the first replacement and rotation of three positions, results in such a pairing combination, thus enabling brute-force cracking! Hmm, there are approximately 100,000 possibilities for the arrangement and initial settings of the three rotors. At the national level, investing a large amount of manpower, material resources, and financial resources to replicate a large number of cipher machines and crack them simultaneously is entirely feasible!"
Song Hongfei couldn't help but admire him. Yu Dawei truly deserved to be called a genius who earned his Harvard PhD just three years after graduating from undergraduate studies. His intelligence was truly remarkable.
Yu Dawei continued to ponder: "But there is still a problem. Both the input and output ends of the rotor scrambler need to go through the connector. Leaving aside the input end for now, the output end directly affects the resulting combination. The connector has 26 letters and 6 pairs of connecting lines, which increases all possible results by 1000 billion times. How can we eliminate the influence of the connector?"
You'll Also Like
-
Stealing the Heavens.
Chapter 216 1 hours ago -
We're practicing all martial arts, so why did you switch to easy mode?
Chapter 477 1 hours ago -
Immortality begins with meditation puppets
Chapter 715 1 hours ago -
Reverse flow of the Yellow Springs
Chapter 622 1 hours ago -
Huayu Entertainment 1995 started with hijacking.
Chapter 391 1 hours ago -
Traveling back to 1977
Chapter 807 1 hours ago -
The memories of all humanity are awakening, except for mine.
Chapter 762 1 hours ago -
World Occult Usage Guide
Chapter 369 1 hours ago -
They all call me an Outer God.
Chapter 625 1 hours ago -
top student at medical school
Chapter 797 1 hours ago