Password hash family

bcrypt

The Blowfish-based adaptive password hash, a long-standing default in web frameworks

legacy 1 variant OpenBSD; USENIX 1999

Overview

bcrypt is a password hashing function designed by Niels Provos and David Mazières in 1999 for OpenBSD. It introduced a tunable cost factor so hashing could be made slower as hardware improved, and it remains widely used in web frameworks.

bcrypt is built on Eksblowfish, an 'expensive key schedule' variant of Blowfish. The salt and password are mixed into Blowfish's S-boxes and subkeys, and the key schedule is then repeated 2^cost times, alternately keyed by the password and salt. Finally the string "OrpheanBeholderScryDoubt" is encrypted 64 times with the resulting cipher to produce the hash, which is stored with its cost and salt in a $2b$ modular-crypt string.

bcrypt uses about 4 KiB of memory, which is enough to hinder GPUs moderately but far less than modern memory-hard functions require. Hashes begin with '$2a$', '$2b$' or '$2y$', reflecting fixes to historical implementation bugs, followed by a two-digit cost and a 22-character salt. The cost is logarithmic, so each increment doubles the work.

History

1999–1999
  1. bcrypt presented by Niels Provos and David Mazières at USENIX

Security notes

bcrypt is not broken, but it truncates passwords at 72 bytes and its small memory footprint makes it more vulnerable to FPGA and ASIC attack than Argon2id or scrypt. Some implementations mishandle non-ASCII or null bytes. Use a cost of at least 10–12, and prefer Argon2id for new systems.

Typical uses

Password storage in existing web applicationsInteroperability with $2a$/$2b$/$2y$ hashes

Variants in NextSSL

1
AlgorithmTierSizes (bytes)StandardsAPI
bcrypt
bcrypt
legacy out 23 · salt 16 bcrypt (Provos, Mazieres 1999) root

Frequently asked questions

Which bcrypt variants does NextSSL include?

NextSSL registers 1 bcrypt variant: bcrypt.