How does Caesar cipher work?

To encipher a text using Caesar cipher you take each letter and replace it with the letter a fixed number of places (the “shift”) down the alphabet. When you reach the end of the alphabet you wrap around and start from the beginning.

Example: Assuming the Latin alphabet and a shift of 3 we would replace A by D, B by E, …, Y by B, and Z by C.

Breaking the cipher

The Caesar cipher can be easily broken in a ciphertext-only scenario.

The shift is the key to this cipher and may take up to 25 possible values (assuming the Latin alphabet A-Z with 26 characters). Any other shift value is equivalent to the shift value you get by dividing by the number of characters in the alphabet and taking the remainder (the “modulo operation”). Thus, 260.003 is equivalent to shift 3.

You may break the cipher in a brute force attack by deciphering the ciphertext at hand using all possible shift values and choosing the original text among them. The latter can be done intuitively or automatically using a dictionary or statistical manners (e.g. frequency analysis ).

Resources