cryptography

HASHING · SYMMETRIC · ASYMMETRIC · KEY EXCHANGE · PROTOCOLS · TOOLS
Cryptographic Hash Functions
MD5
128-bitBROKEN
1992. Collision attacks found in 2004. Never use for security — only checksums where collision resistance is irrelevant.
SHA-1
160-bitBROKEN
1995. SHAttered collision (Google, 2017). Deprecated by NIST. Still seen in legacy TLS and git (being migrated to SHA-256).
SHA-256
256-bitSECURE
SHA-2 family. Standard for TLS certificates, HMAC-SHA256, JWT HS256/RS256. 128-bit collision resistance.
SHA-512
512-bitSECURE
SHA-2 family. Faster than SHA-256 on 64-bit CPUs. Used in HMAC-SHA512, JWT HS512. 256-bit collision resistance.
SHA-3/256
256-bitSECURE
Keccak sponge construction (2015). Structurally different from SHA-2 — immune to length-extension attacks. NIST standard.
BLAKE3
256-bitSECURE
2020. Fastest cryptographic hash — parallel, SIMD-optimized. Used in Bao, Cargo, IPFS. Replaces BLAKE2 in new designs.
Rule of thumb: Use SHA-256 for general-purpose integrity checks. Use SHA-3 when you need resistance to length-extension attacks without HMAC. Use BLAKE3 when speed is critical.
Password Hashing (KDFs)
Argon2id
RECOMMENDED
Winner of Password Hashing Competition (2015). Memory-hard + time-hard. Resists GPU and ASIC attacks. Use for new systems.
bcrypt
SAFE72-byte limit
1999. Adaptive cost via work factor. Widely supported. Truncates input at 72 bytes — use prehash for long passwords.
scrypt
SAFE
2009. Memory-hard. Used in Litecoin, OpenSSL. Complex parameter tuning makes it harder to configure correctly than Argon2id.
PBKDF2
LEGACYFIPS 140
PKCS#5. Iterated HMAC. FIPS-approved — required in some government contexts. GPU-parallelizable; prefer Argon2id otherwise.
HMAC — Keyed Hashing
HMAC-SHA256(key, message)
Produces a 256-bit MAC — authenticates both origin and integrity. Used in JWT, AWS Signature v4, OAuth 1.0
HMAC = H( (K ⊕ opad) ‖ H( (K ⊕ ipad) ‖ M ) )
RFC 2104 construction. Immune to length-extension attacks that affect raw SHA-2
HKDF-Extract + HKDF-Expand
RFC 5869. Derives multiple keys from a shared secret — used in TLS 1.3 and Signal protocol