Module 2 of 5

Symmetric cryptography

The shared-key primitives that do most of the work in real systems: block ciphers and their modes, authenticated encryption, MACs, and key derivation.

4 lessons81 min reading

Almost every byte of data protected in transit or at rest is protected by a symmetric key. Public-key cryptography sets up the key; a symmetric cipher and a MAC do the bulk work. This module starts at the raw block cipher, shows why a cipher on its own is not encryption you can use, and builds up to authenticated encryption, the only interface most engineers should touch. Then it covers MACs, where a hash used naively breaks, and key derivation, which turns one secret into many keys, each with one job.

Python’s standard library has HMAC and the hash functions but no AES, so some programs here build small, clearly labeled toy ciphers to show the mechanism. By the end you should be able to read a design and say which key protects what, whether integrity is covered, and what happens if a nonce repeats.

Lessons

  1. 2.aBlock ciphers and modesWhat does a block cipher actually do, and why does the mode matter more than the cipher?20 min
  2. 2.bAuthenticated encryptionWhat does an AEAD guarantee, and what happens when a nonce repeats?20 min
  3. 2.cMACs and HMACWhy is HMAC built the way it is, and how do MAC checks go wrong in practice?21 min
  4. 2.dKey derivationHow do you turn one secret into many safe keys, and why are passwords different?20 min