   ## Caesar's Shift Code

Who hasn't had the need to pass some secret information to a friend? That's what
secret codes are all about. There are many kinds of codes, but we are only going to
learn about one in this experiment. Sometimes this code is called the shift code,
and sometimes it is called Caesar's code. Of its two names, I like the first one
best because it describes how its coding and decoding process works.

Let's get started. Imagine two lines, each containing the alphabet and both lined up
letter for letter like this:

Line 1: 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
Line 2: 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

Next, let's shift Line 1 one place to the right:

Line 1:   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
Line 2: 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

Oops! The first space in Line 1 is now blank, and there is an extra letter hanging
over the end. We need to fix both problems. Here is how. We simply move any
letters hanging over on the right to the blank spaces on the left side. In this
case there is only one letter hanging over, the Z, and one space to fill. Moving it
to the left we have:

Line 1: Z 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
Line 2: 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

Now we are ready to code a secret message, but before we do we should make a
note of the key. What's a key? Well, the key is what will let your friend in on
how to decipher, or decode your message, once he or she gets it. In the example
above the key is B. When we tell our friend the key is B we are telling him or
her to line up the A in line 1 with the B in line 2, and fill in the blanks before
the A with any letters that overhang on the right.

Let's encipher or code the name, JOHN with the key of B, as above. First find each
letter in JOHN on Line 1,and write down the letter on Line 2 that is directly below
it. Starting with J we see that K is directly below, so we write down K. Continuing
in the same way for all the letters in JOHN you should get KPIO.

To decipher KPIO, or turn it back into JOHN, your friend would either have to do
a lot of guessing, or know ahead of time that you were using B as your key. Let's
assume for now that your friend knows that you will be using B as your
key and that he or she is able to produce the shifted alphabet exactly like you did.
To decode or decipher your message, your friend would only have to look up every
letter of your coded message in Line 2 and write down the letter above it in Line 1.
In this way, KPIO becomes JOHN. This is just the reverse of the procedure you used
to code the message in the first place.

The idea of a key is very important. It tells your friend how many letters to
shift Line 1's alphabet to the right, relative to Line 2's. One more example
will make this clear. Let's make our key D this time.

Line 1: 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
Line 2: 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

Next we shift Line 1's A over Line 2's D

Line 1:       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
Line 2: 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

Then we move Line 1's overhang, the X, Y, and Z , from the right of Line 1 to
its left, and we are ready to code with the key of D.

Line 1: X Y Z A B C D E F G H I J K L M N O P Q R S T U V W
Line 2: 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

Now, John becomes MRKQ.

I know, I know, this looks like a lot of work, but it really isn't. Besides, your
message is secret. The whole point is to keep all but your friend from reading it.

I'll bet you are thinking there is an easier way to do this, and you are correct.
However, you must allow your browser to run JavaScripts. If you get a warning
message letting you know that this page contains a JavaScript, simply allow it.

CAESAR CIPHER
SHIFT CODE

Key in a word or a short phrase in the top box
Select Encipher to change Plaintext to Ciphertext
Select Decipher to change Ciphertext to Plaintext
Select the desired KEY (by "clicking" a letter button)
See the results in the bottom box
(Your Browser must be JavaScript Enabled for this Cipher to work!)

 To "Break" a secret message that was enciphered using a Caesar Cipher, place the secret message in the top space, click Decipher, and then click each Key button in turn. One Key button will reveal the secret message Try this secret message - TY QVOUZVU DPSS IL OLYL AVKHF

 Encipher Decipher Message: Result:
 (JavaScript program written by Jim Hannon for Secret Code Breaker)  Some of you are going to say, wait a minute. I don't have my computer with me all the time, but I would still like to code and decode messages. For those of you who think this way, here are all 25 shift codes worked out for you. Print them out and carry them with you. You will always be ready to decode a secret message from a friend. Key=B Line 1: Z 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 Line 2: 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 Key=C Line 1: Y Z A B C D E F G H I J K L M N O P Q R S T U V W X Line 2: 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 Key=D Line 1: X Y Z A B C D E F G H I J K L M N O P Q R S T U V W Line 2: 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 Key=E Line 1: W X Y Z A B C D E F G H I J K L M N O P Q R S T U V Line 2: 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 Key=F Line 1: V W X Y Z A B C D E F G H I J K L M N O P Q R S T U Line 2: 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 Key=G Line 1: U V W X Y Z A B C D E F G H I J K L M N O P Q R S T Line 2: 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 Key=H Line 1: T U V W X Y Z A B C D E F G H I J K L M N O P Q R S Line 2: 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 Key=I Line 1: S T U V W X Y Z A B C D E F G H I J K L M N O P Q R Line 2: 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 Key=J Line 1: R S T U V W X Y Z A B C D E F G H I J K L M N O P Q Line 2: 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 Key=K Line 1: Q R S T U V W X Y Z A B C D E F G H I J K L M N O P Line 2: 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 Key=L Line 1: P Q R S T U V W X Y Z A B C D E F G H I J K L M N O Line 2: 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 Key=M Line 1: O P Q R S T U V W X Y Z A B C D E F G H I J K L M N Line 2: 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 Key=N Line 1: N O P Q R S T U V W X Y Z A B C D E F G H I J K L M Line 2: 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 Key=O Line 1: M N O P Q R S T U V W X Y Z A B C D E F G H I J K L Line 2: 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 Key=P Line 1: L M N O P Q R S T U V W X Y Z A B C D E F G H I J K Line 2: 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 Key=Q Line 1: K L M N O P Q R S T U V W X Y Z A B C D E F G H I J Line 2: 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 Key=R Line 1: J K L M N O P Q R S T U V W X Y Z A B C D E F G H I Line 2: 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 Key=S Line 1: I J K L M N O P Q R S T U V W X Y Z A B C D E F G H Line 2: 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 Key=T Line 1: H I J K L M N O P Q R S T U V W X Y Z A B C D E F G Line 2: 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 Key=U Line 1: G H I J K L M N O P Q R S T U V W X Y Z A B C D E F Line 2: 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 Key=V Line 1: 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 E Line 2: 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 Key=W Line 1: 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 Line 2: 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 Key=X Line 1: D 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 Line 2: 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 Key=Y Line 1: C D E F G H I J K L M N O P Q R S T U V W X Y Z A B Line 2: 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 Key=Z Line 1: 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 A Line 2: 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