• • •

  Alan Turing quickly realized that his concept of this machine would allow him to prove he was correct about the “decision problem,” because he could use it to illustrate that, in mathematics, there is always room for more intuition and innovation than any one single mechanical method, or machine, can provide. But there was much that he did not yet realize. He didn’t yet know, for example, that he’d just given birth to the concept for history’s most powerful and transformative machine. He didn’t yet know that the codes he imagined would be the backbone of what we now call software. Nor did he know that the machine he imagined would one day be called a computer. Instead, alone in an English meadow, Alan Turing became the first person to not just dream of a machine with the capabilities of the computers we now know, but to actually put together in his mind the technical elements of how that machine could be built.

  Cambridge, England

  October 28, 1938

  Alan had seen countless comedies, mysteries, westerns, and dramas at Cambridge’s Regent Street Picture House, but he had never seen anything quite like this: a full-length animated feature film called Snow White and the Seven Dwarfs.

  Alan’s head bobbed along to the song “Whistle While You Work,” and he laughed at Snow White’s little friends, who were almost as eccentric as he was. But his favorite scene by far was one of the creepy moments of the film that juxtaposed cruelty with kindness, monstrous ugliness with angelic beauty, and death with life.

  Alan sat with rapt attention as the cackling queen on the big screen dipped an apple in poison. As the chemicals covered the skin of the fruit with a skull and crossbones, the evil queen—disguised as an elderly hag—commanded her pet raven: “Look at the skin: a symbol of what lies within.” Then she ordered the apple to “turn red to tempt Snow White, to make her hunger for a bite.”

  In between bouts of maniacal laughter, the queen explained to the raven, “When she breaks the tender peel, to taste the apple from my hand, her breath will still, her blood congeal. And then I’ll be the fairest in the land!”

  For whatever reason, Alan loved Walt Disney’s Snow White and the Seven Dwarfs. Perhaps it was his lifelong interest in poisons. Maybe it was simply the eccentric, Peter Pan element of his personality, which had never warmed to the protocols and rigid expectations of English adults. Or, perhaps, it was a soft spot for the poison’s romantic antidote: “The victim of the sleeping death,” chanted the wicked queen, “can be revived only by Love’s First Kiss.” In the case of Snow White, that meant Prince Charming.

  After seeing the movie, Alan made a habit of eating an apple every night before bed. Throughout the fall of 1938, while Britain’s prime minister Neville Chamberlain appeased Hitler, and Molotov began the Soviet Union’s negotiations with the German Reich’s von Ribbentrop that would eventually culminate in the Nazi-Soviet Non-Aggression Pact, the young Cambridge don who had solved the decision problem and invented the idea of the computer could often be heard quietly singing to himself his favorite couplet from the evil queen’s incantation: “Dip the apple in the brew. Let the sleeping death seep through.”

  Cambridge, England

  September 3, 1939

  The prime minister’s voice came crackling over the radio at 11:15 that morning. Alan listened alone from his untidy Cambridge apartment.

  “This morning,” Neville Chamberlain declared, “the British ambassador in Berlin handed the German government a final note stating that, unless we heard from them by eleven o’clock, that they were prepared at once to withdraw their troops from Poland, a state of war would exist between us.”

  And then came the announcement Chamberlain had worked so hard at Munich to avoid making: “I have to tell you now that no such undertaking has been received, and that consequently this country is at war with Germany.”

  It would mean a blockade of their island. It could mean an aerial bombardment of London. It might even mean the first successful invasion of Great Britain since William the Conqueror had landed in 1066, not far from the seaside town where Alan Turing grew up.

  “You can imagine what a bitter blow it is to me,” said Chamberlain, “that all my long struggle to win peace has failed.” But Hitler’s invasion of Poland—unlike, by Chamberlain’s shortsighted reckoning, Hitler’s remilitarization of the Rhineland, annexation of Austria, and conquest of Czechoslovakia—“shows convincingly that there is no chance of expecting that this man will ever give up his practice of using force to gain his will. He can only be stopped by force. . . . I know that you will all play your part with calmness and courage.”

  Calmness and courage had never been in short supply among Englishmen—or in Alan Turing. He had complete confidence in himself and his country, along with complete contempt for the German Führer, whose capacity for evil he had clearly underestimated. Even before Chamberlain’s three-minute speech was over, Alan knew exactly how he could best play his part to help save England and defeat Hitler.

  “You may be taking your part in the fighting services or as a volunteer in one of the branches of civil defense,” said Chamberlain. “If so you will report for duty in accordance with the instructions you have received.”

  Alan didn’t expect his service to include an assignment to a branch of the armed forces or the civil defense, but he knew he would serve His Majesty’s Government somehow.

  “Now may God bless you all,” concluded Chamberlain. “May He defend the right. It is the evil things that we shall be fighting against—brute force, bad faith, injustice, oppression, and persecution—and against them I am certain that the right will prevail.”

  The next day, Alan Turing reported for duty, which, like so much in his life, would not be conventional at all.

  Bletchley Park

  September 4, 1939

  Alan left the living quarters he was assigned at the Crown Inn at Shenley Brook End and rode his bike to his new place of business: a large, garish manor house that had been redecorated too often by too many owners with more money than taste. Both the exterior and interior of the house incorporated design elements from five different periods: Romanesque, Gothic, Tudor, Neo-Norman, and Victorian. The result was an expensively redesigned eyesore. Alan’s first impression of the house was that it was proof of Leonardo da Vinci’s axiom: “Simplicity is the ultimate sophistication.”

  The manor house stood on a hill overlooking the grounds of Bletchley Park, the new home of the Government Code and Cipher School. The school—which would never have any real students and which was less a “school” than a laboratory for code-breaking—had recently been moved out of London in order to protect its secrecy, and because its most important staff would be drawn from the faculties of Oxford and Cambridge.

  Bletchley Park was a natural choice for a location because it sat on a rail line halfway between the two universities. Its isolation in the English countryside would minimize the number of nosy neighbors, and its sprawling grounds and somewhat elegant ambiance might reduce the natural stress of those who chose to accept its mission: breaking the secret code used by every Nazi field commander, air traffic controller, and U-boat captain trying to blockade Britain and starve its citizens into submission.

  Alan arrived at the manor house, parked his bicycle, and proceeded to an elegant meeting room. He took his seat at a small antique table surrounded by seven men with a professorial air about them. Standing at the head of the table with a slide projector screen behind him was Bletchley Park’s director, Commander Alastair Denniston.

  “The Nazi code-making machine is called the Enigma,” Denniston began. “The purpose of this orientation session is to tell you how the Enigma works.

  “Secret codes have been used by militaries for millennia. Julius Caesar used to write orders in which each written letter would represent the letter that was three letters before it. So, if he wrote ‘Jdxo,’ it meant ‘Gaul.’ Pretty simple, right?”

  Alan had been fiddling with codes more complicated than that since he was a
boy in St. Leonards-by-Sea. He knew that code-writing had come a long way since Caesar’s campaigns.

  “Well,” continued Denniston, “the German code is trillions of times more complicated than Caesar’s. Imagine that someone in Berlin wants to send a message to a U-boat in the North Atlantic. The person in Berlin writes a message by hand in plain German. It might say, ‘das wetter ist trübe,’ which means, ‘the weather is cloudy.’ He then types the message on an Enigma machine, which looks a little like a typewriter. Take a look.”

  A picture of an Enigma machine flashed on the projection screen.

  “And here’s where the magic begins,” continued Denniston. “The Enigma machine changes each letter in the message. It might change ‘das wetter ist trube’ into ‘b-t-t o-o-f-d-s-e e-i-c g-t-t-a-i.’ The message is now encoded, and that’s what is sent to the U-boat via the wireless telegraph. Is everyone following me so far?”

  Alan already had about a thousand questions, but he chose not to interrupt.

  “Now,” said Denniston, “the person in the U-boat receives the encoded message, and he types it into his own Enigma machine, which changes every encoded letter back into its original plain German letter.”

  “I suppose,” asked Gordon Welchman, who taught math at Cambridge with Alan and had come with him to Bletchley Park, “we have no idea how the Enigma does what it does?”

  “Actually,” replied Denniston, “that’s not correct. Thanks to our friends in Poland, we know exactly how it works. While England was burying its head in the sand for the past decade, Poland was preparing for war. Just before the first German tanks crossed their border, our Polish friends explained to us that they had not only figured out the Enigma’s wiring, they’d even built one of their own.”

  “So why do any of us even need to be here?” asked John Jeffreys, another mathematician from Cambridge. “It sounds like the Poles did our work for us.”

  “Hardly,” said Denniston. “There’s more to the Enigma than its wires. Each letter typed into the machine first goes to a plug board that sits between the keyboard and the user. It works like a telephone switchboard, and an operator randomly selects new settings for it every day. So, on Monday, it might turn the letter ‘a’ into ‘b,’ and ‘b’ into ‘a’; on Tuesday, it might turn ‘a’ into ‘t,’ and ‘t’ into ‘a’; and on Wednesday it might keep ‘a’ as ‘a.’ Even though we know how the wiring works, we don’t know which setting the Germans have chosen for any particular day.”

  Denniston now flashed a picture of three wheels, each labeled with letters, onto the projection screen.

  “These are the Enigma’s rotors,” he explained. “The signal for each individual letter is carried by electric current to a rotor sitting above the right side of the keyboard. The right rotor changes the letter into a new letter, and then sends the letter to an adjacent rotor in the middle. The middle rotor changes the letter again and sends it to the left rotor, which changes the letter yet again and sends it to a reflector. The reflector changes the letter for the third time and sends it back to the left rotor, which changes the letter and sends it back to the middle rotor, which changes the letter and sends it back to the right rotor, which sends the letter back to the plug board for one last switcheroo.

  “Here’s an illustration of the process, but for the sake of simplicity, it leaves off the plug board.” Denniston flipped a switch and projected his final slide:

  “By the time the plug board and the rotors have done their work, the original letter could be anything! The final, encoded letter appears on a board of little lamps, each labeled with a different letter. The lamp board looks like a keyboard, but with little lamps instead of buttons on a keyboard. The user simply writes down each letter on a piece of paper after the Enigma produces it.”

  “How long does all this letter-switching take?” asked Jeffreys.

  “It all happens in less than a second,” said Denniston. “And the trickiest thing is that the rotors are always moving. Once one letter goes through this process, one of the rotors turns a notch, which means that if ‘q’ became ‘u’ the first time you pressed ‘u’ on the Enigma—as in the example on the screen—then ‘u’ might become ‘z’ the next time you press ‘u,’ even if it’s just a moment later. Even though certain settings only change once a day, the alignment of the rotors is constantly changing. In fact, the alignment changes after every letter of every message, which means the code changes after every letter of every message.”

  “Bloody hell!” said Welchman, looking stunned. “We’re supposed to crack this code? By my estimate, there are over 17,000 possible combinations produced by the rotors. That isn’t so bad, but there are 150 trillion ways of connecting ten pairs of letters on that blasted plug board. And I assume the Krauts randomly change the starting position of each rotor every day, just like the plug board? So every day is a new day of trillions of new possible combinations.”

  “Quite right, Mr. Welchman,” replied Denniston. “It’s actually 17,576—but, believe it or not, it’s much worse than that. The Germans choose three rotors every day out of a stock of five possible rotors. That means there are sixty possible rotor combinations. In other words, the number of potential combinations is 60 times 17,576 times 150 trillion.

  “The U-boat version of Enigma is even more complicated. Its user selects three rotors from a stockpile of eight possible ones. That means there are 336 possible rotor combinations, making it 336 times 17,576 times 150 trillion.”

  “So, that’s almost a sextillion combinations,” Alan said, speaking up for the first time. “885,376,800,000,000,000,000 by my calculations. If we tested a possible combination of rotors and plug board settings every second of every day for 28 trillion years, we’d still have 55 billion combinations untested. And even if we were somehow able to decipher a single letter in a single word, after 28 trillion years, we’d have to start all over again for the very next letter, because the Enigma’s rotors spin after each one.”

  Alan looked around the table and saw stunned expressions on his colleagues’ faces.

  “Yes,” said Denniston, “that’s quite right.”

  “I have only have one question, Alastair,” said Alan, who was dismissive of protocol even when his mind wasn’t consumed with mathematical puzzles; it never occurred to him to refer to his superior by rank.

  “Yes, Turing,” said Denniston, clearly irked that a subordinate was addressing him by his first name, “what’s your question?”

  Alan knew he’d never be the life of a cocktail party or set a marathon record, although he had almost qualified for Britain’s Olympic team. He knew he’d never write like Keats or speak like Churchill. But he understood more about mathematics and probability than anyone in England. From the moment he had heard about the Enigma, he never doubted his ability to build and program a machine—an electronic brain—that could outguess any machine the Nazis could come up with.

  It would be like tackling the decision problem.

  It would be fun.

  “My question is,” said Alan Turing, “when can I start?”

  Bletchley Park

  October 26, 1940

  Alan sat alone in his office, his fingers stained with fountain pen ink, a week’s worth of dirty clothes flung haphazardly around the spartan room, and a notebook before him filled with almost illegible scribblings. Hundreds of pages were covered with algorithms, German phrases, pages-long equations, and dozens of diagrams with arrows pointing in a seemingly infinite number of directions, connecting a seemingly infinite number of signs and symbols.

  Alan had slept until noon, and now, nine hours later, he still looked as if he had just woken up. Despite the three-mile bicycle ride to Bletchley Park from his room in Shenley Brook End, he hadn’t bothered to change out of his pajamas. Alan had met his professorial comrades’ informality and raised it, throwing in a few Turingesque eccentricities for good measure.

  To prevent the symptoms of hay fever, he biked to work wearing a gas mask. To
keep his oversize trousers up, he used a string of yarn around his waist instead of a belt. To protect his finances, he had bought and buried bars of silver that would likely hold their value even in the worst-case scenario of a successful German invasion, although in his absentmindedness, he had already forgotten the exact spot in the woods where he’d buried them.

  Perhaps oddest of all was Alan’s decision to chain his coffee mug to a radiator in his office. He didn’t require much, but he needed his black coffee. And coffee cups, which were difficult to come by in war-torn England, were prime targets for petty thieves.

  “Turing!” shouted Alastair Denniston, barging into Alan’s office uninvited and unwelcomed. “Why weren’t you in your office this morning?”

  “I was.”

  “What do you mean you were? I was here at nine o’clock, and you were nowhere to be found.”

  “I’m afraid you just missed me,” Alan said, smiling. “I left my office at three o’clock in the morning.”

  “Very funny,” said an unamused Denniston. “Look, I’m not here to talk about your work hours or your unprofessional appearance for that matter. Heaven knows you put in as much time as anyone else here, even if you have unorthodox ways of doing it. My concern, rather, is what you’re working on.”

  “The U-boat Enigma?” asked Alan.

  “Quite right,” said Denniston. “In case you haven’t noticed, the Krauts are bombing London to smithereens. They’ve already marched through Poland, Denmark, Norway, Holland, Belgium, Luxembourg, and France. We might bloody well be next. Seven thousand civilian fatalities in London last month alone.”

  “Why,” Alan asked calmly, trying and failing to mask his annoyance with this seemingly pointless interruption, “are you telling me things I already know?”