bcrypt
What Is bcrypt?
bcrypt is a password-hashing function that turns a password into a one-way value for safe storage in software databases. It was derived from Blowfish and is designed to make password guessing slow. bcrypt hashes, not encrypts, so a stored hash cannot be decrypted or “unhashed” into the original password.
How bcrypt Password Hashing Works
A login system stores a hash, never the plaintext password.
- Receive the password through a TLS-protected connection.
- Generate a unique random salt for that password.
- Run bcrypt with the password, salt, and selected cost factor.
- Store the resulting formatted hash, which includes its salt and settings.
- At sign-in, use the stored hash to verify the submitted password.
Why bcrypt Is Useful for Password Storage
bcrypt addresses common password-storage risks.
- Unique salts mean identical passwords produce different stored hashes.
- Its deliberately slow work makes large-scale guessing more expensive.
- The cost factor can increase as servers become faster.
- Mature libraries support it across common programming languages.
- Built-in salts reduce the value of precomputed hash tables.
bcrypt vs SHA-256, MD5, and Argon2
Fast general-purpose hashes are not standalone password-storage tools.
| Method | Design | Best use |
|---|---|---|
| bcrypt | Slow, CPU-focused, salted | Established password storage |
| SHA-256 | Fast general-purpose hash | Integrity checks, not passwords alone |
| MD5 | Fast and cryptographically broken | Not password storage |
| Argon2id | Memory-hard password hash | Modern new systems |
Practical Limits of bcrypt
bcrypt remains usable, but teams should understand its boundaries.
- It is CPU-focused rather than memory-hard like Argon2id.
- Higher costs add sign-in delay and require capacity testing.
- Many implementations only process the first 72 bytes of a password.
- Version prefixes and library behavior require compatibility testing.
- Rate limits are still needed to prevent login abuse.
How to Choose a bcrypt Cost Factor
There is no universal production setting.
- Benchmark hashing on production-like infrastructure.
- Select a delay acceptable for legitimate sign-ins.
- Load-test concurrent login requests.
- Keep the cost embedded in every stored hash.
- Raise the cost gradually when users successfully log in.
Secure bcrypt Implementation Practices
bcrypt protects stored passwords, not the whole authentication system.
- Use a vetted library and its built-in verification API.
- Allow the library to create unique salts automatically.
- Use TLS, MFA, rate limiting, and failed-login monitoring.
- Never log passwords or store them in plaintext.
- Protect password-reset tokens as carefully as passwords.
bcrypt in Applications Built with Emergent
Authentication deserves review in every full-stack product. Teams using an AI app builder should confirm that their application stores bcrypt hashes rather than plaintext, then test registration, login, reset, and lockout behavior. Sound app design and development includes these checks, alongside the concepts in the software glossary. Build safer login flows with Emergent.
on Emergent today

