The Caesar cipher is one of the most famous encryption methods, named after Julius Caesar, who used it to obsure his private correspondences. It's method for ecncryption and decryption is extremely simple. It requires a key, which can be any integer, positive or negative, representing the shift of each letter in the alphabet. As an example, shown in the below table, the default alphabet (A-Z) is shifted by both 3 and 7, resulting in the ciphered alphabet.

Alphabet | 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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|

Shift: +3 | 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 |

Shift: +7 | 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 |

The Message "Hello World" encoded using the second row would be "Khoor Zruog", while encoding it using the third row would result in the ciphered message "Olssv Dvysk"

The mathmatical operation for encoding a character \(C\) with a given key \(S\) is shown below. \(C\) is equal to the character`s index in the caesar alphabet.

\(E_S(C)=(C+S)\mod 26\)Decryption is performed by subtracting the shift value instead of adding it.

\(D_S(C)=(C-S)\mod 26\)### Applications

The Caesar cipher offers virtually no cryptographic security, only hiding information from cursory glances. However, it is an excellent introduction to the cryptography concept of symmetric encryption, as it introduces the concept of a key (the "shift"), and the data (the message you want to obscure).

A more complex version of the Caesar cipher is the Vigenere cipher, which is essentially a Caesar cipher applied to two dimensions. The ROT-13 cipher is a Caesar cipher with a shift value of 13, and since there are 26 letters in the Latin alphabet, its encryption process is also its decryption process.