Coding a Message like a WW2 Secret Agent
Just for fun, I’ll take you through the steps of how to encode a message with the use of double transposition in this blog. If you're subscribed to my newsletter, you probably already know about the coding puzzles I've been making. But this one is even more challenging.
I will demonstrate how wireless operators from the British wartime intelligence agency, SOE, sent coded messages to London with the help of a poem code. Until 1942 this was the customary British way to code messages, but when the German counterintelligence cracked too many of these poems after agents were captured and interrogated, new code systems were invented.
When Leo Marks, the young master coder at the London SOE HQ, got growing suspicions the Germans had captured many of the Dutch SOE agents and communicated with London using their poems, he insisted the use of memorized poems – or even the Lord’s Prayer - was far too easy to crack. He invented other systems. More on that later. Until then, the agents operating in occupied northern Europe memorized a poem they liked. Agents in the Mediterranean often used parts of novels.
We will use Robert Frost’s Stopping by Woods on a Snowy Evening, which is copyright free, so I can freely quote it on my blog.
Here’s our poem code:
Whose woods these are I think I know.
His house is in the village, though;
He will not see me stopping here
To watch his woods fill up with snow.
My little horse must think it's queer
To stop without a farmhouse near
Between the woods and frozen lake
The darkest evening of the year.
He gives his harness bells a shake
To ask if there's some mistake.
The only other sound's the sweep
Of easy wind and downy flake.
The woods are lovely, dark, and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.
When using the poem code, the message needed to be a minimum of 200 characters. It goes too far to explain why, so please just accept that fact. As the message was transmitted via Morse code, there was no punctuation.
The actual agents were encouraged to mix up English with, say French in France and Norwegian in Norway, but as coding is a difficult enough job as it is for us lay (wo)men, we’ll stick to English.
Here’s our fictive message:
latest drop successful stop need more crystals and thermal socks stop use new landing site north of river stop next moon period stop urgent pick up agent thomas urgently cover blown stop agent yves arrested in lyon stop plan to sabotage car parts factory next monday.
Now we need a key. Agents picked five words from their poem. Some chose long ones, other short ones or a mix. Let us choose these:
harness, woods, sleep, darkest, flake
Now we need to transcribe our words into a numeric code. We assign 1 to the first letter in the alphabet, then a 2 to the second, etcetera. In case more of the same letters appear in the words, give the letter to the left the first number and then add.
Start with the A’s:
Then fill in the rest:
Now put your message in a grid:
Onto the transposing process. Take your key and put it on top of the table containing the message:
The coded message will be written out in the following way. Start with the column under number 1 and write it down from top to bottom, which will read ARUSGTPY. Continue with column number 2 and progress in that order.
Our message would read as follows below. For readability, we divide the letters into groups of five. The agents also did this because a five-letter message was easier to manage during transmission. They needed to be ‘on -air’ as short as possible to prevent the Gestapo from picking up their signals.
ARUSG TPYUM NDYTR ESIKO NCSSD OSVBA FREOL SASRN PTAAX ETSEE RGSHIR NRETS TOVIR MOEPN TONKF IBYFL OPRAS ORSLR TODAD TVUWS TCDGP GAAES RCLOA ECEON PLEOA ATMTS NPLNM AYADS ETITE CTEST EOPNL AOSCE PTYEN TGNTD SWEHE TMUAI OUEOY CNNNR STOOH PENTP COPRL SRTLX ONOO
Think we’re done? Nope! Agents had to use double transposition, so they had to repeat the process. For that, they picked five different words from their poem and transposed the already transposed message once again. Experienced coders probably took the letters from the first grid and placed them directly into the second grid. I invite you to do this yourself! You may send me your attempt at hannah@hannahbyron.com
Use the words: snow, lovely, farmhouse, lake, miles
After the double transposition, the agent added an indicator so London HQ would know which words they had chosen. Now came the job of the wireless operator, who sent the coded message in Morse as fast as he or she could.
Apart from the fact the poem codes were easy to torture out of captured agents, Leo Marks found they led to too many ‘indecipherables’. Some agents were atrocious spellers, which botched their coding. In London, hundreds of decoders worked tirelessly to decrypt misspelled messages, preventing agents from having to resend them and face further danger. But it was an arduous job. Marks developed what he called WOKs, worked-out-keys. The WOKs were premade codes, giving the agents ready-made keys, printed on easy-to-hide silk scarves or handkerchiefs. The agent destroyed each set of keys after use, using a different key for every message.
The most important advantage was that the agent wouldn’t be able to remember the key he or she had used, so the Gestapo couldn’t torture it out of them. That differed from the poem codes. WOKs also saved the agents a lot of time, not having to make their own keys. As they were secure with only 100 characters (down from 200), the wireless operators stayed ‘on air’ for a shorter time. Plus, no more spelling errors in the keys. A WOK would have looked 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 one side to let London HQ know which pair the agent was using.
I hope you enjoyed this lesson in coding.