The Caesar cipher is a simple cipher and one of the best known encryption algorithms. It is very simple to encrypt, decrypt and intercept. The Caesar cipher is a substitution cipher where each letter in the plain-text (decoded text) is replaced by a letter a certain number of spaces to the right of the letter in the alphabet. (The amount of spaces is called the key or shift and is only known by the sender and intended receiver).
Disclaimer: Do not attempt to encrypt personal data or serious messages with this cipher!!! It takes only half a second to crack by a computer!
- It takes a very small amount of time to encode and decode messages. (Less than a second, usually)
- No real applications exist for the cipher as it is the most insecure out there.
- This cipher was invented by Julius Caesar as a way to send messages of high military significance.
- Choose the alphabet you are going to use.
- Choose a secret key (shift) that you are going to use in this case
n
. - For every letter in the plain-text, replace it by a letter of the alphabet that is
n
letters away from the letter. (Ex: for a key of1
,a
would becomeb
,z
would becomea
, etc.) - The message should now be encoded.
- Choose the alphabet that the message was encrypted with.
- Let
n
be the secret key the message is encoded in. - For every letter in the cipher-text, replace it by a letter of the alphabet that is
n
letters behind in the alphabet from the letter.c
would beb
,a
would bez
with a key of1
. - The message should now be decoded
Let us say we are sending a secret message to a friend.
- We first write out our message. In this case:
The Caesar cipher is a fun substitution cipher
- Our alphabet will be:
abcdefghijklmnopqrstuvwxyz
. For the uses of this tutorial, case doesn't matter. (On a shift of1
:A
will becomeB
,a
will becomeb
) - Let our key be 6.
- Starting with the first letter:
T
. The letter 6 letters away isZ
. We addZ
to the message. - The second letter is
h
. The letter 6 letters away isn
. Our message is nowZn
- We continue like that until the end. Our final message is:
Znk Igkygx iovnkx oy g lat yahyzozazout iovnkx.
- Decryption is the same way, except instead of going to the right in the alphabet, we go backwards.