The First Military Encryption
Julius Caesar didn't trust his messengers. When sending orders to his generals, he shifted every letter by 3. * A -> D * B -> E * C -> F If the messenger was captured, the enemy would just see gibberish like "VHGXFH DJDLQVW".
Why It's Weak
Caesar Cipher is a "Monoalphabetic Substitution." That means 'E' always becomes 'H'. Because 'E' is the most common letter in English, a codebreaker can simply count the letter frequencies (Frequency Analysis) to crack the code in minutes.
Steps to Crack It
- Find the most common letter in the secret message.
- Assume it is 'E'.
- Shift it back to 'E' and see if the rest of the message makes sense.
How the Math Works
The cipher fundamentally relies on a basic modular arithmetic operation over the alphabet. We assign a numerical, 0-indexed value to each letter ($A=0$, $B=1$, ... $Z=25$). To encrypt the message, we take the original letter's index ($x$), add your requested shift key ($K$), and apply modulo 26 to cleanly handle the wrap-around back to 'A'.
$$ E(x) = (x + K) \pmod{26} $$
It's essentially an ancient ring buffer data structure. Despite its mathematical simplicity today, in an era where most enemy forces were entirely illiterate, a basic $+3$ shift was impenetrable military-grade security.