Concepts / Encryption and certificates

Encryption and certificates

Hashing, salting and key exchange

Also called hash, SHA-256, salt, bcrypt, Diffie-Hellman, public key, private key, symmetric, asymmetric, PKI

The building blocks under TLS and passwords: one-way hashes, salts, key pairs and agreeing a key in public.

A salt makes equal passwords hash differently
A salt makes equal passwords hash differently

Without a salt, two users with the same password store the same hash, and one precomputed table cracks both. A random salt per user forces a separate guess for each.

A hash (SHA-256) turns any data into a fixed-size fingerprint that cannot be turned back. Systems store a password's hash, never the password. A salt, random bytes stored beside each hash, makes equal passwords hash differently, so one precomputed table cannot crack them all; slow hashes (bcrypt, scrypt, Argon2) make each guess expensive. Key exchange (Diffie-Hellman) lets two sides agree a shared key over a network others can read. Symmetric encryption uses that one shared key; asymmetric uses a public and private key pair, and a PKI is the system of certificates that vouches for whose public key is whose.

See it on real machines

Read next

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Sign in with Google or email to start.

Start this lab