Skip to content
September 3, 2009 | 2 Comments

Poem Code Challenge Hint

In the last post, reader George suggested a challenge to see whether or not short poem codes would be easy to “break”; that is, decrypt without access to the original poem I used to encrypt the message. I want to give a hint about how the challenge might be solved.

Do not try and guess the poem: you will never get it. At best—and only if you have access to some furiously fast flops—you’ll be able to identify the words from the poem, but they are not especially enlightening.

The way to attack the problem, as in most code breaking, is through statistics using a technique called frequency analysis. But let me first tell you why statistics won’t always work (though they often do).

Suppose I am an agent and want to communicate the direction from which the attack will come: north, south, east, or west. I select from my poem five words which contain at least 18 total characters. Why 18? That’s how many characters “northsoutheastwest” has. And why is that important?

A transcription code is just a permutation of the given characters (think about this). Let’s say we want to encrypt “east” and that my poem snippet is exactly 18 letters long. The letters of “east” will be placed in the spots from 1 to 18 depending on the poem’s words (prove this to yourself). Further, since I know this fact, I will use the “nonsense” letters “northsouthwest”, which will also be salted throughout our final encrypted string (again, depending on how the poem’s word places them). That is, the final string will contain all the direction words (plus 2 extra letters, if we want to be neat and form a final group of exactly 5 letters; however, this is obviously not necessary).

You can see that no manner of frequency testing is going to help because all the possible words are there, and attempts to break the code can learn no more than that. That is, by using frequency analysis, plus knowledge of English spelling, you will eventually hit upon that fact that the message contains the four direction words. But that is all you will discover. You will not know which is the intended direction.

The only possible way to figure which word was intended is to make guesses of the words from the poem, and then try encrypting the message yourself and see if matches the original encrypted string you intercepted. There is a frequency of words in use in English and you can choose from them. The strategy would be to pick from all these words (which is a lot!) and try them out in various combinations, one by one, until you hit on the overheard encoding (whatever string of letters you have intercepted). If you think you have some insight into the poem I might have used, then you have scored because the number of possible word combinations will have shrunk amazingly.

I was not especially cruel in the poem code challenge. The message is there and the nonsense padding letters are not parts of other messages. Neither was I overly generous, though. 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. That is the hint. (Obviously, you also ignore the first five characters.)

Still not too easy!

The challenge is to decrypt the following:

  agmpw   tdenl   wyecs   eotas   saobn   ynodo   orlet

September 2, 2009 | 5 Comments

Poem codes

My favorite joke: Two cannibals are eating a clown and one says to the other, “qbrf guvf gnfgr shaal gb lbh?” Ha ha!

I tell it in the old style of the Usenet (remember that?1), where the punchline has been obscured by “Rot13”. This device was used back in the relatively pr0n-free internet days—well, not exactly free, but at least still blushing—when naughty jokes and other robust material was encrypted so that the unwary could not stumble upon it unaware. There was the feeling in those olden days that naughtiness, and especially advertising, were thought to be illegal and immoral. Rot13 allowed people to side-step naughtiness.

Rot13 is a simple substitution cipher, the kind found in the puzzle sections of newspapers (do they still have those?). These are exceedingly easy to solve: every time you see one letter you substitute for it another, and always the same one. In Rot13, the substitution letter is always 13 away from the actual letter, where we assume the (Latin) alphabet is in the form of a circle (“a” is next to “z” where the circle joins together). So, for example, when you see an “s” it really means “f”; when you see an “a” it is a “n”, and so on. Utilities were available to accept a string of Rot13’ed letters and “un-Rot” them; now we have websites: paste the punchline here.

Substitution ciphers can be done easily by hand: but this benefit is also a glaring weakness because it is trivial to decrypt them. Rot13-messages were obviously not meant to be unsolvable, but just as obviously, some messages are meant to be. In terms of deciphering, the next step up in difficulty are transcription codes, and the most amusing among these is the poem code, used largely in World War II. Most books on cryptography concern themselves with code breaking, but Leo Marks’s Between Silk and Cyanide describes beautifully the creation of cipher schemes like poem codes: I recommend it strongly.

This is how poem codes work. Start with a poem which you have memorized: it needn’t be especially long, nor complete. For example, 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:

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

Now suppose we want to encrypt the message, “We have run out of cigars, situation desperate.” Incidentally, encoding must not be confused with encrypting—our message, for example, may be encoded, “Nothing left for Mark Twain to do, dammit” (where we hope the person hearing this is clever enough to figure it out). 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:

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 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”. It was more or less standard practice to send the encrypted message in groups of five letters, which reduced (but of course did not eliminate) transmission errors. So the first part of our message would be

    eudtd koekc pmwrt.

Try encrypting the entire message by hand! You’ll discover it is quite easy to do; you’ll also see where and how errors arise, an invaluable service.

We still have to tell whoever is on the receiving end which five words 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.

Naturally, all nuance is ignored in this short discussion; but know that poem codes are tough to break for short messages and where the poem has been used to encrypt rarely or only once. If the poem is used often, or if it is well known, then breaking messages encrypted with it is not difficult. Additionally, poem codes have the advantage of ease and memorability, and the non-requirement of any computational device.

Finally, I teach you a joke known only to a select few (I learned it in the USAF as a crypto-tech; this is one of the many perquisites provided regularly to my dear readers). Hold up your hand with the back of it facing your victim. Wiggle you fingers vigorously and ask, “What is this?” When you hear, “I don’t know,” pull down your ring and forefingers and pinkie, leaving just the second extended, and say, “Cipher for this.”

Update: a challenge! As suggested, here is a code which you are welcome to break.

  agmpw   tdenl   wyecs   eotas   saobn   ynodo   orlet

I’ll post the solution in a week (if reminded).


1Yes, I know it still exists.

August 28, 2009 | 12 Comments

Vegetarian Swallow Balls

I went shopping in Chinatown and found these delicacies, which match well with the vegetarian intestines I found last year.

Enjoy these—hand slaughtered!—treats on one of the last weekends of the summer.

Vegetarian Swallow Balls Hand slaughtered quail!

For discussion: the strangest thing you have ever ate. How about bundagee. Silk worm pupae in soy sauce and brown sugar—a common Korean street-food.

August 26, 2009 | 18 Comments

You were right, Ted Kennedy

One day in 1973, in his squeaky, pickled-vocal-chords baritone Ted Kennedy filled the Senate chamber with these words: “Do we operate under a system of equal justice under law? Or is there one system for the average citizen and another for the high and mighty?” His intent was rhetorical, because the answer was, and always has been, obvious: of course there are two classes, low and high. And no other modern politician took advantage of this fact more than did the mighty “lion of the senate.”

Here is his tale, which is one of woe, but cushioned throughout by the fact that the mighty are not allowed to fail.

He was a princeling in the House of Kennedy, a prominent and permanent institution of the Massachusetts aristocracy, when, at age thirty, his brother, who was then ascending to the crown, gifted his Senate seat to the young Tedward. It was clear to all that the young prince would not have won this position solely on his own merits—indeed, in spite of his demerits—that he cheated at his alma mater mattered not, for example. But he could, and did, point to his royal blood.

Not long after, when he was thirty-seven, came a drunken midnight drive on Chappaquiddick Island. He crashed and left his passenger for dead. Worse, he abandoned the scene, went home, called his lawyer, and slept off whatever guilt and ethanol he could. But this did not destroy the man. The aristocracy rose as one and made the problem go away.

Much later, as brothers will, he began to envy his dead sibling and sought to mimic his better’s example and so seek the kingly office. When asked, “Why should thou be anointed?”, his answer, “I am Kennedy”, satisfied few, except those ensconced in his fiefdom. He did not win. But he was not allowed to fail and he retained his seat.

Forlorn at his bitter defeat, he embraced strongly his vices. He drank to excess and often. He took and spent other people’s money liberally. He told lies about opponents in open session. He chased, cornered, caught, and copulated with women aplenty; one famous dalliance was conducted on the floor of restaurant in full view of the commoners. All this was forgiven because he was Kennedy, because he was solid on abortion, because—and only because—he was high and mighty.

Now he is dead, but he will be lauded and remembered fondly, more because of his status than what he has accomplished. For we must recall the tale of the counterfactual: while it true that this man has produced some benefit, just as he has certainly caused much harm, we are forced to ask what better and what different could have been had he, instead of joining the Senate, been farmed out to an ambassadorship in Latvia. These necessary ruminations will not be pleasant to the aristocracy and so they will be ignored.