Password Hashing in Practice
When a user registers, you hash their password and store the hash. When they log in, you hash the submitted password and compare it to the stored hash. If they match, the password is correct — without ever storing the plain text.
Salting
A salt is a random value added to the password before hashing. It ensures that two users with the same password produce different hashes, defeating precomputed rainbow table attacks.
Key Takeaway
Always salt and hash passwords with a slow algorithm (bcrypt, argon2). Never roll your own crypto.