Caesar Cipher
The Caesar Cipher is a substitution cipher
- The Caesar Cipher works on a predefined alphabet
- A shift value is defined to represent the offset of the encrypted letters
- The cipher is not very secure as the shift value can be determined through frequency anaylsis
Encryption
With a shift value of n, each letter is replaced with the letter that is n positions further forward
When the end of the alphabet is reached, the shift count moves to the first letter
A substitution table of plaintext to cipher text letters, for the given shift value, can be set up and used
Example
Encode the text box using the lowercase alphabet, a-z, and a shift value of 3.
With a shift value of 3 each letter is replaced with the letter that is 3 positions further forward
- b goes to e (bcde)
- o goes to r (opqr)
- x goes to a (xyza)
box is encrypted as era
Decryption
With a shift value of n, each letter is replaced with the letter that is n positions further back
When the beginning of the alphabet is reached, the shift count moves to the last letter
Alternatively, this is the equivalent of replacing each letter with the letter that is (26 - n), positions further forward, i.e., encrypting with a shift or (26 - n).
A substitution table of ciphertext to plaintext letters, for the given shift value, can be set up and used
Example
Decode the text era using the lowercase alphabet, a-z, and a shift value of 3.
With a shift value of 3 each letter is replaced with the letter that is 3 positions further back
Alternatively, this is the equivalent of replacing each letter with the letter that is 23 (26 - 3), positions further forward
- e goes to b (edcb) (Decryption with a shift of 3)
- r goes to o (rstuvwxyzabcdefghijklmno) (Encryption with a shift of 23)
- a goes to x (azyx) (Decryption with a shift of 3)
era is decrypted to box
Table of Substitions
A grid can be used to easily look up the plaintext letters against the equivalent ciphertext letters for a given alphabet and shift value.
The grid below shows the substution values between plain text and cipher text for a shift value of 3.