Join our Newsletter — 33% off our NHI Course
Home› FAQ› Authentication, Authorisation & Trust› What are the key bcrypt best practices?
Authentication, Authorisation & Trust

What are the key bcrypt best practices?

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

bcrypt should be used with a unique salt for every password and a work factor that is high enough to slow offline cracking without breaking login performance. Organisations should store only the bcrypt hash, compare using constant-time routines where possible, and plan for periodic work-factor increases as hardware improves. Never reuse salts or weaken the hash with truncation.

What bcrypt is doing for you, and what it is not

bcrypt is a password hashing function, not encryption. Its job is to turn a password into a one-way verifier that is slow enough to make offline guessing expensive while still being usable at login time. The security value comes from the salt, the work factor, and correct storage practice, not from treating bcrypt as a general-purpose secret store.

A unique salt per password prevents identical passwords from producing identical hashes, which blocks cheap rainbow-table style reuse and makes precomputation far less effective. The work factor is the adjustable part that determines how much computation each guess requires, so the practical goal is to choose a setting that current hardware can handle without making authentication sluggish for real users.

How to apply bcrypt correctly in production

Store only the bcrypt hash, never the raw password, and treat the hash as the only value you need for verification. That keeps the database from becoming a plaintext password repository if it is exposed. When you verify a login, use the library’s built-in comparison path rather than custom string handling, so you avoid introducing timing differences or format mistakes that bypass the intended protection.

Plan for periodic work-factor increases as hardware improves, but do it as a controlled change rather than a sudden global rewrite. Existing hashes can often be upgraded at the next successful login or through an explicit rehash workflow, which gives you a practical migration path without forcing every user through a disruptive reset at once.

Password Security and Password Manager Guide is useful here because bcrypt is only one part of a broader password control strategy, and the surrounding policy determines whether users are still choosing weak, reused, or compromised passwords.

Common bcrypt mistakes that weaken the design

The most common failures are operational, not mathematical: reusing salts, setting the work factor too low, truncating input in a way that changes the intended password, or storing the hash in a place that is exposed to many unnecessary readers. These mistakes do not break bcrypt itself, but they reduce the cost to an attacker and can make a database breach much easier to exploit.

Another recurring problem is treating bcrypt as a permanent setting. If the cost parameter is never revisited, the hash can become progressively easier to crack as commodity hardware improves. The right mindset is to treat the work factor as a maintained control, not a one-time implementation detail.

For application owners, the practical bar is simple: if you would consider a password vulnerable when exposed in clear text, you should also treat a weak hash configuration as a serious exposure because the attacker can move straight into offline guessing once the verifier is copied.

Risk and Threat Considerations

bcrypt reduces the payoff from password theft, but it does not remove the breach scenario itself. If an attacker gets the hash database, the remaining question is how much time and hardware they need to test guesses, and that depends heavily on salt quality, work factor, password strength, and whether the implementation has accidentally weakened the input path.

Failure mechanism: Attackers exploit a stolen hash store through offline cracking, then use any recovered passwords for account takeover, credential stuffing, or lateral access to other systems where users have reused the same password.

Impact: Weak parameters or bad handling can turn a single database exposure into a broader authentication compromise, especially when the same credentials are reused across business applications or administrative accounts.

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, CIS Controls v8 and OWASP ASVS set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
NIST SP 800-53 Rev 5IA-5 — Authenticator Managementbcrypt best practice depends on secure password verifier lifecycle and storage.
IA-2 — Identification and Authentication (Organizational Users)Password hashing supports user authentication for organizational accounts.
SC-12 — Cryptographic Key Establishment and ManagementWork-factor and hash protection are part of secure cryptographic protection handling.
Recommendation — Manage password verifiers so salts, rotation, and storage stay controlled. Require strong authenticators and store only protected password verifiers. Set cryptographic parameters conservatively and review them as hardware changes.
CIS Controls v8CIS-5 — Account ManagementPassword hashes are part of account credential management and lifecycle control.
Recommendation — Harden account credential storage and review password-related lifecycle controls.
OWASP ASVSV6 — Authenticationbcrypt is an authentication control used to protect password verification.
V11 — Cryptographybcrypt configuration and salt handling are cryptographic implementation concerns.
Recommendation — Use strong password hashing settings and constant-time verification where possible. Apply approved hashing parameters and protect verifiers against weak handling.

Practitioner Guidance

What to verify: Confirm that every password is salted uniquely, that the bcrypt cost factor is documented and reviewable, and that no code path truncates or transforms passwords before hashing. If you cannot explain those three points from source control or configuration, you do not really know how the system is protecting passwords.

Decision rule: If the current work factor no longer gives you an acceptable delay per guess on modern hardware, raise it in a controlled rollout and rehash on next login or via an explicit migration plan. If the system cannot support that without breaking authentication performance, treat that as a design constraint that must be addressed, not ignored.

Common mistake: Teams often focus on “using bcrypt” as a checkbox and overlook the surrounding lifecycle, especially hash storage permissions, input handling, and future cost tuning. Those are the parts that usually determine whether the implementation actually resists offline cracking.

Practitioner takeaway: bcrypt is effective when it is used as a maintained hashing control, with unique salts, a current work factor, and clean password handling, not as a one-time coding choice.

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