Monday, June 8, 2015

Substitution Codes - Augustus' Code or Caesar's Cipher

I bet you never thought you'd read an ancient Roman history book, but here is what a Roman historian named Seutonius said about a code that the Roman Emperor, Augustus, used for writing secret messages: (translated from the original Latin)

"Whenever he wrote in cipher, he wrote B for A, C for B, and the rest of the letters on the same principle, using AA for X."

(from the book) Augustus, 88AD

According to Seutonius this is the same method Caesar used, but he substituted D for A, E for B, and so on.

So, Augustus' code works like this:
Each letter in the message becomes the next letter in the alphabet. This is called a substitution code because each letter is substituted for another letter, in this case, the next letter in the alphabet.

The message    MEET ME AT THE RIVER  CROSSING
 becomes          NFFU NF  BU UI F  SJWFS  DSPTTJOH

OK, this is a pretty simple code. Augustus probably used it when he was "campaigning" or away from Rome  fighting a war. Messages would have had to be sent by courier on horseback, probably to other sections of his army very close to enemy territory. He kept it simple so he could write messages in code quickly and his officers could decode them easily. The code was just hard enough to make sure that if the courier got caught, the enemy couldn't decode it (remember that very few people in Augustus' time could even read at all).

You can make Augustus' code a little harder by shifting the alphabets a little farther so that instead of using the next letter in the alphabet (shifting 1 letter), you could maybe, for example, shift 4 letters of the alphabet so that A becomes E like so:

A   B   C   D   E   F  G   H   I   J   K   L  M   N   O   P   Q   R   S   T   U  V  W  X   Y   Z
E   F    G   H   I    J   K   L  M  N O   P   Q    R   S   T   U   V  W  X   Y  Z   A   B  C   D

This is the code that Caesar used. When you shift a different number of letters, the person getting the message to decode has to know how much you shifted. You can handle this in two ways, you can let them know ahead of time how many letters to shift or you can start the coded message with the letter that tells how far to shift. In the above example of a 4 letter shift, you would start the message with an "E" to show a 4 letter shift.
So, with a 4 letter shift the message becomes:

The message    MEET    ME    AT    THE    RIVER      CROS S  I NG
 becomes       EQ I I X    QI     EX     XLI    VMZIV     GVSWWMRK

One other thing that Caesar did. He knew that you can sometimes partially decode a message if you can see the lengths of the words and how they are arranged. For instance, if you see XLI in the above message, you could guess that it was the word THE and you would know the code for T, H and E. So messages where arranged so that they were in groups of 5 letters and it was up to the decoder to figure out the word breaks. The above coded message becomes

EQIIX  QIEXX  LIVMZ  IVGVS  WWMRK

so the decoded message becomes:

*MEET  MEATT  HERIV  ERCRO  SSING

so the person decoding it would put in the word breaks and come up with

MEET ME AT THE RIVER CROSSING

OR MAYBE "MEET MEAT THE RIVER CROSSING" which could cause a lot of problems if there was really a river crossing called Meat and they hadn't been formally introduced.

No comments:

Post a Comment

Comments are always welcome.