How Writing a Novel Is Like Decrypting a Cipher

Sometimes the idea that sparks a novel can end up leading the author down a dark and twisty road, full of detours and U-turns, bringing them ultimately to a place entirely unexpected. In the case of The Stars We Share, my novel about the impact of World War II on the lifelong relationship between RAF pilot Alec Oswin and cryptanalyst June Attwell, you might be surprised to learn that the glowing kernel of inspiration was a story within the story about a bear on a frozen river and the princess who held his heart in her hands. I can’t say exactly where those stories came from, but I knew immediately how crucial they would be to my process. And, despite comprising only a small fraction of a novel that spans four continents and nearly fifty years, the bear stories were how I found my way through a narrative that touched on elements—such as algebra and cryptanalysis—that were far from my wheelhouse.

It’s worth mentioning that I am incredibly bad at math. Even while I think it’s beautiful, astonishing, and strangely lyrical, I don’t understand it at all. So how did I end up with June, a character who was, of all things, a codebreaker and mathematician? Good question! I tried to make her stick to maps or railway timetables, both of which make perfect sense to me—when we first meet June, she’s eight years old and is already filling her lonely afternoons by memorizing the atlases and train schedules in her father’s vicarage study. But ultimately I had to admit she should be conversant with intellectuals, philosophers, and ideas I could barely name, let alone discuss. Fermat, my unconscious would whisper on June’s behalf. Cosine. However, when I realized not only that June would want to serve King and Country, but that her particular skill-set made her a natural for the code-breaking life of the Foreign Office and Bletchley Park, I also realized what a comfort math could be. Not for me, certainly, but for June.

While I was entirely comfortable writing about bears and princesses, the task of understanding and expressing mathematics and cryptanalysis was substantially more daunting.

Once I understood not just June’s affinity for advanced mathematics but some of why it was so important for her, it mattered less that I didn’t know as much as she did. The longer I spent writing her character, the more I understood what math was for, as far as June was concerned: When she signs the Official Secrets Act and is ultimately stationed at various far-flung outposts of the British Foreign Office, or when Alec is lost to her for years at a time, June turns to codebreaking both to make sense of things and for respite.

Alec is only eight years old when The Stars We Share opens, displaced from the life he knew in India after his parents are taken by cholera. The stories his mother told him, and the pictures he sees in the constellations his father taught him, are his foundation as he begins a new life in England. Over time, Alec develops other routines and patterns: the call and response of the hidden messages he and June leave for each other in their Fenlands village as teens, the arc of a perfectly batted cricket ball across the village pitch, the night sorties he and his RAF squadron fly. But after he’s shot down and held captive in a series of POW camps during the war, and then comes home to England to find that nothing is the same—including, bewilderingly, June—he relies on the half-remembered stories like a rosary, or an anchor.

While the bear stories are Alec’s comfort and respite, and his way of making sense of the world, June relies on puzzles, patterns, and the phrases and nuances of equations. Her careful designs and configurations order her world as well, especially once it’s a world completely disordered by war, global chaos, and grief. And while I was entirely comfortable writing about bears and princesses, the task of understanding and expressing mathematics and cryptanalysis was substantially more daunting.

If you, like me, are someone for whom there is no research hole too deep, I highly recommend setting part of your book in a time and place so specific that you cannot possibly deal in generalities. For example, one chapter of The Stars We Share is set in an English holiday camp in the summer of 1957. But upon consulting Britain’s National Meteorological Library and Archive for their monthly Air Service Meteorological Office reports, I learned it was cold and rainy most of that month. Instead of sunny days along the shore collecting seashells and wading in the surf, Alec and June had to deal with jackets, downpours, and blowing sand. The Met Office archive was equally helpful when I wanted to know about a different summer, in northern Scotland. Or a spring on the Yorkshire coast, or along the chalky Wiltshire downs.

The problem was that suddenly I had too many facts, and somehow I had to navigate the very boggy ground between world-building and pedantry. And nowhere was this harder than with June’s codes. When Jeramie Orton, my wonderful editor at Viking/Pamela Dorman Books, suggested to me that I include more of how the codes themselves worked, not just June’s facility with them, I regarded the idea with pure alarm. How could I write from the mindset of someone who understood things so completely beyond my ken? I had to find a way to convey her comfort and competence in the work, not to mention the actual codes—their structure, the differences between German and Japanese encryption, even the codebreaking processes at Bletchley Park. Hand me a simple substitution cipher and I have a shot at solving it. 1 = A, 2 = B, and so on. But what June was doing involved not merely breaking codes and decrypting ciphers; she was memorizing patterns the same way she’d memorized the details in the crumbling old maps in her father’s study as a child.

My deep dive into codes and ciphers was a research adventure unto itself—months of carefully listening to personal histories on the BBC’s World War II website as well as scouring books about Bletchley Park like those by Tessa Dunlop and Sinclair McKay. The bibliography I ended up with includes everything from those texts to the memoirs of young Wren radio operators to Michael Smith’s books about the codes of World War II and the men and women who broke them.

If you, like me, are someone for whom there is no research hole too deep, I highly recommend setting part of your book in a time and place so specific that you cannot possibly deal in generalities.

While I expected the codes and codebreaking to be fairly rigid, with each element meaning something very precise, I was surprised to discover nuances such as the personal flourishes and verbal “signatures” cryptanalysts could hear in enemy radio operators’ messages. And that made me wonder whether math had more nuance than I thought as well. Did math, like music, have harmony and resonance? When it’s working right, writing has harmony and resonance as well, and so after a while June’s work with codes, ciphers, and algebraic varieties began to feel just the slightest bit more comfortable for me, too.

One of the great joys for me in telling a story is finding the pieces that eventually become the whole, especially where setting is concerned. I need to know what the trees smell like, whether the air is dank or arid, and what a particular neighborhood might sound like in the dark of night. Alec’s experience tending his Beaufighter in the lush English countryside is very different from what it’s like for him to tend the same airplane in the windy Algerian foothills. Insects large enough to move June’s heavy ceramic coffee mug in a radio hut outside Colombo are unimaginable on the Yorkshire coast. A primrose growing wild on a Fenlands riverbank can strike someone quite differently from the same flower along the fence of a POW camp on the Baltic Sea. And sometimes what I’m after has less to do with plot than with flavoring the story, like the way an elephant’s trumpeting echoes across a morning in Kenya, the kind of dog a particular character might favor, or how a real-life bear unexpectedly became a private in the Polish army.

Each of those pieces of information provides part of the answer to the encoded story. They are all intrinsic to the characterization as well as the world-building. In codebreaking, someone like June or the real-life men and women of Bletchley Park and its outposts would take a message through a series of steps to decrypt it, basing their choices on everything from whether the original message was German or Japanese to whether it was a straightforward code (symbols substituted for the original text) or a more complicated cipher (a string of characters that shifts according to some type of algorithm). Eventually they would arrive at a message that they could pass along to whoever needed it—the Royal Navy, someone at the Foreign Office, Americans working to crack similar codes. And the more I knew about all of that, the more I was intrigued to learn that cryptanalysis relies on semantics (for codes) and syntax (for ciphers), because of course writing a novel does as well.

Each of those pieces of information provides part of the answer to the encoded story. They are all intrinsic to the characterization as well as the world-building.

A writer (or this writer, anyway) starts with a cluster of random material—an orphan, a math prodigy, the Blitz—and has to determine not just how to make it sound right, but how to get it in the right order. How to determine what scenes or sentences should stay or go. For example, an early draft of this novel covered a much longer time period (from the 1920s to the 2000s). All that other material led to one story, but not the right one. It was not, so to speak, a good decryption of my message. Likewise, the methods by which June and the real-life cryptanalysts who informed her work sorted through strands of code or information to find meaning in a murky series of symbols had their corollary in the paths I pursued trying to figure out the book—if I knew my characters had to deal with the Blitz and play an active role in the war, when and where did that mean they could be born? What might they have seen or done? What might X signify vs Y?

The intersection of semantics and syntax means that everything must find its place in the narrative, and sometimes one needs a key to unlock elements of the story—especially for a writer like me, who writes to find out what’s going to happen next, not because he has a clear outline and already knows. In the end, the thing that seemed like the most unlikely element in The Stars We Share ended up being that key for me as well. The bear stories were more than fables, more than a way for June to remember Alec when they were apart, and more even than Alec’s lifeline to a past he would always mourn; they were my guiding light through the novel’s paths and detours.

“Once upon a time there was a river, and on that river lived a bear…”

This is where the story began for me, even as other elements rose to the top or jostled for space in the narrative. For Alec and June, it’s a multigenerational through-line. For me, it’s the golden thread that holds together the tapestry The Stars We Share became, and a treasure map—or a cipher—that leads to the heart of the story.


Rafe Posey’s novel The Stars We Share is available now via Pamela Dorman Books.