All operations

Caesar cipher

Shift every letter a fixed distance along the alphabet.

What it does

Every letter moves a fixed number of places along the alphabet, wrapping around at the end. With a shift of three, A becomes D and Z becomes C. Suetonius records Julius Caesar using exactly this shift for military correspondence, which is where the name comes from.

Set the shift to 13 and you have ROT13.

Why it fails

There are only twenty-five useful keys. Trying all of them takes seconds by hand and no time at all by machine, so a Caesar cipher offers no protection against anyone who is actually looking.

It also leaves the shape of the language intact. Letter frequencies, word lengths and repeated patterns all survive the shift, so even without trying every key the plaintext tends to fall out of a frequency count. Every letter maps to exactly one other letter, always, and that is the weakness every classical substitution cipher inherits.

What it is still good for

Teaching. It is the clearest possible demonstration of what a key is, what a keyspace is, and why a small keyspace is fatal. It also turns up constantly in puzzles and capture-the-flag challenges as a first layer.

Vigenere fixes the small keyspace by changing the shift with every letter. Atbash mirrors the alphabet rather than rotating it.