## November 12, 2011

### The oldest trick in the book

Hello again, everyone, I'm sorry I haven't been posting more, but sometimes it is difficult to find the time to sit down and focus on a single subject for a while.  In fact, I still have to record the results of that last poll, update my return post, and begin work on a case study I'm preparing.  But you aren't here to listen to me talk about the things I need to do or my excuses for not doing them, and because my actually useful tag is getting a shameful amount of work I thought I would give a basic tutorial on basic codes, specifically the Caesar's Cipher.

The Caesar's Cipher was so named because it was used first and most famously by none other than the great Roman Emperor: Julius Caesar.  Caesar would, when writing information he wished to keep a secret, shift all of the letters in his message right three times, for example A==D, B==E, and so on, with letters at the end of the alphabet wrapping around to the front ( X==A, Y==B, Z==C).  While this is infamously the most simple code out there, it worked quite well for Caesar, as many of his enemies were largely uneducated and the whole idea of encryptions was not widely used.  However, today it is embarrassingly simple to crack a Caesar's Cipher, though it can be admittedly time consuming if you lack the proper tools, as letters can be shifted as many times as the user chooses (up to 25, of course, for obvious reasons), though the most popular shift seems to be one of 13, so if you think you are dealing with this kind of code you should probably start there.

Of course shifting a letter over two or three (or even 13) places in the alphabet isn't likely to fool anyone for long, and to overcome this problem the Cipher has evolved over time.  One of the most successful ways of making a Cipher more difficult to crack for your enemies is to include a key in your encryption.  This means that instead of simply shifting letters over through the alphabet you use a phrase or other reference point to shift the letters to seemingly random other letters, so the shift is no longer completely liner. If the key is "The quick brown fox jumps over the lazy dog" (which is a convenient phrase at it contains every of letter in the English language) than you could use it one of two ways.  First you could shift the letters within the phrase over on top of each other, so that within the encrypted message T==H, H==E, E==Q and so on, leaving an encrypted message looking like this: "Heq Uickb Rownf Owj Uipso Wlqo Heq Azyd Gwt"  Ovbiously, this looks far more confusing if you aren't encrypting the actual key, but for teaching purposes it should be sufficient.  The other option is to use the key itself as the basis for coding the alphabet, and then adding extra shifts as needed, for example:

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

To avoid unnecessary confusion already used letters in the key were struck through, as were their translated counterparts.  As you can see, this makes cracking a keyed cipher far more challenging.  However, while it is no longer possible (or at least no longer feasible) to crack a keyed cipher through a brute force application (randomly testing all combinations of matchups until one that works is discovered) these can still be overcome logically, even without the key.  What is most important to remember when cracking a keyed Cipher (I am running largely off of memory and personal experience here, so I'm no longer sure that these examples qualify as strict Caesar's Ciphers, but they are close enough that I will cover them a bit further) is that English is a structured language.  There are many letters that will appear together very commonly, and other letters that appear only rarely.  If you are having trouble with some of the letters in a specific word it may help to make note of where within a sentence it is, that could narrow down the words purpose or meaning, and make it clearer what the letters within could be; this is where knowing the writing style of the coder can be very helpful.  Finally it helps to make a list of as many two or three letter words as you can think of, as these will be the easiest to crack, and will often give hints as to what some of the letters in the other words are, and make them easier to crack as well.  Needless to say, one letter words should be quite easy to crack as well.  All in all the longer a keyed Cipher is the more chances someone has to crack it, which is something to keep in mind when you are making your own.

That's all I have on Ciphers for now, though I will probably explore other kinds of codes in the future.  In fact you can make a cipher even more difficult to crack by stacking it on other codes, but this post is long enough, so that coding strategy will have to wait for its own post.  Now I must go update my return post, so until next time

See you around
Free