Caesar cipher

From Schoolcoders wiki
Jump to: navigation, search

The Caesar Cipher is a very simple way to encrypt text messages (that is, messages that contain only the 26 letters of the alphabet). It is so called because Julius Caesar is belived to have used it.

It isn't a very effective method, it can be broken quite trivially in a few minutes, even without a computer.


Encryption

The Caesar Cipher is a simple substitution cipher.

Each letter in the plaintext is replaced by the letter 3 places down the alphabet to create the ciphertext. An easy way to do the encoding is to use a coding wheel like the one here:


Caesar.png


To encode a letter, find it on the red outer circle. Look up the equivalent coded letter in the blue inner circle. For example, to code the letter A we use letter X. To code letter F we use C, etc.

The message:

   THIS IS A SECRET MESSAGE

becomes

   QEFP FP X PBZOBQ JBPPXDB

Decryption

To decrypt a message, we reverse the process. Simply find the encrypted character on the inner blue ring, and substitute the correct plaintext value from the oute red ring. So to decode A we use D, to decode F we use I etc.

Variations

Rather than shifting the letters by 3, you can shift them by n where n is nay number between 1 and 25. If you shift the alphabet by 26 letters, of course, you end up with the original alphabet, so the message won't be encrypted at all.

In that case, n becomes the "key" you need to know in order to encrypt or decrypt messages. However, changing the key doesn't really make the code any more secure. There are only 25 possibilities and it is quite quick to try them all on the first few letters of the text. The correctly key will yield a sensible message, all the other keys will give a random set of letters.


See also