Skip to content
Preptima
mediumConceptEntryMidSenior

Why do we hash passwords instead of encrypting them, and what makes a password hash different from SHA-256?

Password hashing vs encryption comes down to reversibility: encrypted passwords can be recovered with a key, while hashes are verified one way. Password storage needs salts and slow memory-hard algorithms such as Argon2, bcrypt or scrypt, not fast SHA-256.

5 min readUpdated 2026-08-15

Answer

Short answer

Passwords are hashed because login only needs verification, not recovery of the original password. Use a unique salt and a deliberately slow password-hashing algorithm; do not use reversible encryption or a fast general-purpose hash such as SHA-256.

Was this answer helpful?

Likely follow-ups

  • What is a pepper, where does it live, and what does it protect against that a salt does not?
  • How do you pick a work factor, and what do you do about it three years later?
  • Your login endpoint responds faster for unknown usernames than for wrong passwords. Why does that matter?
  • How would you migrate a database of MD5 password hashes without forcing every user to reset?

Related questions

Further reading