Bcrypt Hash Generator — Securely Hash Passwords with Bcrypt
Understanding the Basics
Bcrypt is a password hashing function designed by Niels Provos and David Mazières and presented at USENIX 1999. It is based on the Blowfish symmetric cipher and was specifically engineered to be slow — intentionally computationally expensive — to resist brute-force and dictionary attacks. Unlike SHA-256 which can compute billions of hashes per second on modern GPUs, bcrypt's time complexity scales with a configurable "cost factor" (also called work factor or log rounds). At cost factor 10, bcrypt performs 2^10 = 1,024 iterations; at cost factor 12, it performs 4,096 iterations. Doubling the cost factor doubles the computation time, allowing the algorithm's difficulty to be tuned upward as hardware becomes faster. A bcrypt hash looks like: $2b$12$salt22characterbase64hashhashhashhashhash — the $2b$ prefix identifies the bcrypt algorithm version, 12 is the cost factor, the next 22 characters are the Base64-encoded random salt, and the remaining 31 characters are the hash. The salt is embedded in the hash output, so you never need to store it separately. Bcrypt is still the recommended password hashing algorithm in most security guidance, though Argon2id (winner of the 2015 Password Hashing Competition) is the current gold standard for new applications.
How to Use the Tool
- Enter the plain-text password you want to hash in the input field.
- Set the cost factor (work factor) using the slider — 10 is the default minimum; 12-14 is recommended for production systems; higher is more secure but slower.
- Click "Hash Password" — a cryptographically random 16-byte salt is generated and the bcrypt algorithm is applied.
- The resulting bcrypt hash string (60 characters starting with $2b$) appears in the output.
- Each click generates a different hash because a new random salt is used each time — both hashes are valid for the same password.
Key Features & Specifications
- Generates bcrypt hashes using the $2b$ variant (the most current and recommended version)
- Configurable cost factor from 4 (testing) to 15 (high security) with estimated computation time displayed
- Each hash generation uses a fresh cryptographically random 16-byte salt
- Time-to-hash display: shows how long the current cost factor takes on your device
- 100% browser-side using the bcryptjs library — passwords never sent to a server
Frequently Asked Questions (FAQ)
- Q:Why does bcrypt generate a different hash every time for the same password?
- A fresh cryptographically random 16-byte salt is generated before every hash operation. The salt is incorporated into the hashing algorithm and stored in the hash output. Two bcrypt hashes of the same password with different salts produce completely different output, which is by design — it prevents rainbow table attacks where precomputed hashes are used to crack passwords.
- Q:What cost factor should I use in production?
- OWASP recommends bcrypt with a cost factor that makes hashing take at least 1 second on your production server hardware. Test on your actual servers — a cost factor of 12 is common but hardware-dependent. A hash that takes 100ms is too fast (allows 10 guesses/second); one that takes 1–2 seconds is appropriate for login endpoints.
- Q:Is bcrypt still secure in 2024?
- Yes, bcrypt remains secure against practical attacks when used with a cost factor of 10 or higher. Its main limitations are: maximum password length of 72 bytes (longer passwords are silently truncated) and memory-hardness that is weaker than Argon2id (making GPU attacks easier). For new systems, Argon2id (RFC 9106) is preferred, but bcrypt is perfectly acceptable for existing deployments.