Both scramble data, and I keep picking the wrong one on questions about storing passwords.
Accepted answer
The difference is whether it's meant to be **reversible**.
- **Encryption** is two-way. With the key you get the original back. Use it when someone legitimately needs to read the data later — messages in transit, files at rest.
- **Hashing** is one-way. It maps input to a fixed-length digest with no way back. Use it when you only need to *verify* something matches — integrity checks, and password storage.
Passwords should be **hashed, not encrypted**. Encrypted passwords can be decrypted, so one stolen key exposes every account. With hashing the server stores only the digest, hashes what you type at login, and compares.
Two details exams like: a **salt** (random per-user value added before hashing) stops identical passwords producing identical digests and defeats precomputed tables. And password hashing wants a *deliberately slow* algorithm like bcrypt or Argon2 — fast hashes like MD5 or SHA-1 let an attacker try billions of guesses per second.