The locked-box analogy
Imagine you and a friend buy two identical padlocks and one shared key. You can now mail each other anything in a sturdy box: put the item inside, snap the padlock shut, send it. Only someone with the matching key can open the box. The key is the secret; the padlock is the algorithm; the box is the message.
That is symmetric cryptography. Symmetric because the same key both encrypts (locks) and decrypts (unlocks). Everyone in the conversation must already share that key, and no one else can know it.
Why this is harder than it sounds
The hard part is not the math. It is getting the key into both people's hands without anyone else seeing it. This is called the key distribution problem, and for most of history it was the bottleneck of all secure communication. Diplomats hand-carried code books. Submarines launched with sealed envelopes. Banks couriered tapes between offices.
For two people who can meet in advance, symmetric crypto is fast and simple. For a billion strangers who have never met, most of the internet, it is impossible on its own. The fix came in the 1970s with asymmetric cryptography, which is the topic of the next module.
From Caesar to AES
Some ciphers you will hear named:
- Caesar cipher. Each letter is shifted by a fixed amount. Monoalphabetic, trivially broken by trying all 25 shifts. Useful as a learning toy and a warning.
- Substitution cipher. A fixed mapping of each letter to another. Still monoalphabetic and falls quickly to letter-frequency analysis.
- Vigenère. Polyalphabetic, the shift cycles through a repeating keyword. Held up for centuries until Kasiski showed how to recover the key length; then frequency analysis finishes the job.
- DES. Government-standardized in 1977, used everywhere through the 1990s. Its 56-bit key is now too short to be safe.
- AES. The current standard, since 2001. Comes in 128-, 192-, and 256-bit keys. Fast, well studied, and built into modern CPUs.
- ChaCha20. A modern stream cipher used widely in TLS and on mobile devices where AES hardware is missing or slow.
For new systems today, the answer is essentially always AES (with an authenticated mode like AES-GCM) or ChaCha20-Poly1305. The choice usually comes down to which one is faster on the hardware you actually run on.
Modes matter
"Use AES" is not a full answer. AES alone, in its raw form, is not safe for messages, you also need to choose a mode like GCM that adds authentication. Without that, an attacker can flip bits without you noticing.
The first rule of crypto code
The single most repeated piece of advice in this field is: do not roll your own cryptography. Almost every homemade crypto library is broken in ways the author cannot see. The reason is uncomfortable: the algorithms themselves are usually fine, but the small decisions around them (how you generate random numbers, how you handle errors, how long operations take) leak the secrets you are trying to protect.
The rule applies in two directions:
- Do not design your own cipher. Use AES or ChaCha20.
- Do not implement well-known ciphers from scratch in production. Use a vetted library (your platform's standard crypto module, libsodium, or the Web Crypto API).
Where symmetric crypto shows up
Even though the modern web also uses asymmetric crypto, the bulk of the actual byte-pushing is still symmetric, for two reasons: it is much faster, and the key distribution problem can be solved once at the start of a connection by asymmetric crypto, leaving the rest of the conversation to AES.
Examples you have already used today:
- Every HTTPS page you load. After the TLS handshake, the connection is symmetric.
- Disk encryption on your phone and laptop.
- End-to-end encrypted messengers, on the per-message layer.
- Stored Wi-Fi credentials in WPA2/3.
A useful mental shortcut
Whenever you see a symmetric cipher in a design, ask three things: "Where did the key come from?", "How is the message authenticated?", and "What happens when a message is replayed?" Most subtle crypto bugs hide in those three answers.