This page is part of the website

Mathematics Goes to the Movies

by Burkard Polster and Marty Ross


Enigma (2001)

Screenplay by Tom Stoppard.
Bletchley Park in the U.K. was where many mathematicians worked as code breakers during WWII. In Enigma, Cambridge mathematician Tom Jericho (Dougray Scott) is a top cryptoanalyst at Bletchley working on breaking the German Enigma code. Of course, most of the story is not about mathematics and code breaking, but about Tom falling in love, first with Claire (Saffron Burrows) and, after Claire disappears, with Hester (Kate Winslet). It is also about Tom and Hester’s efforts to find out what happened to Claire and, in connection with this, treason at Bletchley Part. At the beginning of the movie a party of military men visits Bletchley Park. Tom describes the Enigma machine to them.

TOM: Enigma is a very sophisticated enciphering machine and Shark is its ultimate refinement, so- We're not talking about the Times crossword.
Enigma machine museum
TOM: It weighs 26 pounds, battery included and goes anywhere. The Enigma machine. The Germans have thousands of them.

HAMMERBECK (one of the visitors): What's it do?
TOM: It turns plain-text messages into gobbledygook. Then the gobbledygook gets transmitted in Morse. At the receiving end, there's another Enigma machine to turn it back into the original message. Press the same key any number of times, it will always come out different.
VISITOR: And you have one of your own.
LOGIE (Tom’s supervisor): Courtesy of the Polish Cipher Bureau.
HAMMERBECK: So what's the problem?
TOM: Problem? The Problem is the machine has 115 million million million ways of doing it, according to how you set these three rotors and how you connect these plugs.
VISITOR: And that's Shark.
TOM: No. This is one we can break. Shark is enciphered on a machine with a fourth rotor specially developed for U-boats which gives it about 4,000 million billion different starting positions. And, uh, we've never seen one.
Later on Tom explains more to Hester.

Tom and Hester decrypting a message
TOM: Right. April 17. Rotor order?
Three rotors are chosen from a set of rotors and arranged in a certain order before they are put into the machine.
HESTER: 3-5-4.
TOM: 3-5-4.
Apart from making this choice the rotors can also be set individually at this stage.
TOM: Plug board settings?
TOM: The current passes from the keyboard to lamps by way of the rotors and plugs. Every time you press a key, it changes the path of the current. Press the same key ten times, it comes out ten different ways on the lamp board. You never know which letters will light up. Simply brilliant.
Message key X-A-T.
Starting with a fixed starting position of rotors and plugs, pressing different letters will in turn light up different letters. In other words, the circuitry inside the machine sets up a one-to-one correspondence (a “crib”) of the alphabet to itself, e.g.,
Different starting positions will correspond to different cribs and since the rotors turn every time you push a button, this crib will also change. Consequently, pressing the same letter repeatedly will, in general, result in different letters lighting up. Every day the Germans would use a different starting position for all their messages. These starting positions were sent to their different military units on printed sheets by courier. This meant that if you had an Enigma machine, to be able to read the messages of the Germans on a certain day, you had to find out the starting position for that day. To do this, the British exploited a number of particularities of the Enigma machine and some negligence on the part of the Germans. The British found out that certain encoded messages started with the weather data at a given location and since this data was also known to them they could infer part of the crib corresponding to the starting position of that day. They would then use some of the earliest computers to reconstruct the starting position(s) that give rise to this particular part of the crib. One of these starting positions would be the one they were looking for. Here are the parts of the dialogue that fit in with this explanation.

WIGRAM (secret service man investigating Claire’s disappearance and possible treason within Bletchley Park):Not right, Mr. Jericho. Can't quite put my finger on it, but definitely not right. Were you surprised when they told you that Admiral Doenitz had changed the German Navy weather code? Any bells go off?
TOM: Germans were always nervous about Enigma.
WIGRAM: Germans are supposed to think that Enigma's an unbreakable system, because it would take thousand of years to go through every setting to find the one that turns the code back into the plain text. Next day it's different again. Using human beings, Enigma is safe forever; but we don't use human beings for that, do we, Mr. Jericho?
TOM: No.
WIGRAM: No. And that is the secret inside the secret. All they know is that the weather code opened a crack in the system because somebody told them. But what if somebody tells them just how we do it? Your thinking machine, clackety-clack, day and night, programmed with a menu, thanks to your big brain, that reduces the odds to just a few million to one till it locks on to the winning combination. There goes the war. Oh, I've got a little list. You're on it. Communists, foreign nationals, geniuses just this side of barking mad; altogether a security nightmare. But of all these names, Mr. Jericho, you are the only one who got himself fucked into a nervous breakdown by a missing blonde. You live quietly from now on.

TOM: Oh, Chr- Miss Wallace. Miss Wallace! She'd need- She'd need a Typex machine (variation of an Enigma machine used for decoding messages?). Every day, all the Typex machines have to be set the same way the Germans set their Enigmas. Otherwise, you just get nonsense from nonsense. Working out each day's settings is the hard part. That's where the code breakers come in.
TOM: Well, you- You need a crib. Suppose that grave-stone was in code. If I knew who was buried here, I'd know what the code meant. That's a crib. And when you've set the machine, you type in the coded message, if it comes out nonsense, the setting are wrong; if it comes out 'Mary Jane Hawkins', you've broken Enigma for that day.

mathematicians/code breakers at work
An Enigma machine could be used both for encrypting and decrypting messages: Set one Enigma machine to a certain starting position and encode some plain text, set a second Enigma machine to the same starting position and type in the output of the first machine and out comes the plain text you started with! This little miracle is accomplished by only having cribs that have the following special property: If pressing letter X lights up letter Y, then pressing letter Y in turn lights up letter X. Our crib above has this property.
For example, if your plain text only corresponds to the letter A, then the encoded message is M, and typing M on the second machine will yield A again. Of course, when trying to guess a crib, it is very useful to know this property. The problem that the code crackers are facing in the movie is that the Germans have just changed the way in which they transmit weather information, and that therefore they need to find something else that the Germans are not careful about and that contains enough information for them to reconstruct cribs. Tom has the decisive insight that U-boats will keep broadcasting their position when they have spotted a convoy of cargo ships to enable other U-boats to participate in the chase. By triangulating the positions of these U-Boats the British know what these positions are and can use this plain text information together with the encrypted information to reconstruct the cribs and starting positions.

Two mathematicians/code breakers at workIn the following screen shot, the circled pairs are probably supposed to correspond to be part of the crib that the code breakers are chasing. From what we said before this does not make any sense: that M corresponds to S and S to M is just as it should be, but since V corresponds to K, K should correspond to V and not to A.

Two snippets from quite early on in the movie telling us something about Tom as a mathematician.

Claire's Cottage (flashback, Claire is Tom’s former girlfriend)
CLAIRE: Why are you a mathematician? Do you like sums?
TOM: I like numbers. Because with numbers, truth and beauty are the same thing. You know you're getting somewhere when the equations start looking beautiful and you know the numbers are taking you closer to the secret of how things are. A rose is just plain text.

Tom’s bedroom (flashback)
CLAIRE: What's this? What's the Entscheidungsproblem when it's at home?
TOM: That's just something I was working on at Cambridge. It's a theoretical machine that-
CLAIRE: Theoretical. So it doesn't exist?