Join our Newsletter — 33% off our NHI Course
Home› FAQ› Authentication, Authorisation & Trust› How does bcrypt work?
Authentication, Authorisation & Trust

How does bcrypt work?

← Back to all FAQ
By NHI Mgmt Group Editorial Team Updated October 18, 2026 Domain: Authentication, Authorisation & Trust

bcrypt is a password hashing algorithm that deliberately uses a slow, adaptive process to make password cracking expensive. It salts each password and can increase the work factor over time, which helps against brute force and rainbow table attacks. Defenders should store only the hash, choose an appropriate cost setting, and migrate away from weaker hashes.

How bcrypt slows password cracking without changing the password itself

bcrypt is designed to make each password guess expensive. It does that by combining the password with a unique salt and then running a deliberately slow hashing process whose cost can be tuned. The hash result is deterministic for the same password and salt, but the work required to test guesses increases as the cost factor rises.

That design matters because modern attackers rarely rely on a single offline guess. They try large batches of candidate passwords, reuse stolen lists, and benchmark whatever hash function they recover. bcrypt does not prevent guessing, but it raises the computation cost enough that large-scale cracking becomes slower, more expensive, and less practical.

Why the salt and cost factor matter in real deployments

The salt ensures that two users with the same password do not end up with the same stored hash. That blocks rainbow table reuse and makes precomputed cracking far less effective. The cost factor, sometimes called the work factor, lets defenders increase hashing effort over time as hardware improves, which is why bcrypt remains useful even though it is an older design.

At a practical level, bcrypt is usually chosen for password storage rather than for general cryptographic hashing. It is intended for human-chosen secrets, where latency on login is acceptable and deliberate slowness is a benefit. It is not trying to be fast, and that is exactly the point.

When you compare password hashes across systems or across time, bcrypt also gives you an operational clue: the hash format itself carries the cost setting, so you can tell whether a stored password needs rehashing after a policy change. That makes migration easier than with many older hash schemes, because you can raise the work factor gradually without forcing every user to reset at once.

What bcrypt does not solve, and how defenders should use it

bcrypt protects stored passwords, but it does not protect weak passwords, reused passwords, phishing, session theft, or credential stuffing against live services. If an attacker already knows the password, a strong hash does not stop login. If the application stores the hash but also logs plaintext passwords, caches them, or exposes them elsewhere, bcrypt only covers one part of the problem.

For that reason, password hashing should be treated as one control in a larger authentication design. A strong hashing algorithm reduces offline cracking risk after a database exposure, but account protection still depends on password policy, rate limiting, MFA where appropriate, secure reset flows, and careful handling of any secrets used by the application itself. NHIMG’s Password Security and Password Manager Guide is a useful companion for the broader password policy decisions around storage, reuse, and migration away from weaker hashes.

Risk and Threat Considerations

bcrypt reduces the damage from password database theft, but the protection is only as strong as the chosen cost setting, password quality, and the rest of the authentication stack. If the cost is too low, modern hardware can test guesses quickly; if passwords are weak or reused, attackers may still recover accounts through offline cracking or live abuse even when the hash itself is sound.

Failure mechanism: Attackers exploit exposed password hashes by running offline dictionary, spraying, and brute-force workflows against the recovered hash material, with weak passwords and outdated cost settings making success more likely.

Impact: Successful cracking can lead to account takeover, lateral movement, and reuse of the recovered password on other services, especially when users recycle credentials.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

NIST SP 800-53 Rev 5, OWASP ASVS and CIS Controls v8 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
NIST SP 800-53 Rev 5IA-5 — Authenticator Managementbcrypt governs password storage and lifecycle of authenticators.
IA-2 — Identification and Authentication (Organizational Users)Password hashing supports user authentication for accounts in scope.
IA-8 — Identification and Authentication (Non-Organizational Users)bcrypt may protect passwords for external and consumer accounts too.
Recommendation — Store passwords as salted hashes and rehash when the work factor changes. Use strong password hashing as part of authenticating organizational users. Apply salted password hashing for external user credentials as well.
OWASP ASVSV6 — Authenticationbcrypt is a core password-authentication storage mechanism.
V14 — Data ProtectionPassword hashes are sensitive authentication data that must be protected at rest.
Recommendation — Verify passwords are hashed with a slow, salted algorithm and a maintainable cost. Protect stored credential material and avoid exposing plaintext passwords.
CIS Controls v8CIS-5 — Account Managementbcrypt supports secure handling of account credentials and password storage.
Recommendation — Implement secure password storage and migrate weak password hashes.

Practitioner Guidance

What to verify: Confirm that password hashes are stored only as bcrypt hashes, that the cost factor matches current performance and latency targets, and that legacy hashes are being rehashed on successful login rather than left in place indefinitely.

Decision rule: If an account store contains unsalted hashes, fast hashes, or any password values outside the hashing pipeline, treat that as a migration and exposure problem first, not just a configuration detail.

Common mistake: Teams often treat bcrypt as a complete password security strategy when it is really one layer. Strong hashing helps after compromise, but it does not compensate for weak password reuse, poor reset flows, or missing monitoring around authentication abuse.

Practitioner takeaway: bcrypt is most effective when you use it to make offline cracking economically unattractive, then pair it with controls that reduce the chance of password exposure or reuse in the first place.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on October 18, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org