Set during the Second World War, the novel follows Tom Jericho, a young mathematician and cryptanalyst, as he is drawn back into the secret world of Bletchley Park, the British code-breaking center where thousands of civilians work to decipher German military communications encrypted by the Enigma machine, a portable cipher device capable of generating billions of letter substitutions.
In mid-February 1943, Jericho arrives at King's College, Cambridge, pale and recovering from a nervous breakdown. The college porter, Kite, and other staff observe his every move and speculate about his mysterious presence. Over two weeks he slowly rebuilds his confidence, completing
The Times crossword in minutes and solving chess problems to reassure himself that his mind is intact. A birthday card from Claire Romilly, a woman he was involved with at Bletchley, devastates him with its cool dismissal. Flashbacks reveal his recruitment into cryptanalysis through his Cambridge supervisor, the pioneering mathematician Alan Turing, and trace his relationship with Claire, who pried into his work and searched his belongings before ending the affair.
On March 12, Guy Logie, the acting head of Hut 8, Bletchley's naval cryptanalysis section, arrives to bring Jericho back. The Germans have changed the short weather codebook used by their U-boat fleet, shutting off Bletchley's only way into Shark, the Enigma cipher used exclusively by submarines. Shark is enciphered on a four-rotor Enigma machine, making it 26 times harder to break than standard three-rotor traffic. Bletchley had exploited the weather codebook as a "back door," reading U-boat weather reports and converting the data into cribs, or guessed plaintext, to attack the cipher. With the codebook changed, that door is shut.
Jericho arrives at Bletchley at midnight and enters Hut 8, where Adam Pukowski, a Polish cryptanalyst known as Puck who escaped from occupied Europe, greets him. After leaving the canteen at four in the morning, Jericho spots Claire passing furtively through the guard post and loses her in the blackout. A conference the next morning reveals the stakes: three convoys totaling 117 merchant ships are steaming toward 46 U-boats, and without Shark intelligence the Admiralty cannot reroute them. Leonard Skynner, the head of the Naval Section, assures the admiral that Bletchley can break Shark within four days; Jericho contradicts him publicly, citing the previous 10-month blackout. Douglas Wigram, an official from the Cabinet Office, raises the possibility of a security breach. Skynner later declares Jericho unfit and plans to transfer him out.
On Saturday night, Jericho cycles to Claire's remote cottage. Her cottage-mate, Hester Wallace, a clergyman's daughter who works in Hut 6's Intercept Control Room, turns him away. After Hester leaves for her shift, Jericho lets himself in and searches Claire's bedroom. Beneath a floorboard secured with modern screws, he discovers four intercepted cryptograms bearing the call sign ADU, transmitted in five-letter groups indicating German Army or Luftwaffe origin. An intruder enters downstairs and flees before Jericho can identify him. Jericho hides the intercepts in his coat and cycles home, shaken by the realization that Claire has been stealing classified material.
The next morning, Jericho learns that Claire has failed to appear for her shift. Through a contact in Hut 3, the intelligence-processing section, he discovers that her position in the German Book Room gave her access to the complete paper trail of every decoded signal. He calls her father, Edward Romilly, a Foreign Office official, whose oddly detached response deepens his unease. That evening, Wigram arrives with alarming news: Claire has been officially missing since Friday, a revolver has been stolen from the Bletchley Home Guard armory, and a convergence of suspicious events across German cipher security suggests a leak. Frightened, Jericho burns the stolen cryptograms.
Meanwhile, Jericho proposes his key idea for breaking Shark: using a captured codebook to construct cribs from U-boat convoy contact reports. If enough submarines shadow a convoy and transmit at regular intervals, the accumulated signals could yield sufficient material for the bombes, massive electromechanical machines designed to test cipher settings at high speed. Logie champions the plan, buying Jericho a reprieve from dismissal.
Hester checks the call sign ADU and discovers it belongs to a German Army signals unit in the Smolensk district of occupied Ukraine. The Registry file for the intercepts has been emptied on orders of the Secret Intelligence Service. She contacts Jericho, and they meet secretly. Together they reconstruct the pattern: 11 signals total, initially addressed to German Army headquarters but later redirected to the Gestapo. Someone senior ordered all records removed and the intercept station told to cease monitoring. A delay in that order allowed the final four signals to slip through undecoded into the German Book Room, where Claire stole them.
Jericho and Hester drive to Beaumanor in Leicestershire, where Jericho steals the original operator logs for all 11 intercepts. Back at Bletchley, the convoy battle begins as U-boats converge on convoy HX-229 in mid-Atlantic. Jericho constructs cribs from each incoming contact signal. By late evening, 10 U-boats are shadowing the convoy and torpedoes are striking.
After midnight, Hester delivers settings for Vulture, the German military's standard Enigma cipher for the Russian front. Jericho finds a captured Enigma machine in the mansion's cellar and deciphers the stolen signals one letter at a time. The messages reveal the Katyn Forest massacre: mass graves near Smolensk containing thousands of Polish officers, hands bound with wire, executed by single gunshots to the head. Local witnesses confirm the killings were carried out by the NKVD, the Soviet secret police, during the Soviet occupation in 1940. Among the lists of identified victims, Jericho finds the name "PUKOWSKI, T.": Puck's father.
Jericho realizes that Puck is the traitor. Consumed by grief over his father's murder by Britain's ally, Puck sought out Claire for her access to intelligence and persuaded her to steal the undecoded cryptograms. He has been passing information to the Germans through Rogerio Raposo, a Portuguese diplomat, intending to betray the Enigma secret.
Jericho escapes Bletchley by scaling the perimeter fence and pursues Puck onto a northbound train. Wigram, who has had Puck under surveillance, diverts the train onto a branch line. Jericho confronts Puck, who draws the stolen revolver and shoots a guard. Puck leaps from the slowing train, and soldiers return fire, killing him. Two bullets hit Jericho. Puck's last words are: "I killed her, Thomas. I am so terribly sorry."
Jericho recovers in a military hospital. Wigram confirms that Raposo has been arrested, the U-boat sent to collect Puck has been sunk, and the Germans believe the affair was a trap, preserving the Enigma secret. Logie reports that the convoy battle cost 22 ships, but Jericho's strategy worked: Shark is now being broken six days out of seven.
At a memorial service for Claire, Jericho whispers to Hester that Claire is not dead. He has noticed that her father showed no grief and never attended. Jericho travels to London, visits Somerset House, the national records office, and obtains a death certificate for the real Claire Alexandra Romilly, who died of spinal meningitis at age six in 1929. He confronts Edward Romilly, who admits the truth: Wigram used his dead daughter's identity to create a cover for a female agent planted inside Bletchley. The woman Jericho loved was Wigram's operative all along. The material she passed to Puck was leaked with Wigram's approval to expose the traitor. Puck's dying confession was a lie to protect her.
Romilly urges Jericho to confront Wigram, but Jericho declines, recognizing that pursuing Claire would turn him into another Romilly, a man struggling to breathe life into a ghost. He sends a postcard to Hester inviting her to Cambridge, boards a train, and falls asleep. That night, Kite the porter watches as Jericho stands alone in the great court of King's College, gazing up at the stars, before walking purposefully toward his staircase.