Give me 2 minutes, and I'll teach you how databases keep passwords securely (not joking):
• The server transforms the password using a hash function to create the fingerprint.
• The database stores only the fingerprint, and not the password.
• The hash function is one-way, so the password cannot be obtained from a fingerprint.
• The fingerprint is regenerated whenever the user enters a password.
• The regenerated fingerprint is compared against the stored value to provide access.
• Yet it's possible to find the password from a fingerprint using the rainbow table.
• A rainbow table is a map from pre-computed fingerprints to passwords.
• So a unique salt is added to the password to invalidate values of the rainbow table.
• Also the salt is stored alongside the fingerprint in the database.
• The server combines the password with saved salt to regenerate a fingerprint.
• Besides brute-forcing is slowed down by applying the same hash function many times.
——
👋 PS - I just published a video about it on my channel:
→ youtube.com/@systemdesi…