Poem Code Challenge Solution

Back in September we surrendered to our geek roots and described poem codes. These are a handy method of enciphering short messages in the absence of electronic equipment.

A poem code can be nearly as unbreakable as a one-time pad, encryption schemes which are provably unbreakable.

A reader asked for an example that could be decrypted. Here it is:

    agmpw   tdenl   wyecs   eotas   saobn   ynodo   orlet

Several readers have since written saying, in effect, “Briggs, you lazy slob. Where’s the answer to the poem code challenge you promised? Are you a tease?” So today, the answer.

Here is a brief reminder of how to work a poem code:

Start with a poem which you have memorized. This fragment from Ulysses will do: “for my purpose holds to sail beyond the sunset, and the baths of all the western stars until I die.” Select five words as a key from this: say, “for”, “sail”, “all”, “stars”, “die.” String them together and then number the letters, starting with “a” as 1, the second “a” as 2, etc.; or if there is no second “a”, then “b” is numbered 2; if no “b” then “c” gets labeled 2, and so on until we have numbered all letters. The result is a poem-number snippet:

f | o  | r  | s  | a | i | l | a | l  | l  | s  | t  | a | r  | s | d | i | e |
6 | 12 | 13 | 15 | 1 | 7 | 9 | 2 | 10 | 11 | 16 | 18 | 3 | 14 | 17 | 4 | 8 | 5 |

We want to encrypt the message, “We have run out of cigars, situation desperate.” Since there are 18 letters in our poem selection, we write out the message in groups of 18 letters, padding the end with nonsense letters, like this (I used the nonsense letters a – p):

1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
w | e | h | a | v | e | r | u | n | o  | u  | t  | o  | f  | c  | i  | g  | a  |
r | s | s | i | t | u | a | t | i | o  | n  | d  | e  | s  | p  | e  | r  | a  |
t | e | a | b | c | d | e | f | g | h  | i  | k  | k  | l  | m  | n  | o  | p  |

Note the first letter from our poem-number snippet, an “f”; under it is a 6: the second letter is an “o” and under it is a 12. In our padded, grouped message the 6th column of letters is “eud”, and under the 12th is “tdk”. Send the encrypted message in groups of five letters. The first part of our message would be

    eudtd koekc pmwrt.

We still have to tell the receiving end which five words from the poem we picked as a key: these were the 1st, 6th, 14th, 17th, and 20th. The simplest method is to substitute letters, so: “afnqt” would be affixed to the encrypted message. The receiver then (roughly) follows the procedure backwards to decrypt the message.

Poem codes can be broken by frequency analysis. This is when the letters in the encrypted message are compared to the expected number of letters in common English messages. If poems are reused to send more than one message, then the frequency analysis can be used to discover the original poem. After that, the messages you send may as well be in the clear.

The poem code challenge I gave was complicated, and meant to be very difficult to break, especially since I used the strategy of clever use of padding letters (read this hint).

I suggested nobody would be able to break the message, nor guess the poem.

I went Biblical for my ode—the kind of thing a schoolboy was not supposed to remember from Sunday school. The Song of Solomon:

Thy two breasts are like two young roes that are twins,
which feed among the lilies. Until the day break,
and the shadows flee away,
I will get me to the mountain of myrrh,
and to the hill of frankincense.
Thou art all fair, my love;
there is no spot in thee.

The first sequence of letters were “agmpw”, corresponding to “breasts”, “young”, “feed”, “lilies”, and “shadows.”

This is enough information to solve the code; but I’m feeling generous, so here is the message I encrypted:

    “not so easy to do”

onto which I appended the nonsense letters “nabecrdlynoewslr”. The hint was “The padding I choose were (roughly) letters that are the most common in English, with a slight favoring of duplicate letters that were in the message I encrypted.”

No groaning! I told you it would be hard. But that’s good news: poem codes can be effective.


  1. Vinny Burgoo

    Why wasn’t it ‘cgmpw’?

  2. rmark

    Read ‘Between Silk and Cyanide’ by Leo Marks for his problems with the use of poem codes in WW2

  3. Briggs


    Right: Marks ‘s book is linked in the original poem code challenge.

  4. Dave Pawson

    Are you bypassing the transposition phases as described in the Leo Marks book?

  5. JH

    Late to the party, but the poem code also included a second transposition key. That’s why the code is called “double transposition”.

    A longer message, spanning at least two lines would have demonstrated the problems with a single transposition code. Yours is sadly just a lesson in guessing…

  6. JH

    On second thought:

    Using the phrases as given
    key: breas tsyou ngfee dlili essha dows
    clear text: notso easyt odona becrd lynoe wslr

    we would encrypt into:
    agmpw tdenl wyrcs eotas saobn ynodo orle

    This is one letter too short (compare: agmpw tdenl wyEcs eotas saobn ynodo orleT)
    (Capital letters mark the differences)
    There is some error here 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *