Symmetric Encryption

A track of P52 · Cryptography Foundations.

One shared key, done right: what symmetric encryption is, why the mode matters (ECB leaks structure), and what authenticated encryption (AEAD) adds.

Take a simple image — a logo, say, with large blocks of flat colour — and encrypt it with AES, a genuinely strong cipher, using the most obvious mode available. Then look at the result. You can still see the logo. The colours are scrambled nonsense, but the shape is unmistakable, because identical blocks of input produced identical blocks of output and the outline survived intact. The cipher did not fail. The mode did, and that gap between "I used a strong algorithm" and "my data is protected" is the reason this track exists.

The track builds the idea from the bottom. A symmetric cipher is one key, held by both sides, used to encrypt and decrypt — fast, and the workhorse of every real protocol, including the TLS connection you are reading this over. But a cipher operates on fixed-size blocks, and the mode is the rule for handling messages longer than one block. ECB encrypts each block independently, which is what leaked the logo. CBC chains each block into the next so that identical plaintext no longer looks identical, at the cost of needing an unpredictable initialisation vector. You will encrypt structured data in both and inspect the output, because the failure is genuinely visible rather than theoretical.

Then the harder point, which is that confidentiality is not integrity. A message in CBC mode is unreadable, and it is also modifiable: an attacker who cannot decrypt your ciphertext may still be able to flip bits in it and have you decrypt the result without complaint. Authenticated encryption — AEAD — solves this by making encryption and authentication one operation, so that a tampered ciphertext fails to decrypt at all rather than decrypting to something plausible. You will see what a nonce is for, why reusing one is catastrophic rather than untidy, and why every current protocol reaches for AEAD by default.

One keyfast, both sides share itBlocksthe cipher works in chunksModeECB leaks, CBC chainsAEADtampering fails to decrypt
A strong cipher used in the wrong mode still leaks; authenticated encryption adds the integrity confidentiality lacks.
Symmetric Encryption — TransformerLab