The Code Book – Cipher 7, part 2


Ok, we have our CEMOPRTU table, which we can use for the substitution part of the cipher. Again, the table is randomly generated, and both the sending and receiving parties have to have copies of it. If the plaintext is:
I EAT CODES.

Then the ciphertext for the above table would be:

EC UT CP CC MO UT CM ET CO CP MM UU

This brings us to Step 2.
The sender picks a key word. The longer, the better, but it can’t have any duplicated letters. That is, “JAMES” would be ok, but “JIMMY” would need to be stripped down to “JIMY”.

Write out the key word, and under that write the cipher text in the same number of columns.

JAMES
—–
ECUTC
PCCMO
UTCME
TCOCP
MMUU

Then reorder the key alphabetically, along with the associated the columns of text from left to right, top to bottom.

AEJMS
—–
CTEUC
CMPCO
TMUCE
CCTOP
MUMU

Now, it may be obvious here that we’re going to have problems recreating the plaintext if there are spaces on the last row. The recipient might be able to figure out what the ordering is supposed to be based on the key and key length. But, to avoid confusion, we could use “Q” or some other letter that could throw off the frequency counts for padding, and truncate to a half-character if necessary.

JAMES
—–
ECUTC
PCCMO
UTCME
TCOCP
MMUUMC

AEJMS
—–
CTEUC
CMPCO
TMUCE
CCTOP
MUMUM

I’ve seen (at least, I think I have, I’ll talk more about this is a second) two different interpretations of the next step. One is to read the ciphertext from left to right, top to bottom, and send that to our recipient via telegraph.

CTEUCCMPCOTMUCECCTOPMUMUM

The other, which is what’s given in Simon Singh’s book, is to read the columns from top to bottom, left to right. This is the more official step.

CCTCMTMMCUEPUTMUCCOUCOEPM

—–

As far as the sender is concerned, they’re done. So, we switch over to the recipient. The steps go in reverse, but I’m spelling them out in full detail for my own needs.

The recipient gets the ciphertext, as follows:

CCTCMTMMCUEPUTMUCCOUCOEPM

They write out the key in alphabetical order:

AEJMS

CCTCM TMMCU EPUTM UCCOU COEPM

And fill in the ciphertext, breaking it up into columns, assuming that they know how long the columns are supposed to be. The Swedish team commented that the first four characters repeated in the contest cipher, which may be something of a sanity check – if they don’t repeat, you broke up the columns wrong.

AEJMS
—–
CTEUC
CMPCO
TMUCE
CCTOP
MUMUM

They rearrange the key letters back to their proper places, and rearrange the ciphertext columns to match.

JAMES
—–
ECUTC
PCCMO
UTCME
TCOCP
MMUUM

Next, write out the rows from left to right, top to bottom. And, because this text has an odd number of characters, we can discard that last “M”.

EC UT CP CC MO UT CM ET CO CP MM UU

Finally, we go to our CEMOPRTU table, and use the first character of each pair for the row index, and the second for the column index, to get our plaintext back.

I (space) E A T (space) C O D E S
I EAT CODES.

Granted, I could have started out with mixed upper and lower case, and that would have been fine, too. What I really care about, though, is confirmation that I have both sides of the process under control. I can put this cipher text into my VBscript and get the plaintext back out correctly.

Because the next blog entry starts up with my just having the ciphertext, without the key or the CEMOPRTU table.

Edit: Meanwhile, about what I mentioned above regarding two ways of writing out the ciphertext before sending it. As I was starting out with this cipher, it seemed there wasn’t very much written about it on the net. I discovered later that it is pretty well-documented, but the pages are in powerpoint viewers that didn’t show up in a yahoo search. I’d thought I was lucky in finding a site written by a math teacher that gave a very simplified description of the original 5×5 table version. He only discussed the encoding stage, and not the decoding part. I am sure, although I haven’t gone back to check, that he used the left-to-right, top-to-bottom row stripping pattern for writing off the codes to a string, and not Singh’s more official top-to-bottom, left-to-right column stripping method.

I really wish I’d looked more closely at the appendix in Singh’s book, because I would have saved myself a world of hurt that way. End Edit.

To be continued.

Advertisements
Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: