intermediatePassword Security: Encoding, Encryption & Hashing

Why shouldn't you use encryption instead of hashing to store passwords?

Encryption is reversible given the right key — if the encryption key is ever leaked or compromised, every stored password can be decrypted instantly. Applications never legitimately need to read a user's original password back (only verify a match), so a one-way hash is both sufficient and far safer: even a full database leak doesn't directly expose plain-text passwords.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to What's wrong with using plain SHA-256 to hash passwords?← Back to all Spring Security questions