How Databases Keep Passwords Secure: Hashing, Salting, and Beyond

Listen to this Post

In this article, Neo Kim explains the mechanisms databases use to store passwords securely. Here’s a breakdown of the process:

  1. Hashing: The server transforms the password using a hash function to create a unique fingerprint. This fingerprint is stored in the database instead of the actual password.
  2. One-Way Function: Hash functions are one-way, meaning the password cannot be reverse-engineered from the fingerprint.
  3. Rainbow Table Attacks: To counter rainbow table attacks (pre-computed tables of hash values), a unique salt is added to the password before hashing. This salt is stored alongside the fingerprint in the database.
  4. Brute-Force Protection: To slow down brute-force attacks, the same hash function is applied multiple times (key stretching).

Practice-Verified Commands and Code: