Symmetric encryption: frequently asked questions
Short answers to the most common doubts about symmetric encryption.
What is the difference between symmetric and asymmetric encryption?
In symmetric encryption the same key encrypts and decrypts; in asymmetric encryption there are two different keys, one public and one private. The first is fast, the second solves key exchange.
Is symmetric encryption secure?
Yes, with modern algorithms, long random keys, correct modes and good key management.
How are keys exchanged securely?
Today almost always with public-key protocols, such as Diffie-Hellman key exchange, which allow a secret key to be agreed over a public channel.
Is a password a key?
Not directly. A key is derived from the password with a dedicated slow, salted function, to resist guessing attempts.
AES or ChaCha20?
Both are secure. AES is faster on processors with dedicated instructions; ChaCha20 is very efficient even where those instructions are missing, as on some mobile devices.
Do quantum computers threaten symmetric encryption?
They reduce its security margin, but with 256-bit keys symmetric algorithms are still considered adequate.
The pages of this topic
Back to the overviewSymmetric encryption: how it works
How block and stream ciphers work, modes of operation and authenticated encryption.
Symmetric encryption: history
From the scytale and the Caesar cipher to polyalphabetic ciphers, from rotor machines to DES and AES.
Symmetric encryption: the maths
XOR and its properties, the size of the key space, brute force and the problem of the number of keys among many users.
Symmetric encryption: worked example
An example of XOR encryption on a single character and on a word, to see how the same key encrypts and decrypts.
Symmetric encryption: weaknesses and attacks
Brute force, reuse of keys and nonces, wrong modes, side channels and poor key management: how symmetric encryption is attacked.
Symmetric encryption today
Where symmetric encryption is used every day and which algorithms are recommended: AES-GCM, ChaCha20-Poly1305, disk encryption.
Symmetric encryption: try it yourself
Exercises on XOR, counting keys and brute force, with solutions.