In March 1942, an American codebreaker named Elizebeth Smith Friedman made a horrifying discovery: Nazi spies in Latin America had located a large Allied supply ship named the Queen Mary along the coast of Brazil, and German U-boats were planning to sink it. So intent was Adolf Hitler on destroying the ship that he’d offered $250,000 to whichever captain could take it out. Friedman’s discovery allowed the Queen Mary to evade the U-boats, saving the lives of the more than 8,000 soldiers on board.

READ MORE: When Computer Coding Was a 'Woman's' Job

Friedman was one of the first American cryptanalysts, and she played a crucial role in breaking up Nazi spy rings in Latin American during World War II. Yet because of the sensitive nature of her work, she wasn’t allowed to publicly reveal her wartime service. Friedman kept the secret of her work until her death in 1980, even as J. Edgar Hoover took credit for her team’s achievements by attributing its work to the FBI. It was only after her death that historians and researchers uncovered her wartime contributions.

Friedman Begins Career Hunting for Codes in Shakespeare

Elizebeth Smith was born in Huntington, Indiana in 1892. She began her career in cryptanalysis in 1916, when a wealthy man named Colonel George Fabyan hired her to work at Riverbank Laboratories, which he’d founded a few years before in Illinois. Fabyan was a conspiracy theorist who believed Sir Francis Bacon was the true author of William Shakespeare’s plays and poems. Elizebeth’s job was to examine Shakespeare’s work for secret messages that Fabyan believed Bacon had included in the plays and poems.

It was at Riverbank that Elizebeth met her husband, William Frederick Friedman, whom she married in 1917. Both Elizebeth and William realized while working for Fabyan that the Baconian theory, as it is known, was simply not true (the couple later debunked the theory in their 1957 book, The Shakespearean Ciphers Examined). But soon, they got a chance to use their codebreaking skills in a different way, when the United States entered World War I and asked Riverbank Laboratories for wartime assistance.

The Friedmans directed an unofficial codebreaking team during the First World War, and in 1921, they moved to Washington, D.C. to work for the War Department. A few years later, Elizebeth began working with the Coast Guard cracking codes that helped identify and prosecute bootleggers during Prohibition. For this work, she created a codebreaking unit, becoming the first woman to run a codebreaking team in the U.S. government.

Then came World War II. The Coast Guard moved from the Treasury to the Navy Department, which didn’t allow women to run units; and suddenly, Friedman found herself working for a new male boss and on projects that she didn’t always think were the best fit for her skills. Even so, she managed to make significant contributions to the war effort through her meticulous codebreaking.

Friedman Identifies a Nazi Spy Ringleader

Friedman didn’t choose to work on Nazi spy rings in Latin American, says Amy Butler Greenfield, a historian and author of the forthcoming book The Woman All Spies Fear: Code Breaker Elizebeth Smith Friedman and Her Hidden Life.

“She isn’t actually thrilled with that mission,” Greenfield says. “She goes on record later on saying that she doesn’t feel she was deployed well during the war.”

From what Greenfield can tell, Friedman felt this way because she was used to breaking extremely complex codes. Although the central Japanese and German governments used complex codes during the war, the codes Nazi spies used in Latin America were much simpler, and Friedman seemed to think she would have been more useful taking on more complex ones.

Despite Friedman’s feelings that she was qualified for bigger challenges, she still made important contributions to the Allied war effort.

“Elizebeth well knew the value of what she was doing,” says Melissa Davis, director of library and archives at The George C. Marshall Foundation, which houses the Elizebeth Smith Friedman Collection.

“[Nazi] spies were radioing when troop transports were leaving the United States full of thousands of soldiers, and this information was going to be transmitted to, especially, the submarines that could then intercept and sink the troop ships,” Davis says. “So knew she was saving thousands of lives.”

One of the major Nazi spies Friedman identified and tracked was Johannes Siegfried Becker, codenamed “Sargo,” who was trying to forge an alliance between Germany and Argentina. 

“It’s Elizebeth who, as far as I can tell from having looked at all the records, is the one who first comes up with the name of the ship ’s on,”Greenfield says. “That ship is stopped, and that spy is removed and brought to London and [he] confesses everything, and gives a huge amount of information about the spy rings. And that is part of what leads to reeling the spy rings in and to crushing them.”

HISTORY Vault

WATCH: America the Story of Us: World War II on HISTORY Vault

Friedman IDs Spy Fronting as Doll Shop Owner

Another World War II spy whose codes Friedman examined was Velvalee Dickinson, a white American woman who owned a doll shop in New York City and sent coded messages for the Japanese government. FBI director J. Edgar Hoover used Dickinson’s arrest and trial to draw attention to his bureau, but didn’t mention that Friedman had reviewed Dickinson’s coded letters for the prosecution and offered her insight into what they meant.

Although both Elizebeth and her husband, William, performed classified codebreaking during the war, William ended up receiving more public credit for his work, in part because he had to testify during an investigation into whether the United States had prior knowledge of the Japanese attack on Pearl Harbor. Recent scholarship has remedied this imbalance by shedding light on Elizebeth Smith Friedman, as well as other women who received little credit for cracking codes during World War II.