Chief Warrant Officer John A. Walker, who died in federal prison late last month at the age of 77, was the most consequential spy in American history. Over the course of seven years, from 1967 to 1975, he turned over some of the country’s most significant military secrets to the Soviet Union. When he retired, his friend, Jerry Whitworth, continued where he left off. Walker was arrested in 1985. His wife Barbara turned him in.

Walker’s motive was money. He spent lots on prostitutes and lots more to try and keep his wife happy. When a woman looked at him crossways, a fellow sailor said, "he would unzip his breeches" in a heartbeat. He was unhappy and erratic, except on his binges. His friends knew this; the Navy did not. Walker was nearing bankruptcy and his most valuable asset was his security clearance: TOP SECRET, with access to cryptologic material. Officially, he volunteered himself to the Soviet Embassy in Washington, walking in under the nose of the FBI, which monitored every movement in and out of the 16th Street complex. (His spying may actually have begun earlier.)

But when he did show up in Washington, he brought sample documents, including schematics of advanced submarine systems and diagrams of rotor wire settings for an encryption machine called the KL-47, which protected the U.S. Navy’s most sensitive traffic. The KGB resident at the time, Boris Solomatin, knew at once that he was a genuine walk-in. When Solomatin, against all protocol, introduced himself immediately, Walker "didn't say anything about his love for communism or for the Soviet Union. And because of that, he showed himself to me to be a decent man because as a rule, the people who want only money always try to camouflage their real desire. They try to act as if they are ideologically close to us. But Walker did not,” he told author Pete Earley.

So important was Walker that Solomatin kept knowledge of his recruitment to only two other KGB officers in Washington. In short order, Walker would leave thousands of classified documents at a dead drop in Maryland, all of which Solomatin forwarded to the KGB’s 16th directorate, responsible for stealing enemy communication. Walker handed over war plans, documents describing procedures to relocate politicians in the event of disasters, details about technology the U.S. used to track ships. The Soviets digested all of this happily. But both Walker and his KGB handlers knew that his most valuable secrets were the code keys that he regularly stole from the crypto vault he worked in, keys that would allow the KGB to decrypt intercepted traffic. If they ever got their hands on any of the code devices that the United States used, they might even be able to read the traffic in transit in real time, a type of intelligence coup that had not happened before, not even with Enigma, or with Magic, and would not happen again, until the Cold War ended.

A few months later, an NSA spy ship, the U.S.S. Pueblo ran into trouble off the shores of North Korea. For hours, cryptologists on board tried to destroy documents and equipment before their imminent capture. They did not succeed in getting everything. And one thing the North Koreans found on board, something that had probably been tipped to look for: a big, box-like machine called the KW-7. For years after, the U.S. government tried to keep from the press which agencies and entities encoded their secrets with the KW-7. Earley would later learn that the FBI, the CIA, the State Department, and NATO were all regular KW-7 users during the period

To outsiders, the KW-7 looked like a toy telephone operator set. The key — the starting point for that day's encryption — was the combination of unique wire settings that operators had to carefully engineer each evening, usually around dusk. Key settings were distributed to cryptological officers like Walker, who would then distribute them across the fleet. Since the NSA, which made the codes, had no way of delivering new keys daily, and since over-the-air encryption was not yet feasible, months worth of keys would be stored in advance.

The Soviets now had in their possession a functioning KW-7 machine. They had, from Walker, its working schematics. They also had old keys, and occasionally, new ones too. Solomatin would later tell an interviewer that Walker "enabled your enemies to read your most sensitive military secrets. We knew everything! There has never been a security breach of this magnitude and length in the history of espionage. Seventeen years we were able to read your cables!" He was not exaggerating. In 1985, when Walker was arrested, the Secretary of the Navy John Lehman said that Walker's espionage would have given the Soviets a decisive advantage during nuclear war. A former director of the NSA testified in court that Walker’s work had “powerful war-winning implications for the Soviet side."

Since Walker would only see his handlers twice a year, he could not provide daily keys. But if the Soviets had gotten a KW-7 to work on their own, and if they’d figured out the inner workings of the device’s encryptor, they might not have needed them. The KW-7’s wire arrangement code was replaced by punch cards. The cipher machine was by that time very similar to another that the Soviets had in their possession: the KG-13, which was used inside the United States to protect messages from the National Command Authority to the strategic nuclear forces, and to send CRITIC messages — high priority intelligence bulletins intended for the president — back to NSA headquarters. There has been no confirmation that the Soviets managed to exploit the KG-13; if they did, they would be able to anticipate the start of a nuclear war. And that might not have been a bad thing, because the United States never intended to begin one, despite Soviet fears to the contrary.

We do know that in 1981, the Soviets obtained from Air Force Lieutenant Christopher Cooke detailed information about the SIOP, the nuclear war plan, from a Titan missile officer whose motives remain mysterious to this day. That information included targeting data, flag words, and message formats used to communicate nuclear release instructions. If the Soviets could not read the codes that protected this information, it mattered little whether they had it. But if they had working KG-13 and KW-7 machines, and they had placed taps at the right junctions, they might have been able to read some of the U.S. government's most sensitive secrets before their intended recipients had the chance to decipher them.

Walker died on August 30.