The oldest cipher, and the one that shows why weak crypto fails. Shift every letter forward by a fixed amount — Caesar used three — and ‘attack’ becomes ‘dwwdfn’. But there are only 25 shifts to try, and even without trying them, the LETTER FREQUENCIES survive the shift: the most common ciphertext letter is almost surely a shifted ‘e’. Secrecy by obscurity, broken by counting. Slide the shift and watch frequency analysis find it.
A Caesar (shift) cipher maps each letter to the one k positions later: c = (m+k) mod 26; decrypt with −k. It has only 25 non-trivial keys, so brute force is trivial — but it also preserves the plaintext’s LETTER-FREQUENCY distribution, merely rotated, so counting letters in the ciphertext and aligning the peak with English’s most common letter (e) recovers k without any brute force. It is the canonical lesson that a large keyspace is necessary but not sufficient, and that structure leaks. A fail-loud self-check throws unless shift-then-unshift round-trips and ‘attack’+3 = ‘dwwdfn’. ◆ real classical cryptanalysis, node-verified.
Frequency analysis needs enough ciphertext to be reliable; on a very short message the peak can mislead. The shift arithmetic and the ‘frequencies survive a shift’ principle are exact — the reason monoalphabetic ciphers are unsafe.