GY_Paper3_Enigma.docx - math.duke.edumath.duke.edu/.../Papers/GY_Paper3_Enigma.docx  · Web viewto...

20
Duke University Enigma Yuanhao Guan Math 89S: Mathematics of the Universe Professor Hubert Bray

Transcript of GY_Paper3_Enigma.docx - math.duke.edumath.duke.edu/.../Papers/GY_Paper3_Enigma.docx  · Web viewto...

Page 1: GY_Paper3_Enigma.docx - math.duke.edumath.duke.edu/.../Papers/GY_Paper3_Enigma.docx  · Web viewto work, the electrical current has to be reciprocal, ... Unlike Enigma, Typex I machines

Duke University

Enigma

Yuanhao Guan

Math 89S: Mathematics of the Universe

Professor Hubert Bray

December 2016

Page 2: GY_Paper3_Enigma.docx - math.duke.edumath.duke.edu/.../Papers/GY_Paper3_Enigma.docx  · Web viewto work, the electrical current has to be reciprocal, ... Unlike Enigma, Typex I machines

1. Brief Introduction and Historical Background

The Enigma machine is one of the most famous cipher machines of all time. It was used

by Nazi Germany in World War II to send secret, coded messages. Enigma was invented by the

German engineer Arthur Scherbius at the end of World War I. Scherbius' Enigma, in a modified

and improved form, was later used widely throughout the German armed forces as the standard

method of encrypting messages prior to radio transmission. In fact, since it has so many possible

combinations of settings and each setting would produce a unique combination of encryption,

one German cryptanalyst stated that the Enigma's messages were unbreakable. Later, At the

Biuro Szyfrow, three brilliant cryptanalysts, Marian Rejewski, Henryk Zygalski and Jerzy

Rozicki, succeeded in breaking the Enigma in 1933. After hearing this groundbreaking news, the

Germans increased the sophistication of Enigma in 1939 which thwarted further Polish attempts

at cryptanalysis at that time. Actually, no one can invent a systematic way of cracking Enigma

messages efficiently which means lots of important Enigma messages remained encrypted until

Bombe was invented by Alan Turing with an important refinement devised in 1940 by Gordon

Welchman which can solve any Enigma message in less than 20 minutes. [1]

Though Enigma had some cryptographic weaknesses, in practice it was German

procedural flaws, operator mistakes, failure to systematically introduce changes in encipherment

procedures, and Allied capture of key tables and hardware that, during the war, enabled Allied

cryptologists to succeed and "turned the tide" in the Allies' favor. Enigma has already proved

itself to be one of the most successful electro-mechanical rotor cipher machines in 20th century.

2. Description of The Enigma Machine

Page 3: GY_Paper3_Enigma.docx - math.duke.edumath.duke.edu/.../Papers/GY_Paper3_Enigma.docx  · Web viewto work, the electrical current has to be reciprocal, ... Unlike Enigma, Typex I machines

(a less common version of military type Enigma Machine which has 4 rotors)

There were many variants of the Enigma, but the most common version, and the version

described here, is the standard Army and Luftwaffe machine. Its main components were: a

keyboard, a lampboard, a stecker or plugboard, a reflector, and a set of five rotors. (As the

picture illustrated below)

Page 4: GY_Paper3_Enigma.docx - math.duke.edumath.duke.edu/.../Papers/GY_Paper3_Enigma.docx  · Web viewto work, the electrical current has to be reciprocal, ... Unlike Enigma, Typex I machines

The keyboard is just a regular keyboard which only has 26 keys, each of which

corresponds to a letter of the alphabet.

The lampboard is consisted of 26 glow lamps, each of which, when illuminated, indicated

a letter.

The plugboard (Steckerbrett in German, or ‘Stecker’) is the unique feature that military

used to increase the sophistication of enigma. If you were a banker or businessman in Germany

at that time, you might buy a commercial enigma but you would not find a plugboard on your

enigma machine. The plugboard has 26 sockets, each has a letter printed next to it. There’s 10

pair of wires that can connect any pair of these sockets. When you use wire to connect two

sockets, the letter that are represented by these two sockets are now swapped. So if you connect

A to B, a letter that was originally encrypted into A would now become B and vice versa. The

Page 5: GY_Paper3_Enigma.docx - math.duke.edumath.duke.edu/.../Papers/GY_Paper3_Enigma.docx  · Web viewto work, the electrical current has to be reciprocal, ... Unlike Enigma, Typex I machines

enigma machine was carefully designed that if there’s no wire connecting the socket, that socket

makes an electrical connection with itself. (So if C socket was unoccupied, C is connected to C

itself.) Although there’s only 10 wires, it might surprise you that the number of permutations

afforded by this arrangement is greater than the number of permutations if all 26 letters are

connected with each other. The greatest number of permutations is attained when there are

eleven wires. It remains unknown why the Germans used only ten.

(a traditional plugboard used by military Enigma)

Each enigma has 5 distinct rotors, although it only requires 3 rotors to function. There’s 3

sockets in enigma that’s designed to contain rotors, and each rotor can be taken out and replaced

with ease. Each rotor had 26 contact pads on the left and 26 pins on the right. The pins and

contact pads are internally wired in an irregular and seemly random way. The pattern of wiring

was different in each of these 5 rotors and each rotor was stamped with a Roman numeral to

Page 6: GY_Paper3_Enigma.docx - math.duke.edumath.duke.edu/.../Papers/GY_Paper3_Enigma.docx  · Web viewto work, the electrical current has to be reciprocal, ... Unlike Enigma, Typex I machines

distinguish which rotor was which. Every time operator pressed a letter, the right motor moved a

bit, and it takes 26 times for the right motor did a full turn. And it would kick the middle rotor

one place after the right rotor rotated a full turn. Imaging these rotors as the hands on a clock and

you would get the idea.

There’s also a rotor on Enigma that can’t be removed or replaced, and it’s called a

‘reflector’. (German: Umkehrwalze, meaning 'reversal rotor') The reflector connected outputs of

the last rotor in pairs, redirecting current back into the rotors. The reflector gave Enigma a

unique and convenient property: self-reciprocal, which means encryption would be same as

decryption. (Actually, putting the reflector onto Enigma was not designer’s idea and it has been

proved that putting this reciprocal operation was a terrible idea since although it did increase the

sophistication for enigma, it also implements a serious flaw, otherwise Turing’s method would

not work, as we will discuss later.)

(rotors and how they are wired internally)

Page 7: GY_Paper3_Enigma.docx - math.duke.edumath.duke.edu/.../Papers/GY_Paper3_Enigma.docx  · Web viewto work, the electrical current has to be reciprocal, ... Unlike Enigma, Typex I machines

Unlike a Caesar cipher, each letter would not be mapped to the same letter since each

time you press the letter the rotor rotates and maps it to a different letter. This makes it nearly

impossible to decipher an encrypted Enigma message by hand. Of course, it is pretty reasonable

to think that even though we can’t solve the encrypted messages, we would solve and decipher

every message Nazi sent if we can capture one functional Enigma machine. Unfortunately, it is

not the case. Even though you have the exact Enigma that Nazi used, you still don’t know how to

set the Enigma in order to decipher the code. So how many settings are there? Every Enigma is

equipped with 5 rotors, and you should pick 3 from 5 in order to get it to work. You have 5

choices for the first slot, 4 choices for the second slot, and 3 choices for the third slot which

gives you 5*4*3=60 ways that you can pick your rotors. You have 26 starting positions for each

rotor, which gives you 263=17576 different starting positions. Now things really get worse when

we move on to the plugboard. There are 26 letters in the alphabet and we want to know how

many ways we can arrange them, which gives us 26!. However, we only want 10 pairs, which

means there are 6 letters we don’t want, and we also don’t need to know the order of these 10

pairs, so we should divide 26! by 6! and 10!. And since AB and BA is the same pair, we divide 2

for each pair, so we divide the product above by 210 and we will have 150,738,274,937,250. If we

multiply all the numbers above together and we will have something around 159 quintillion. [10]

No wonder German cryptanalyst would say it is unbreakable. This number is so big that can

make any mathematician on the world to be desperate. So how did Nazi tell each other their

settings?

Page 8: GY_Paper3_Enigma.docx - math.duke.edumath.duke.edu/.../Papers/GY_Paper3_Enigma.docx  · Web viewto work, the electrical current has to be reciprocal, ... Unlike Enigma, Typex I machines

(an actual monthly sheet used in World War II)

German army and air force would use a monthly sheet which tells them how to set the

machine each day of that month. Since it is a monthly sheet and Nazi would change the settings

if they know it was stolen, it was not that valuable. Also, this was only a sheet of paper plus it

was written using soluble ink, it was really easy to destroy if soldiers get caught, which made it

even harder to obtain such a monthly sheet. No doubt, if you can steal one of these sheets

without Nazi noticing, which they did occasionally, you can use that sheet to decipher the code

until it runs out. However, without such monthly sheets, you would need mathematics to take

advantage of the flaw that Enigma has, otherwise you won’t decipher any Enigma message in

your life time. (As for German naval, they would use a separate part of code using another kind

of encryption just to tell receivers how to set the machine, which made the decryption “harder

than harder”.)

Page 9: GY_Paper3_Enigma.docx - math.duke.edumath.duke.edu/.../Papers/GY_Paper3_Enigma.docx  · Web viewto work, the electrical current has to be reciprocal, ... Unlike Enigma, Typex I machines

3. How to decipher

As we mentioned before, Enigma has a major flaw. In order for the reflector to work, the

electrical current has to be reciprocal, which means there has to be a loop inside the Enigma

machine that can take letter A to letter B and also take letter B to letter A, but here comes the

problem: it is possible A is mapped to any other letter in the alphabet, but it is not possible to

map A to A since it would create a single line connecting two points instead of a loop, which is

not allowed in the design of the Enigma. This flaw inspired Alan Turing to invent the famous

bombe machine (It get its name from the Polish decipher machine ‘bomba’, but they are similar

only in that both are rotary electro-mechanical machines). [5] However, contrary to the machine

described in the movie The Imitation Game, a real Bombe machine usually can’t decipher an

Enigma message. In the word of Gordon Welchman, "... the task of the bombe was simply to

reduce the assumptions of wheel order and scrambler positions that required 'further analysis' to

a manageable number". [6]

In order to decipher the ciphertext, the first step would be obtaining a crib—which is a

section of plaintext that was thought to correspond to the ciphertext. It was not that hard: German

military communications were often expressed in a stereotypical manner so that it was not

necessarily difficult to guess a particular phrase that might appear in the message, like “Weather

Report” or “Heil Hitler” in German. [11] Then, we can pin down the exact position of this crib in

the ciphertext by using Enigma’s property: it never encoded a letter as itself. Suppose we have

the following cirb: [7]

WETTERVORHERSAGEBISKAYA

Page 10: GY_Paper3_Enigma.docx - math.duke.edumath.duke.edu/.../Papers/GY_Paper3_Enigma.docx  · Web viewto work, the electrical current has to be reciprocal, ... Unlike Enigma, Typex I machines

Now suppose we know the following ciphertext includes the sequence:

QFZWRWIVTYRESXBFOGKUHQBAISEZ

To determine the location of crib inside the ciphertext, we slide the crib alongside the

ciphertext until we find a position that same letter doesn’t appear in the same position. [9]

For example, we will find the first S in ciphertext would be in the same position as in the

crib, so we would silde the crib along until we find a position such that there would be no

contradiction: [7]

Page 11: GY_Paper3_Enigma.docx - math.duke.edumath.duke.edu/.../Papers/GY_Paper3_Enigma.docx  · Web viewto work, the electrical current has to be reciprocal, ... Unlike Enigma, Typex I machines

Now we know the crib is correctly matched with the ciphertext. We can number the crib

and ciphertext as follows:

Now we can generate a diagram using the chart above: [8]

Page 12: GY_Paper3_Enigma.docx - math.duke.edumath.duke.edu/.../Papers/GY_Paper3_Enigma.docx  · Web viewto work, the electrical current has to be reciprocal, ... Unlike Enigma, Typex I machines

We proceed by guessing the pairing on the plugboard. Let’s assume A is paired with B

and use the diagram above to see if it has any contradictions. We would do 26 possible pairs for

A (remember A can also be paired with A itself on the plugboard by simply leaving the socket of

A unoccupied.) If none of them is possible, we would move the right rotor by one place until we

figure out all the possible settings of the Enigma. [8] It still sounds unmanageable, so Alan

Turing came with this clever idea: Human needs at least 5 minutes to examine if a combination

of setting is possible or not, but current can run through the circuit and find if the circuit is

opened or closed by less than a second. Why not we build a machine that use current in circuits

to do this work for us? That’s exactly what bombe did. Each drum in the picture below has

identical interconnections to those of the relevant Enigma rotor. Each ‘Bombe’ would contain 36

Enigma equivalents, which means it can eliminate 36 ways of wrong settings in less than a

second. During 1940, 178 messages were broken on ‘bombe’ machines, nearly all successfully.

[2]

Page 13: GY_Paper3_Enigma.docx - math.duke.edumath.duke.edu/.../Papers/GY_Paper3_Enigma.docx  · Web viewto work, the electrical current has to be reciprocal, ... Unlike Enigma, Typex I machines

(Real view of the rebuilt Bombe at Blechley Park)

4. Inspiration of Typex

Since Enigma has so many amazing features and is incredibly hard to solve without

taking advantage of its major flaw, British army wanted an improved version of Enigma, which

can encrypt a letter into itself sometimes. That’s where Typex appeared on the scene. Basically

Typex was built upon the commercial Enigma machine, but it has additional features that can

improve its security drastically. The follow features are also advantages Typex has over Enigma.

Most versions of the Enigma required two operators to operate effectively—one

operator to input text into the Enigma and the other to copy down the enciphered or deciphered

characters—Typex required just one operator.

Page 14: GY_Paper3_Enigma.docx - math.duke.edumath.duke.edu/.../Papers/GY_Paper3_Enigma.docx  · Web viewto work, the electrical current has to be reciprocal, ... Unlike Enigma, Typex I machines

Typex avoided operator copying errors, as the enciphered or deciphered text was

automatically printed on paper tape.

Unlike Enigma, Typex I machines were linked to teleprinters while Typex II

machines could be if required.

Enigma messages had to be written, enciphered, transmitted (by Morse), received,

deciphered, and written again, while Typex messages were typed and automatically enciphered

and transmitted all in one step, with the reverse also true. [3]

A Typex machine was captured later by German forces during the Battle of France and

more than one German cryptanalytic section proposed attempting to crack Typex; however, the

B-Dienst codebreaking organization gave up on it after six weeks, when further time and

personnel for such attempts was refused. One German cryptanalyst stated that the Typex was

more secure than the Enigma since it had seven rotors, therefore no major effort was made to

crack Typex messages as they believed that even the Enigma's messages were unbreakable. [4]

Reference:

1. "The Enigma Machine." Historical Background. N.p., n.d. Web. 03 Dec. 2016.

Page 15: GY_Paper3_Enigma.docx - math.duke.edumath.duke.edu/.../Papers/GY_Paper3_Enigma.docx  · Web viewto work, the electrical current has to be reciprocal, ... Unlike Enigma, Typex I machines

2.  "Outstations from the Park", Bletchley Park Jewels, retrieved 16 April 20103. Ralph Erskine, "The Development of Typex", The Enigma Bulletin 2 (1997): pp. 69–

864. Cipher A. Deavours and Louis Kruh, "Machine Cryptography and Modern

Cryptanalysis", Artech House, 1985, pp. 144–145; 148–150.5.  Rijmenants, Dirk; Enigma message procedures Cipher Machines & Cryptology6.  Miller, A. Ray (2001). "The Cryptographic Mathematics of Enigma" . National

Security Agency.7. "The Enigma Machine." Description of the Enigma. N.p., n.d. Web. 04 Dec. 2016.8. "The Turing Bombe." Description of the Bombe. N.p., n.d. Web. 04 Dec. 2016.9. "The Turing Bombe." The Turing Bombe - Cribs and Menus. N.p., n.d. Web. 04 Dec.

2016.10. Numberphile. "Flaw in the Enigma Code - Numberphile." YouTube. YouTube, 14

Jan. 2013. Web. 04 Dec. 2016.11. Numberphile. "158,962,555,217,826,360,000 (Enigma Machine) " YouTube.

YouTube, 10 Jan. 2013. Web. 04 Dec. 2016.