Skip to content

bcrypt Forge

Password Hashing · Adaptive Cost · Salted

Generate real bcrypt hashes in your browser, dissect their version/cost/salt/hash anatomy, benchmark how each cost step doubles the work, and watch salting and timing-safe verification hold up against breach and precomputed-table attacks.

What bcrypt Actually Is

A Blowfish-based password hashing scheme designed by Niels Provos & David Mazières (1999). Deliberately slow and adaptive — bcrypt's cost factor lets security scale with hardware improvements.

Where bcrypt Is Used

  • OpenBSD — default password hash (bcrypt originated here)
  • Linux — supported via libxcrypt ($2b$), but not the /etc/shadow default (SHA-512-crypt, or yescrypt on newer distros)
  • PHP password_hash()
  • Node.js bcrypt / bcryptjs
  • Django (optional backend)
  • Ruby on Rails (default via has_secure_password)

Four-Part Output Anatomy

Why bcrypt Is Slow: The Eksblowfish Key Schedule

The cost factor is not an arbitrary dial — it is literally an exponent. Eksblowfish first performs one salted expansion, then runs 2cost cost iterations. Each iteration performs two full ExpandKey calls, one with the password and one with the salt, into an 18-word subkey array (the ) and four 256-entry substitution boxes (the , 4 KB of state). That 4 KB of constantly-rewritten state is what makes bcrypt awkward to run massively-parallel on a GPU.

6

cost 6 → 26 = 64 cost iterations; 129 total ExpandKey calls

Press “Run the key schedule” to execute the real Eksblowfish loop at the chosen cost. The grid and the round counter are driven by rounds that actually completed, and the wait you sit through is the real cost — so try cost 6, then cost 14, and time them.

bcryptjs and the Current $2b$ 72-Byte Limit

This lesson uses bcryptjs with current $2b$ behavior, which feeds only the first 72 UTF-8 bytes of a password into the key schedule. Historical implementations and versions have had other limits. Here, everything after byte 72 is silently ignored. Two different passwords that share the same 72-byte prefix therefore produce a hash that verifies against either one. Type two long passwords below that agree for the first 72 bytes but differ afterward, and watch them cross-verify.

Why This Matters
bcrypt is a widely deployed password hashing scheme in production systems. Understanding its structure — that “cost” means a power-of-two iteration count, with two expansions per iteration, and that this bcryptjs path accepts only the first 72 UTF-8 bytes — helps developers store, verify, and migrate passwords safely, and choose a cost that is slow for attackers yet fast enough for login.