Bcrypt Generator & Verifier
Hash passwords with bcrypt and verify passwords against existing hashes. Processing done server-side with PHP's password_hash().
Frequently Asked Questions
How Bcrypt Hashing Works
Bcrypt is a password-hashing function based on the Blowfish cipher, designed to be computationally expensive by design.
Generate Random Salt
PHP's password_hash() automatically generates a 128-bit (22 Base64-character) cryptographically random salt for every call. You never provide a salt manually — this prevents salt reuse vulnerabilities.
Expand Key Over 2^cost Rounds
The password and salt are fed into the EksBlowfishSetup key schedule, which is repeated 2cost times. At cost 12 that's 4,096 expensive key expansions — far slower than SHA-256 for an attacker.
Embed Metadata in Hash
The 60-character output encodes everything needed to verify: $2y$ (algorithm), 12$ (cost), 22-char salt, and 31-char digest. The salt is embedded, so verification needs only the hash string — never separate storage.
password_verify() — never compare bcrypt hashes with === or strcmp().Common Use Cases
User Password Storage
The primary use of bcrypt. Hash the password before inserting into the database — never store plaintext. On login, call password_verify($input, $storedHash). Even if the database is breached, the hashes resist cracking.
Migrating Weak Password Hashes
If your app uses MD5 or SHA-1 passwords, migrate to bcrypt on each successful login: verify the old hash, then immediately re-hash with bcrypt and store the new value. Use this tool to test the migration.
Cost Factor Tuning
Use this tool to benchmark different cost factors on your production hardware. Aim for 250ms–1s per hash. Move the cost slider and observe generation time to find the right balance between security and UX.
Verifying Stored Hashes
Use the Verify tab to confirm a password matches an existing bcrypt hash. Useful when debugging authentication issues or testing that a hash stored in the database was generated from the expected password.
API Key & Token Hashing
API keys can be stored as bcrypt hashes rather than plaintext. The user sees the key once at creation; the server stores only the hash and verifies on each request — minimizing exposure if the database is breached.
Security Auditing
Paste a hash from a database dump to verify its format ($2y$ vs older $2a$) and cost factor. A cost below 10 is considered underpowered by today's standards and should be re-hashed on next user login.