Symmetric Encryption
ELI5 — The Vibe Check
Symmetric encryption uses the same key to lock and unlock data. Like a house key — whoever has a copy can both lock and unlock the door. Super fast, but the challenge is: how do you share the key securely? That's why asymmetric encryption is used first, then symmetric takes over for speed.
Real Talk
Symmetric encryption uses a single shared key for both encryption and decryption. It's computationally faster than asymmetric encryption, making it suitable for bulk data. The key distribution problem is typically solved by exchanging keys via asymmetric encryption. Common algorithms: AES-256, ChaCha20.
Show Me The Code
import { createCipheriv, createDecipheriv, randomBytes } from 'crypto';
const key = randomBytes(32); // 256-bit AES key
const iv = randomBytes(16);
const encrypt = (text) => {
const cipher = createCipheriv('aes-256-gcm', key, iv);
return Buffer.concat([cipher.update(text), cipher.final()]);
};
When You'll Hear This
"AES-256 is the symmetric encryption standard we use for stored data." / "After the TLS handshake, symmetric encryption handles the rest."
Related Terms
Asymmetric Encryption
Asymmetric encryption uses two different keys — one to lock (public key), one to unlock (private key).
Encryption
Encryption is scrambling your message into gibberish so only someone with the secret decoder ring can read it.
TLS (TLS)
TLS (Transport Layer Security) is the updated, actually-secure version of SSL. It's the technology that puts the padlock in your browser's address bar.