Shift Cipher or Caesar Cipher, named after Julius Caesar, is a simple #Substitution Cryptographic #algorithm that simply shifts one letter of the alphabet to a set number of places in the alphabet for another letter (by default, shift 3 places). For example, if the shift value is 4, this means that the letter need to be shifted to the right 4 times, meaning the letter “A” would be “E” in the ciphertext.
We could mathematically give every letter a number from 0 to 25 in English alphabets. Then, we can have a Shift Cipher defined mathematically using the formulas below:
$$ \begin{align} C &= E_k(P) = P + k (\mod 26) P &= D_k(C) = C + k (\mod 26) \end{align} $$
Where:
- \(C\) is the ciphertext
- \(P\) is the plaintext
- \(E\) is the encryption algorithm
- \(D\) is the decryption algorithm
- \(k\) is the shift value
Since there is only 25 possible ciphers (English alphabets), it is vulnerable to Brute Force Attack#.
There are several examples of Shift Cipher:
- ROT13 cipher (shift 13 times)