The Thinking Machine Chronicles #0004: The Machine That Won a War: Turing's Bombe and the Breaking of Enigma

A rebuilt Turing Bombe at Bletchley Park museum, the electromechanical machine that cracked Enigma-encrypted messages and helped turn the tide of World War II. Tom Yates, CC BY-SA 3.0, via Wikimedia Commons.
The Thinking Machine Chronicles · Era I: Foundations (1936–1949)
The World in 1940
The year 1940 was, by most measures, the low point of the twentieth century's darkest decade. Germany overran Denmark and Norway in April, then swept through Belgium, the Netherlands, and France in forty-six catastrophic days, a military collapse for which Allied planning had no answer. The evacuation at Dunkirk in late May saved 338,000 men but left Britain's heavy armour and artillery on French beaches. France signed an armistice in June; Britain stood alone. From August through September, the Luftwaffe contested control of British skies in what Churchill named the Battle of Britain,the first major campaign fought entirely in the air. Across the Atlantic, Roosevelt won an unprecedented third presidential term promising to keep America out of the war, while quietly preparing Lend-Lease. Meanwhile, German U-boats in the Atlantic had already sunk more than 1,000 Allied ships since September 1939, strangling the supply lines without which Britain could not survive. Howard Florey and Ernst Chain at Oxford had just produced enough purified penicillin to cure a dying policeman, but the process required the entire output of their laboratory and could not be scaled.
The British intelligence establishment was fighting its own silent parallel war. At Bletchley Park, a Victorian estate in Buckinghamshire requisitioned in 1939,a growing staff of mathematicians, linguists, crossword champions, and chess grandmasters were attempting what German cryptographers were certain was impossible: breaking the Enigma cipher used for virtually every Wehrmacht military communication. Polish cryptanalysts had cracked an earlier version before the war; the naval Enigma used by U-boats, with a more complex key schedule and more disciplined operators, had never been read. The keys changed every night at midnight. The search space exceeded configurations. What was needed was not merely mathematical cleverness but mechanical speed, a device that could test thousands of configurations automatically, in hours, before the keys rotated again. Alan Turing, who had arrived at Bletchley on the day Britain declared war, had a mathematical idea for exactly how to build it.
The Machine That Won a War: Turing's Bombe and the Breaking of Enigma
His name was Alan Turing. The machine was the Bombe.
The Enigma Problem
The Germans encrypted virtually all their military communications with the Enigma machine, a portable electro-mechanical cipher device that looked like an elaborate typewriter. The operator would type a plaintext letter; the machine would light up a different letter on a display board; the operator would write it down and radio it. The recipient, with an identical Enigma set to the same starting configuration, would type in the ciphertext and the original letter would light up.
The genius, and the eventual undoing,of Enigma was its use of substitution that changed with every keypress. The heart of the machine was three (or four, for naval variants) rotors: metal discs each wired to perform a fixed letter substitution, but mounted on a spindle so that after each keypress the rightmost rotor stepped one position, and periodically (at notch positions) it caused the middle rotor to step, and so on, like an odometer. The rightmost rotor stepped with every character; the middle rotor stepped roughly once per 26 characters; the left rotor once per 676.
Before and after the rotor chain, the signal passed through the plugboard (Steckerbrett), a patch panel of cables that physically swapped pairs of letters, adding further scrambling. A typical wartime Enigma would use 10 plugboard pairs, swapping 20 of the 26 letters.
After passing through the three rotors in sequence, the signal hit a reflector, a fixed wiring that sent the signal back through the rotors in reverse. This made Enigma self-inverse: encrypting a ciphertext with the same settings recovered the plaintext. It also introduced the flaw that would break it.
The Keyspace
The number of possible Enigma configurations was astronomical. For three rotors chosen from five, with 26 possible start positions each, and 10 plugboard pairs:
Over configurations. Trying each one by hand was obviously impossible. The Germans were confident Enigma was unbreakable. They were almost right.
The Fatal Flaw
Turing did not try to brute-force Enigma. He looked for structure.
The reflector, the same wiring that made Enigma symmetric,had a devastating consequence: a letter can never encrypt to itself. The signal travelled forward through the rotors, bounced off the reflector, and came back; since the reflector permutation was a fixed involution with no fixed points, the path from any letter to the reflector and back could never return to the same starting point. This meant that for any given Enigma configuration and any position in the message:
This is not a minor statistical weakness. It is a hard, binary constraint, a mathematical guarantee that eliminates any candidate rotor position where a known plaintext letter maps to itself. Turing formalised this into an attack.
Crib Dragging
The attack required cribs, fragments of known or guessed plaintext. Bletchley Park obtained cribs from multiple sources:
- German operators who began every message with a standardised weather report (WETTER: weather)
- Messages that contained KEINE BESONDEREN EREIGNISSE (nothing to report)
- Re-encrypted messages that Allied forces had intercepted in other forms
- Messages from operators who used predictable indicator groups
The technique was called crib dragging: slide the candidate plaintext along the ciphertext and at each position check whether any letter in the crib matches the corresponding ciphertext letter. If it does, that position is impossible, Enigma cannot produce that,and is discarded.
For a crib of length slid to offset :
In practice, a crib of 10–15 characters would eliminate all but a handful of starting positions from a 150-character message. The Bombe then had to test only those positions.
The Bombe
Turing's Bombe (developed with Gordon Welchman's crucial addition, the diagonal board) was an electro-mechanical device that tested rotor configurations at speed.
The core operation: given a crib and its position in the ciphertext, the crib imposes a set of logical constraints between letters. If we know that position of the plaintext is A and the ciphertext there is X, then at the candidate rotor setting the Enigma must map A → X (or X → A, by symmetry). This creates a menu, a graph where nodes are letters and edges are encrypt-at-position constraints.
The Bombe exploited chains of such constraints. If the menu contained a loop, a sequence of positions where following the implied substitutions leads back to the starting letter,then any incorrect rotor position would eventually produce a contradiction. The Bombe tested all 26 start positions of the fast rotor electrically, in parallel, and stopped when no contradiction arose (a "stop"). Human analysts at Bletchley then tested the plugboard separately to confirm the stop.
The key speed: the Bombe stepped through rotor positions for each rotor order (and there were 60 possible orderings of 3 rotors from 5). A single Bombe ran at approximately 120 RPM and could exhaust a full menu in roughly 20 minutes. By 1945, 211 Bombes were running at Bletchley Park and satellite stations.
The Rotor Permutation Model
Each rotor is a fixed permutation of , but the effective permutation shifts with the rotor's position :
The full Enigma encryption of character at rotor positions is:
where is the plugboard permutation and Ref is the reflector. Note the symmetry: , which is the self-inverse property enabling both encryption and decryption with the same settings. This is also why a letter can never map to itself, the reflector ensures for all .
A Python Model of the Bombe Attack
The code project implements a complete Enigma machine and simplified Bombe:
# Enigma's fatal flaw — provably no self-maps
machine = make_enigma()
for _ in range(100):
for i in range(26):
enc = machine.encrypt_char(i)
assert enc != i, "Enigma self-encrypted — impossible!"
Crib dragging identifies impossible offsets:
def crib_drag(ciphertext, crib):
# Position k is POSSIBLE only if no letter self-maps
return [k for k in range(len(ct) - len(cb) + 1)
if all(ct[k+i] != cb[i] for i in range(len(cb)))]
The Bombe attack searches positions for the first position where decryption matches the crib:
for l, m, r in itertools.product(range(26), repeat=3):
machine = make_enigma(config, (l, m, r))
decrypted = machine.encrypt(ciphertext)
if decrypted[offset:offset+len(crib)] == crib:
return (l, m, r) # found in 3,696 attempts in the demo
Running the demo, the Bombe correctly recovers start position FMD from a known-plaintext attack on ANGRIFFMORGENFRUH (attack tomorrow morning), in 3,696 attempts out of 17,576 possible.
Turing's report: Turing wrote up his cryptanalytic methods in two classified papers known as Turing's Treatise on the Enigma (1940) and Prof's Book (1941). These were declassified by GCHQ in 2012 and are now available at the National Archives. They are models of mathematical clarity under wartime pressure.
Why It Mattered
The intelligence derived from breaking Enigma, codenamed ULTRA,was arguably the most valuable single source of intelligence in the war. Estimates suggest it contributed to:
- Defeating the U-boat threat in the Atlantic, saving Allied supply lines
- Montgomery's victory at El Alamein (Rommel's supply plans were known in advance)
- The success of the D-Day deception operation (the Germans believed false intelligence partly because their Enigma communications confirmed it)
Churchill reportedly told King George VI that ULTRA was "my most secret source" and "golden eggs" from a goose that must never cackle.
The existence of Bletchley Park and the Bombe remained classified until 1974. Turing, who was prosecuted for his homosexuality in 1952, forced to undergo chemical castration, and died in 1954, two years before the 1956 publication that would have made him famous,never received public recognition in his lifetime. He received a royal pardon in 2013, 59 years after his death.
The machine that helped win the war could not save the man who built it.
What Came Next
While Turing's Bombe was turning the tide in the Atlantic, a neurophysiologist and a teenage logician in Chicago were asking a stranger question: not how to break a cipher, but whether a brain and a computing machine were doing the same fundamental thing. In December 1943, the same year the Bombe reached full operational scale,Warren McCulloch and Walter Pitts published four pages arguing that a neuron is a threshold gate, and that networks of such gates could compute any logical function a mind could conceive. That story is next: The Thinking Machine Chronicles #0005: The First Artificial Neuron.
References
- Turing, A.M. (1940). Treatise on the Enigma (declassified 2012). National Archives, HW 25/3.
- Welchman, G. (1982). The Hut Six Story: Breaking the Enigma Codes. McGraw-Hill.
- Hinsley, F.H. et al. (1979–1990). British Intelligence in the Second World War (5 vols). HMSO.
- Copeland, B.J. (2004). The Essential Turing. Oxford University Press.
- Hodges, A. (1983). Alan Turing: The Enigma. Burnett Books. (The definitive biography.)
- Batey, M. (2010). Dilly: The Man Who Broke Enigmas. Dialogue Estate.