What Is bcrypt? Password Hashing Explained

By George Bailey   Published: 12/04/26   5 min read

What is bcrypt?

bcrypt is a password-hashing function that turns a password into a salted, deliberately slow hash so stolen databases are hard to crack. It was described by Niels Provos and David Mazières in 1999, and OWASP lists it alongside Argon2id and PBKDF2 as an acceptable way to store passwords, though it recommends Argon2id first (OWASP).

Websites should never store your password itself. They store a hash, a one-way fingerprint, and compare it to the hash of what you type. Fast hashes such as SHA-256 are poor for this job because attackers can test huge numbers of guesses quickly. bcrypt is built to be slow. For the general idea, see what hashing is and the bcrypt glossary entry.

How bcrypt works

The original paper, “A Future-Adaptable Password Scheme,” argued that password hashing should be able to get slower as computers get faster, which is why the work factor exists (Provos and Mazières, 1999).

bcrypt vs. Argon2id, scrypt and PBKDF2

OWASP’s current minimums, which it says to treat as starting points to tune for your hardware (OWASP):

AlgorithmOWASP guidance
Argon2idFirst choice. Minimum of 19 MiB memory, 2 iterations and 1 degree of parallelism
scryptIf Argon2id is not available. Minimum cost parameter of 2^17, block size 8 and parallelism 1
bcryptFor legacy systems. Work factor of 10 or more, with a password limit of 72 bytes
PBKDF2If FIPS-140 compliance is required. Work factor of 600,000 or more with HMAC-SHA-256

Argon2 is a memory-hard function, specified in RFC 9106 for password hashing and proof-of-work, which makes large-scale guessing on specialized hardware more expensive (RFC 9106). OWASP also advises that, as a general rule, computing a password hash should take under one second on your server.

The 72-byte limit

OWASP notes bcrypt’s password limit of 72 bytes. Very long passphrases, or passwords with many multi-byte characters, can be affected. If you build a system on bcrypt, follow your library’s guidance on long passwords and test it. If you are starting fresh, OWASP’s order of preference puts Argon2id first.

What NIST says

NIST SP 800-63B-4, the U.S. digital identity guideline, says verifiers must store passwords salted and hashed using a suitable password-hashing scheme that resists offline attacks, with a salt of at least 32 bits, and that the cost factor should be as high as practical without hurting performance (NIST SP 800-63B-4).

What hashing does not protect you from

You cannot see how a site hashes your password, but you can limit the damage of any breach: use unique passwords, turn on two-factor, and act quickly after a notice with our data breach checklist. Developers can read about Argon2 for the newer option.

Frequently asked questions

Is bcrypt still secure?

OWASP lists bcrypt as an acceptable choice, especially for legacy systems, with a work factor of 10 or more and a 72-byte password limit. It recommends Argon2id first. Source: OWASP.

What is a work factor?

It is the number of iterations the hash performs, usually 2 to the power of the work value, which controls how slow each guess is. Source: OWASP.

bcrypt or Argon2id: which should I use?

OWASP recommends Argon2id as the first choice, and bcrypt for legacy systems. Source: OWASP.

Why not just use SHA-256 for passwords?

OWASP says fast algorithms such as SHA-256 are not suitable for password storage because they allow attackers to try many guesses quickly. Source: OWASP.

Does bcrypt include a salt?

Yes. The scheme uses a unique salt for each password, and the salt and work factor are stored in the hash output. Sources: OWASP, Provos and Mazières.

Can attackers decrypt a bcrypt hash?

A hash is one-way, so there is nothing to decrypt. Attackers instead guess passwords, hash each guess and compare. A slow hash and a unique password make that impractical.

Sources

George Bailey

George Bailey is the byline of the CyberExperts editorial desk, the team behind the CyberExperts Daily Brief. The desk covers vulnerabilities, breaches and security news from vendor advisories, CISA alerts and other primary sources, and links those sources in every story. Questions or corrections: [email protected].