Caesar ciphers are quite popular in the world of cryptography. If you have never heard of them, this would be a helpful introduction for you. I decided to dig deeper and find out how the cipher works.
The Caesar cipher was named after Julius Caesar (yes, that’s pretty obvious!), who was said to use it for encrypting his private messages. This makes it one of the oldest ciphers in the world. It would have been a genuinely useful cipher back then, but now owing to advances in technology, it wouldn’t provide much security now. The drawback here is that it is quite straightforward to decrypt the message, once you figure out how to. Also, a point to note here is that characters could not be encrypted.
If you are aware of substitution ciphers, the Caesar cipher is pretty much the same. Let’s see how it is done with the help of an example:
Let’s say you want to send a message to your friend privately. The message is — “HELLO FRIEND” (I don’t know why you would want to keep this message private. Anyway!)
- Step 1: Write a message that you want to encrypt:
- Step 2: Decide a number (or ‘shift’) between 1 to 26. This will ‘shift’ the position of letters accordingly. For example, if you select a shift of 2, the entire alphabet will shift by 2 positions. So, ‘A’ will be substituted by C, ‘B’ will be substituted by ‘D’… and so on. This shift will need to be known by your friend to decode the message.
- Step 3: Encrypt the message by substituting the corresponding letters in their respective positions.
Now the process at your end is complete! So, you send off your encrypted message to your friend, who receives it and looks at it. He has to decrypt the message to figure out what you have written to him.
To decrypt the message, your friend would have to do the exact opposite of what we did in step 3. We encrypted the message, your friend has to decrypt it!
- Step 4: Just kidding! There is no step 4!! Your friend just has to read the message.
Congratulations!!! You have successfully used a Caesar cipher!
Now you might be wondering — is it still in use today? Well, sort of. It is used as a part of other encryption techniques like the Vigenère cipher or the ROT13 cipher (which has a shift of 13 letters).
A quick fact before you go and encrypt your message — Julius Caesar used a shift of 3 for encrypting his messages!