The Caesar cipher is a simple encryption technique where each letter in the plaintext is shifted by a certain number of positions down the alphabet. It's a type of substitution cipher.
plaintext: hello world
key: 3
ciphertext: khoor khzruog
In the Caesar cipher, each letter in the plaintext is shifted by a fixed number of positions down the alphabet. For example, with a shift of 3, A would be replaced by D, B would become E, and so on.
Decryption is the inverse operation which is
p = c - k (mod 26)the cipher is weak and can be easily broken, with there being only 25 possible keys (excluding the trivial case of a shift of 0), with a brute-force attack requires at most 25 attempts. the cipher also preserves the word boundaries when spaces are retained, which leaks structural information about the plaintext. even without spaces, short ciphertext is susceptible to index-of-coincidence analysis (measures how often letters repeat).