bcrypt

A password hashing function that is deliberately slow and salts every hash. Its cost factor doubles the work per step, so guessing passwords from a leaked table stays expensive. The 60-character output holds the version, cost, salt and hash together, and input is limited to 72 bytes.

Minimal example

go
hash, err := bcrypt.GenerateFromPassword([]byte(password), 12)
err = bcrypt.CompareHashAndPassword(hash, []byte(password))

Learn this concept

Lesson 3.1 · Password hashing and random secrets

Used in exercises

Exercise 3.3 · POST /v1/auth/*: signup, login and refresh