Cybersecurity glossary

What is bcrypt?

Learn what bcrypt is, how its adaptive cost factor protects stored passwords, why the 72-byte input limit matters, and when to choose Argon2 instead.

Cryptography and TLSUpdated August 11, 2026
Also known asbcrypt hashBlowfish password hashbcrypt password hash

Definition

bcrypt is an adaptive password-hashing function based on the Blowfish cipher that stores a salt and work factor with each hash so password verification can become slower as hardware improves.

Why bcrypt still matters

Password databases leak often enough that stored passwords must be designed for breach conditions. bcrypt helps by making each password guess intentionally expensive and by embedding a unique salt into every stored hash string.

It is not the newest password-hashing option, but it remains widely deployed, well studied, and supported across major languages. The important engineering question is not whether bcrypt is fashionable; it is whether the cost factor, input handling, and migration plan match today's threat model.

What bcrypt stores in a password hash

A bcrypt hash is more than a digest. The encoded string carries the algorithm version, cost factor, salt, and derived output so verification can repeat the same work without a separate parameter database.

Version prefix

Prefixes such as $2b$ identify the bcrypt variant expected by the verification library.

Cost factor

A logarithmic work factor controls how many expensive key-setup rounds each password guess requires.

Salt

Per-password randomness prevents two users with the same password from storing the same verifier.

Hash output

The derived verifier is compared during login; the original password should never be recoverable.

How bcrypt password verification works

1

User submits a password

The authentication service receives the candidate password over TLS and applies any normal password handling rules.

2

Load the encoded hash

The stored bcrypt string provides the version, cost, salt, and expected verifier.

3

Recompute bcrypt

The server hashes the submitted password with the stored salt and work factor.

4

Compare safely

The computed result is compared to the stored verifier without leaking timing differences.

5

Apply online defenses

Rate limits, MFA, lockouts, and anomaly detection slow attackers who try guesses through the login form.

6

Rehash when policy changes

After a successful login, upgrade hashes that use an old version prefix or a cost below current policy.

Cost factor, 72-byte limit, and algorithm choice

bcrypt's cost is logarithmic: raising the factor by one roughly doubles the work. That makes tuning simple, but it also means a setting that felt strong several hardware generations ago can become weak without periodic benchmarking.

The other common surprise is bcrypt's 72-byte input limit. Many implementations ignore bytes after that boundary, and multi-byte Unicode characters can make "72 characters" and "72 bytes" very different. Avoid homegrown fixes; if you pre-hash long passwords before bcrypt, use a vetted pattern that preserves entropy, handles encoding consistently, and does not introduce a fast unsalted verifier.

OptionPrimary strengthPractical guidance
bcryptAdaptive CPU cost with built-in saltAcceptable for existing systems when cost is strong and the 72-byte limit is handled deliberately
Argon2idMemory hardness plus tunable timePreferred for new password storage when reliable library support is available
scryptMemory-hard designUseful where deployed carefully, but parameter choices require capacity testing
PBKDF2High iteration countCommon in standards and legacy systems; often less resistant to parallel cracking than modern memory-hard choices

Operational checklist

Good bcrypt deployments pair cryptographic settings with authentication controls and a migration path.

  • Use a maintained bcrypt library that stores and verifies the full encoded hash string.
  • Benchmark the cost factor on production-like hardware and choose the highest value that preserves acceptable login latency.
  • Generate a unique random salt for every password; let the library encode it with the hash.
  • Document how your stack handles passwords longer than 72 bytes, especially after Unicode normalization or UTF-8 encoding.
  • Rehash on successful login when stored hashes use an outdated cost or bcrypt prefix.
  • Combine bcrypt with rate limiting, MFA, breached-password screening, and monitoring for credential stuffing.
  • Keep any pepper outside the password database, preferably in a secrets manager or HSM, with a rotation plan.
  • Do not log plaintext passwords, bcrypt inputs, salts paired with debugging traces, or full password hash dumps.

bcrypt versus Argon2 for new systems

bcrypt is durable because it is simple to deploy and hard to misuse when a mature library owns the format. Its weakness is that it mainly consumes CPU time, so attackers with dense GPU or ASIC rigs can still parallelize large cracking campaigns more efficiently than they can against a well-tuned memory-hard function.

For new applications, Argon2id usually gives a stronger default path. For existing bcrypt systems, a careful migration often beats a rushed rewrite: raise weak costs first, add rehash-on-login, and move users to Argon2id only after the authentication service can validate both formats safely.

The practical takeaway

bcrypt remains a credible password-hashing function when its cost factor is current, salts are unique, and long-password behavior is understood. It should never stand alone: rate limiting, MFA, secure password reset flows, and breach monitoring all matter because password hashing mainly protects the offline-cracking scenario after a verifier database is stolen.

If you are starting fresh, choose Argon2id unless platform constraints make bcrypt the safer operational choice. If you already run bcrypt, keep it tuned, measure it regularly, and plan upgrades before hardware trends make yesterday's cost factor too cheap.

Related security terms

Frequently asked questions

What is bcrypt in simple terms?

bcrypt turns a password into a salted hash that is deliberately slow to compute. If attackers steal the database, every password guess costs time instead of being nearly free.

Is bcrypt still secure for password storage?

Yes, bcrypt can still be acceptable when implemented correctly with a strong cost factor, unique salts, and rehashing over time. For brand-new systems, Argon2id is usually preferred because it is memory-hard.

What bcrypt cost factor should I use?

Choose the highest cost that keeps normal authentication responsive on production-like hardware. OWASP commonly recommends at least cost 10 for bcrypt, but many services benchmark higher values and revisit them as hardware changes.

What is bcrypt's 72-byte password limit?

Most bcrypt implementations only process the first 72 bytes of the password input. Long Unicode passwords can hit that limit sooner than expected, so applications should understand their library behavior before adding pre-hashing or length policies.

Does bcrypt need a salt?

Yes. bcrypt uses a unique salt per password and stores it inside the encoded hash string. Do not reuse one global salt or store salts separately in a custom format unless your library explicitly requires it.

How is bcrypt different from Argon2?

bcrypt mainly raises CPU time with a work factor, while Argon2id can require both memory and time. That memory hardness makes Argon2id stronger against highly parallel GPU and ASIC cracking in new deployments.

Should I encrypt passwords instead of using bcrypt?

No. Stored passwords should be hashed with a password-hashing function such as bcrypt or Argon2id, not encrypted for later recovery. Verification should compare a fresh hash of the submitted password to the stored verifier.

References

Explore authoritative guidance and frameworks related to bcrypt.

Explore every security definition

Return to the glossary to search by term, alias, starting letter, or security category.

Browse glossary