How to Code Messages Like a WWII Spy

This blog post will take you through the steps of encoding a message using double transposition, just like British and American spies did in WWII. Should you feel like trying it out, it will be up to you to look up the Morris code, secure a radio, and find someone to transmit it to.

Early in WWII, agents with SOE (a British wartime intelligence and sabotage agency) used what was called the poem code. Agents operating in northern Europe would pick a poem and memorize it. Agents operating in the Mediterranean area would often use novels, but the principle was the same. For this post, we’ll use Henry V’s St. Crispin’s Day speech, because I like it. In fact, I like it so much that my Shakespeare-quoting Englishman in Sworn Enemy and Deadly Alliance uses the band of brothers quote in both books. As an added bonus, Shakespeare’s copyrights have run out, so I can quote it on my blog without permission.

So here’s our code:

From this day to the ending of the world
But we in it shall be remembered
We few, we happy few, we band of brothers
For he today that sheds his blood with me
Shall be my brother; be he ne’er so vile,
This day shall gentle his condition.
And gentlemen in England now abed
Shall think themselves accursed that they were not here,
And hold their manhoods cheap whiles any speaks
That fought with us upon Saint Crispin’s Day.

Now we need a message. For use with the poem code, a message needed to be at least 200 characters long. And it would be transmitted via Morris code, so no punctuation. Don’t read too much into this message—I’m just making stuff up. If you were really behind enemy lines, you’d be encouraged to mix up the language, but for this post, we’ll stick to English.

received latest drop need more detonators radio crystals and winter socks stop landing field compromised stop next moon period try field south of river stop agent taylor captured sent to fresnes stop malarkey cover blown request extraction at once stop plan to sabotage ball bearing factory in two weeks

Next we need a key. For this part, we pick five words from our poem. Let’s choose these:

ending sheds gentlemen accursed saint

Next, we turn the five words into a numeric code. We assign a 1 to the first letter in the alphabet, then a 2 to the second, etc. If there are more than one of the same letter, give the letter farthest to the left the first number.

We’ll start with the A’s:

DT5

Then fill in the rest:

dt1

Our key has 33 letters in it, so next we draw a table with 33 columns in it. I’ll use the handy table generator in my word processing system, but if you’re in the field in the 1940s, you’ll probably have to draw your own squared paper. Then write your message inside, without any spaces between words.

dt2

Now comes the tricky part: transposing everything. First we’ll take our key and put it on top of our table.

dt9

Then we write out the new message, beginning with the first column and reading from top to bottom, then moving to the second column and so forth.

dt8

Here’s our new message:

EIITE RAKOS ESNRL DNSHN EBSMT EOTQO CSANE PNIAR ITOYS OECPE EXBRO POATI ALCFD LKETS TDFAV PIOAP DRLNO NDOOD WOEDO OVREE VDIRT LOFES LYCOO YDOGO YRCCE RNPNM ANNSX TEALR SMLUB AWPNR SEOTW ERLOG OORIA DETAT GTACI PEPNE WMUSN SEATT OSCBR RSROS AEINI AANAT YERRC TREST IFTGT KNRST ADLOE TRLTT OMPST EOEDF TET

I divided it into groups of five letters, because that was what they normally did. It made the message easier to manage during transmission. And it’s best to be on the air the shortest amount of time possible, because the Gestapo will be looking for you and your radio operator.

Now the message has been transposed once. But agents were using double transposition, so, you guessed it: time to repeat the process. Pick five different words from the poem and transpose the already transposed message again. (Savvy coders could probably take the letters from the first grid and place them directly into the second grid.) I’ll skip that step here. After the agent had the final transposition, they’d add an indicator so headquarters knew which words they’d used, hand it to the wireless operator, and hope the Gestapo didn’t catch them.

The poem code worked OK. But what if an agent was caught and tortured? The Gestapo could find out what their poem was and use it to help break past messages. Or what if German cryptographers cracked one message and figured out the words used as key? It wouldn’t be much of a stretch to figure out the poem from that, and then they could break all past and future messages.

Leo Marks, SOE’s head of codes, didn’t like the poem code. For one thing, it wasn’t as secure as he’d like it. For another, some of the agents in the field couldn’t spell very well, which fouled up their coding. He came up with what he called worked-out-keys, or WOKs. With WOKs, agents would have keys already made for them and printed on something easily hidden like a silk handkerchief. Each set of keys would be burned after use, so each message used a different key. Even the agents wouldn’t remember what their key had been, so the Gestapo couldn’t torture it out of them, thus making the messages more secure. WOKs also saved the agents the step of making their own keys, plus, it was considered secure with only 100 characters (down from 200), so the process was slightly less tedious. And no more misspellings (at least for the keys). The WOKs would look something like this:

18.9.11.4.20.10.21.22.3.6.13.1.17.23.14.7.19.8.12.15.5.16.2

in pairs, with an indicator group off to the side to tell headquarters which pair an agent was using.

So what brought this blog post up? Toward the end of last year I read Leo Mark’s memoir, Between Silk and Cyanide. It’s one of the best books I read in 2013 and I highly recommend it.

Then I re-read a WWII spy thriller that I’d read a few years before. The first time I read the novel, I thought it was pretty good. But the second time around, I noticed that the heroine was doing double transposition in her head. Yes, that entire process we’ve done above, plus the second transposition, without any scratch paper. She somehow figured out what she wanted to say, didn’t write it down, and magically transmitted it via Morris code, using both the poem code and her WOKs. No, this wasn’t a paranormal book, so the heroine wasn’t supposed to have superpowers.

The novel will remain unnamed in this post, but since reading it I’ve felt the need to explain how double transposition works. Have you ever wanted to set the record straight after reading a book that got it wrong? If you were transported back in time to WWII and became an agent in occupied Europe, do you think you’d have a handle on double transposition?