Principles · Overview

Symmetric encryption: one key to lock and to unlock

How symmetric encryption works, the difference between block and stream ciphers, the key distribution problem, the maths of XOR, attacks and the algorithms used today.

In symmetric encryption whoever encrypts and whoever decrypts use the same key, like a safe with a single combination. It is the oldest form of cryptography — the Caesar cipher was already symmetric — and it is still what protects almost all data today: files on a laptop disk, the traffic of an HTTPS site, encrypted calls, archives in the cloud.

Its strength is speed: modern symmetric algorithms encrypt gigabytes per second. Its limit is the key problem: sender and recipient must share the key before communicating, and must keep it secret. For centuries this required couriers, ciphers written in booklets, meetings in person. The modern solution is to combine symmetric encryption with public-key cryptography.

1key shared between sender and recipient
2^128possible keys with AES-128: impossible to try them all
4,950different keys needed for 100 people to communicate privately in pairs

Two families

Block ciphers
They encrypt fixed-size blocks, for example 128 bits, with a complex transformation repeated over several rounds. The main example is AES.
Stream ciphers
They generate a long pseudo-random sequence from the key and combine it with the data bit by bit. The main example is ChaCha20.

Modern symmetric encryption follows Kerckhoffs’s principle: the algorithm is public, only the key is secret. For key exchange see public-key cryptography and Diffie-Hellman.

↑