Symmetric encryption · 01 How it works

Symmetric encryption: how it works

How block and stream ciphers work, modes of operation and authenticated encryption.

  1. 01
    Generate the key

    A random sequence of 128 or 256 bits, produced by a cryptographically secure generator.

  2. 02
    Share it

    Over a secure channel or, more often, with a public-key protocol.

  3. 03
    Encrypt

    The algorithm turns plaintext into ciphertext using the key and, almost always, a unique value for each message (initialisation vector or nonce).

  4. 04
    Authenticate

    Modern encryption adds an authentication code that makes any modification detectable.

  5. 05
    Decrypt

    The recipient, with the same key, checks authenticity and recovers the plaintext.

Blocks and streams compared

AspectBlock cipherStream cipher
Unit of workFixed blocks, for example 16 bytesIndividual bits or bytes
UseWith a mode of operation (CBC, CTR, GCM…)Directly, combining data and keystream
ExamplesAES, the old DESChaCha20, the old RC4
Typical riskWrong mode, such as ECBReusing the keystream
Continue with
02 History

Symmetric encryption: history

From the scytale and the Caesar cipher to polyalphabetic ciphers, from rotor machines to DES and AES.

↑