(Credit: HarperCollins)

Every once in a while as I’m reading a book it becomes clear that, for some reason or confluence of reasons, the text in question would make the perfect movie. This perhaps implies a poverty of my own imagination — a disturbing willingness to reduce codices to raw materials for celluloid — but I make do. One such book is Jason Fagone’s “The Woman Who Smashed Codes,” a fascinating combination of love story, spy novel and war tale, all of it true, most of it perfect for the big screen.

Elizebeth Smith, the awkwardness of her first name making up for the plainness of her last, is Fagone’s subject. Her work as a code breaker alongside husband William before and during World War II would serve as the foundation of the National Security Agency. She betrays in her writings the brash, plainspoken certitude of a fiery heroine fit for the screen, as Fagone found in his years spent poring over her papers: “She didn’t like it when she heard a friend say that a person who had died had ‘passed away’ or that a staggering drunk at a party was ‘a bit indisposed.’ It was more important to be honest. ‘We glide over offensiveness of names and calm down our consciences by eulogistic mellifluous terms, until our very moral senses are dulled.’ ”

You can just picture Kiera Knightley or Gemma Arterton or Shailene Woodley sliding right into the role. Any fine actress would relish the chance to set the record straight about the efforts of Elizebeth. Her role in history has been somewhat sidelined as praise has been poured upon her husband, and the attention hogs at J. Edgar Hoover’s FBI stole the credit that was rightfully hers.

But we’re getting ahead of ourselves. First Elizebeth and William must meet, and their meeting takes place at what amounts to an absurdity: an encampment dedicated to the odder sciences known as Riverbank founded by fabulously wealthy tycoon George Fabyan. Fabyan — a towering figure, a head taller than Elizebeth — spent his money collecting people when other men of his stature collected art. The oddities of Riverbank (a menagerie filled with vibrant animals; dinner parties at which movie stars would visit) would make for fantastic visuals with a period flair, while Elizebeth’s reason for being there would likely work even better on the screen than it does on the page.

She had been hired by Fabyan (perhaps played by a bushily bearded J.K. Simmons, or maybe Stellan Skarsgard?) to help Elizabeth Wells Gallup decode Shakespearean texts to find proof that the true author of his works was Francis Bacon. In order to “prove” this, Gallup suggested Bacon had used a “biliteral alphabet” — that is, a system that used slightly differently shaped letters in a text to create a kind of binary code — to hide his pronouncements that he not only wrote the plays in question but was also the queen’s son.

The theory was nonsense, a wild goose chase that depended upon inventing patterns where none existed. But it got Elizebeth interested in code-breaking and gave her the chance to meet William, whose work on ciphers at Riverbank would form the spine of code work for decades to come.

William and Elizebeth’s efforts to flee Riverbank would slide neatly into the second act, during which Elizebeth leads a team at the Treasury Department whose job it is to help the government break the encryptions of bootleggers during Prohibition. Elizebeth became a bit of a media darling during this period — and a bit of a trailblazer. “It was the first unit of its kind in Treasury history, and the only codebreaking unit in America ever to be run by a woman,” Fagone writes, highlighting one of the appeals of this movie for any studio looking for an awards season prestige picture: “It’s ‘Wonder Woman’ meets ‘The Imitation Game’ ” or “It’s ‘Hidden Figures’ but with Nazis” is a can’t-miss pitch for the Academy.

After chasing down rum-runners, Elizebeth set her sights on the ultimate big-screen baddies: Nazis. While the United States did not have much to fear from a cross-Atlantic invasion, the threat of Nazi infiltration south of the border was all too real. And the code traffic Elizebeth sees suggests dominoes were about to start falling: “Argentina alone was not enough for the Nazis: They were conspiring to overthrow the governments of Bolivia, Chile, Paraguay, and Brazil.” This section of the book practically screams out for the cinematic experience — there are shootouts and kidnappings and spies and a colorful cast of characters that briefly includes Roald Dahl, who was working as a spy at the time for the British government.

And while all that is going on, Elizebeth must maintain her home life: caring for husband William (perhaps a Jack Huston type, slight and twitchy with a sadness behind his eyes), whose mental state is precarious; getting the kids ready for school; planning parties for the glitterati of Washington’s undercover world.

Fagone tells Elizebeth’s tale briskly over 340-or-so pages, seamlessly mixing her efforts with little side stories showing the fruit her labor bore. One such story is the capture and interrogation of Osmar Hellmuth, a Nazi agent attempting to complete an arms deal between Germany and the supposedly neutral Argentinians. “The Woman Who Smashed Codes” is short but rarely simple, as the subject matter may require: There’s nothing easy about breaking Enigmas, the legendary German device. But it’s a story that anyone with interest in the time period has to read, a key piece of the puzzle about America’s war effort.

And I bet it would make a heckuva movie.