Crypto cheat sheet
Every algorithm in the playground at a glance: what it is for, typical key sizes, how fast it runs, and the jobs it is the right tool for.
Encrypt a file or database column
AES-256-GCM
Store user passwords
Argon2id (or bcrypt)
Verify a download was not tampered with
SHA-256 checksum
Authenticate an API request
HMAC-SHA-256
Sign a software release
Ed25519
Set up a secure channel with a stranger
ECDHE + AES-GCM (TLS 1.3)
Send bytes through a text-only field
Base64 (no security)
Key size
128 / 192 / 256-bit key, 96-bit nonce
Speed
Very fast — GB/s with hardware acceleration
Use it when
Files, database fields, disk volumes, and everything after a TLS handshake. Default choice for 'encrypt this data'.
Watch out
Never reuse a nonce with the same key, and never share the key over an insecure channel.
Key size
256-bit key, 96-bit nonce
Speed
Very fast, even without AES instructions
Use it when
Mobile devices, embedded CPUs, or any platform lacking AES hardware support.
Watch out
Same nonce rule as AES-GCM — one nonce per message, always.
Key size
No key — 256-bit (32-byte) digest
Speed
Fast — hundreds of MB/s
Use it when
File integrity checks, digital signatures, blockchains, deduplication, commit IDs.
Watch out
Storing passwords directly — it is far too fast, so brute force is cheap.
Key size
Any length key (≥ 256-bit recommended)
Speed
Fast — about two SHA-256 passes
Use it when
Signing API requests, webhook verification, session tokens, cookie integrity.
Watch out
Comparing tags with ==; use a constant-time comparison to prevent timing leaks.
Key size
Salt + tuned work factor (e.g. 600k PBKDF2 iterations)
Speed
Intentionally slow — ~100 ms per hash
Use it when
Password storage and deriving encryption keys from passphrases. Argon2id is the modern pick.
Watch out
Plain SHA-256, and any scheme without a unique random salt per password.
Key size
2048–4096-bit modulus (2048 is today's minimum)
Speed
Slow — thousands of times slower than AES
Use it when
Certificates, signatures, and wrapping a small AES key. Widely supported by legacy systems.
Watch out
Encrypting large payloads directly — RSA-2048 tops out near 190 bytes with OAEP.
Key size
256-bit key ≈ RSA-3072 security
Speed
Fast signing and verification
Use it when
SSH keys, JWT signing, software updates, modern certificates. Prefer over RSA for new systems.
Watch out
ECDSA with a reused or predictable nonce — it leaks the private key.
Key size
256-bit ephemeral key pair per session
Speed
Fast — sub-millisecond per handshake
Use it when
Every TLS 1.3 handshake and any protocol wanting forward secrecy.
Watch out
Reusing the ephemeral key across sessions — that defeats forward secrecy.
Key size
No key — grows data by ~33%
Speed
Instant
Use it when
Email attachments, Data URIs, JSON payloads, PEM certificates, JWT parts.
Watch out
Treating it as a security measure — anyone can decode it in one line of code.
Key size
Any — only secure as a one-time pad (key as long as message)
Speed
Fastest possible — one CPU instruction
Use it when
Learning bit operations, checksums, and as a stage inside stream ciphers.
Watch out
Short repeating keys — trivially broken by frequency analysis.
Key size
1 shift value (Caesar) or a keyword (Vigenère)
Speed
Instant
Use it when
Teaching substitution, puzzles, and understanding why key length matters.
Watch out
Any real secret — both fall to pen-and-paper cryptanalysis.
1. Use asymmetric crypto to agree on a key, symmetric crypto to move the data. Nobody encrypts a whole file with RSA.
2. Hashing is not encryption. There is no "unhash" — that is the point.
3. Use vetted libraries and standard modes. Homemade crypto fails in ways you cannot see.