How to store passwords in your database
systemdesignbutsimple.com·3h·
Discuss: r/programming
Flag this post

It is essential to store passwords in a way that prevents an attacker from getting them, even if the database is compromised.

Never store passwords as plaintext.

According to the Open Web Application Security Project (OWASP), secure password storage requires two key ingredients:

A hash function is a one-way mathematical operation. You can turn a password into a hash, but you cannot reverse a hash back into the password.

But not all hashing functions are equal.

Common hash functions like MD5 and SHA-1 are fast - which sounds good, but is actually terrible for passwords. Fast hashing means attackers can try billions of password guesses per second using brute-force attacks.

Instead, use password-specific hashing algorithms that are intentionally sl…

Similar Posts

Loading similar posts...