For most of history, cryptography was a cat-and-mouse game between codemakers and codebreakers, played by generals and spies. In the last fifty years it became something else: a rigorous science, and then invisible infrastructure that every one of us relies on thousands of times a day. This short book traces that arc.
1. Ciphers of the ancient world
The oldest idea in cryptography is substitution: replace each letter with another. Julius Caesar shifted every letter three places down the alphabet — the Caesar cipher. It is trivial to break today, and it hides a lesson that took centuries to fully learn: the secrecy must live in the key (here, the shift amount), not in the method. A cipher whose only defence is that the enemy doesn't know how it works will not survive contact with a clever adversary.
Substitution ciphers ruled for a thousand years until Arab scholars developed frequency analysis — noticing that "e" is common in English, so the most common symbol in the ciphertext is probably "e". Suddenly simple substitution was broken, and the arms race began.