Skip to main content

Password hashing

Passwords are never stored. The platform stores a hash computed with bcrypt, a function designed specifically for passwords.

What bcrypt is​

bcrypt is a cryptographic hash function based on the Blowfish cipher. It is slow and computationally expensive on purpose, which makes brute-force and dictionary attacks impractical. General-purpose functions such as MD5, SHA-1 or SHA-256 are too fast for this use.

Three mechanisms strengthen it:

  1. A salt. A random value added to the password before hashing. It defeats precomputed tables, and two members with the same password get different hashes.
  2. A cost factor. It sets how expensive the computation is, and can be raised as hardware gets faster.
  3. Slow hashing by design.

Reading a bcrypt hash​

$2b$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy
PartMeaning
$2b$bcrypt version
10Cost factor, as a power of two: 2^10 = 1,024 iterations
N9qo8uLOickgx2ZMRZoMyeThe salt, 22 characters
IjZAgcfl7p92ldGxad68LJZdL17lhWyThe hash, 31 characters

How it works​

  1. A unique salt is generated for the password.
  2. The password and the salt are hashed repeatedly, as many times as the cost factor sets.
  3. The version, the cost, the salt and the hash are stored together as one string, so that a password can be checked later without any other data.