Bcrypt Hash Generator
Enter a password and a cost to create a hash, or paste a hash to test a password against it. Each step of cost doubles the work, so a higher cost takes longer.
Only the first 72 bytes of a password are used by bcrypt. A cost of 10 takes roughly a tenth of a second to a second here, and 14 can take many seconds.
Worked examples
A published test hash
Password "U*U", salt CCCCCCCCCCCCCCCCCCCCC., cost 5
$2a$05$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW
This is a vector from the reference implementation test suite.
About Bcrypt Hash Generator
Bcrypt is one of the standard ways to store passwords. It is deliberately slow, it adds a random salt so equal passwords give different hashes, and it has a cost setting that you raise as computers get faster. A stored hash carries the version, the cost and the salt, which is why a single string is enough to check a password later.
Use this page to make a hash for a fixture, a seed file or a configuration setting, or to test whether a password matches a hash you found in a database. Pick a cost from 4 to 14: each step doubles the work, so a cost of 10 does 1,024 rounds of the key setup and a cost of 12 does 4,096. Checking reads the cost and salt from the hash you paste, recomputes the hash and compares.
How to use Bcrypt Hash Generator
- Choose Create a hash or Check a password.
- Enter the password. To create, choose a cost. To check, paste the bcrypt hash.
- Press Run. Higher costs take longer.
- Copy the hash, or read whether the password matches.
Common uses
- Creating a hash to put in a seed file or test fixture
- Confirming that a hash in a database belongs to a known password
- Comparing how long different costs take
- Checking that a hash from another system is a valid bcrypt hash
Frequently asked questions
What does the cost mean?
It is the base 2 logarithm of the number of rounds, so cost 10 is 2 to the power 10 rounds. Each increase of one doubles the time it takes to compute or to guess.
Why is the hash different each time?
A fresh random salt is chosen for every hash. The salt is stored inside the hash, so checking still works.
What do $2a$, $2b$ and $2y$ mean?
They are versions of the same method that differ in how they handle rare edge cases. New hashes here use $2b$, and $2a$, $2b$ and $2y$ hashes are all checked. $2x$ came from a faulty implementation and is refused.
Is there a password length limit?
Bcrypt reads only the first 72 bytes of a password. Longer passwords are cut off, so two that share their first 72 bytes produce the same result.
Which cost should I use?
Choose the highest cost that keeps sign-in comfortably fast on your servers. A value of 10 to 12 is common today, and you should raise it over time.