"Which hash should I use?" gets asked weekly, and the wrong answers are still shipping. A quick field guide.
1. MD5 and SHA-1 are fine for checksums, not for security
Both have practical collision attacks. Use them to detect accidental corruption or as cache keys, never for signatures or integrity against an attacker. Reach for SHA-256 or SHA-3 instead.
2. Never store passwords with a fast hash
SHA-256 is fast by design, which is exactly what an attacker with a GPU wants. Passwords need a slow, salted, memory-hard function: Argon2id, scrypt or bcrypt.
3. A hash is not encryption
You cannot "decrypt" a hash, but short or common inputs are trivially reversed by lookup tables. Add a salt, and use a keyed hash (HMAC) when you need authenticity.
4. Compare digests in constant time
Comparing with === can leak timing. Use crypto.timingSafeEqual in Node or the equivalent in your language when verifying HMACs or tokens.
5.…