← Back to Crypto playground

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.

Pick by the job
Start from what you need to do, not from the algorithm name.

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)

AES-256-GCM
Symmetric
Encrypt and authenticate bulk data with one shared secret key.

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.

ChaCha20-Poly1305
Symmetric
Authenticated encryption designed for software-only environments.

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.

SHA-256
Hash
Produce a fixed 256-bit fingerprint of any input. One-way, not reversible.

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.

HMAC-SHA-256
Hash
Prove a message came from someone holding the shared key and was not altered.

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.

PBKDF2 / bcrypt / Argon2
Hash
Turn a human password into a key or stored hash — deliberately slowly.

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.

RSA-2048 (OAEP / PSS)
Asymmetric
Encrypt to a public key or sign with a private key — no shared secret needed first.

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.

Ed25519 / ECDSA P-256
Asymmetric
Elliptic-curve digital signatures with small keys and short signatures.

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.

ECDHE (X25519)
Key exchange
Two parties agree on a shared secret over a public channel, then throw the keys away.

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.

Base64
Encoding
Represent binary bytes as 64 safe ASCII characters. Encoding, not encryption.

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.

XOR
Classic
Flip bits against a key. The building block inside real ciphers.

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.

Caesar / Vigenère
Classic
Shift letters by a fixed or repeating amount. Historic, educational only.

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.

Three rules that never change

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.