bcrypt
The Blowfish-based adaptive password hash, a long-standing default in web frameworks
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–1999bcrypt 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
Variants in NextSSL
1| Algorithm | Tier | Sizes (bytes) | Standards | API |
|---|---|---|---|---|
| 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.
Families with similar names
Other password hashing
All 30Related
Schneier's 1993 64-bit Feistel cipher with key-dependent S-boxes
Argon2The Password Hashing Competition winner: memory-hard hashing standardised in RFC 9106
Unix crypt formatsClassic modular-crypt password hashes: BSDi DES, md5crypt, sha256crypt and sha512crypt
scryptColin Percival's memory-hard key derivation function, standardised in RFC 7914