Loading Techie Utils…

Bcrypt Hash Checker

Check whether a password matches a bcrypt hash. Free, and runs entirely in your browser — nothing you enter is uploaded, stored or sent to a server.

About Bcrypt Generator

bcrypt is a password hash built to be slow. Each hash runs 2^cost rounds of an expensive key setup, so checking one password takes a quarter of a second. For a login that is nothing; for an attacker trying billions of guesses it is everything. It has been the default in Rails, Laravel, Django's bcrypt option and most Node applications for over a decade.

Everything needed to check a password is in the hash itself. $2b$12$ says the variant and the cost, the next 22 characters are the random salt, and the last 31 are the result. That is why the same password gives a different hash every time, and why verifying needs only the password and the stored string.

Two details catch people out. bcrypt reads only the first 72 bytes of a password and silently ignores the rest, so the tool warns when a password is longer. And $2a$, $2b$ and $2y$ are the same algorithm with different labels: PHP and Apache's htpasswd write $2y$, OpenBSD and most other libraries $2b$.

Where it helps

  • Hashes and verifies in the browser with a salt from crypto.getRandomValues, so the password is never sent anywhere.
  • Warns when a password is over bcrypt's 72-byte limit, where the extra characters silently stop counting.
  • Writes $2a$, $2b$ or $2y$ to suit whatever will verify it, and writes ready-to-use htpasswd lines.
  • Reads the variant, cost, salt and checksum out of an existing hash, with the time each hash costs.

Limits

  • Hashing runs on this device, so a high cost is slow here in the same way it will be slow on your server. Costs above 15 are refused.
  • bcrypt is still sound, but for new systems Argon2id is the recommended choice: it is memory-hard as well as slow. The KDF tool makes Argon2id hashes.

Frequently asked questions

What cost should I use?

The highest that keeps one hash at around 250 ms to 1 second on your production servers. Today that is usually 12. Raise it as hardware gets faster, and rehash each user's password with the new cost the next time they log in.

Why is the hash different every time for the same password?

Each hash has its own random salt, stored in characters 8 to 29. That is deliberate: two users with the same password get different hashes, and a table of precomputed hashes is useless. Verification reads the salt back out of the stored hash.

Is $2y$ compatible with $2b$?

Yes. They are the same algorithm with identical output, labelled differently by PHP and OpenBSD. Most libraries accept all three prefixes; if one does not, changing the label is safe. The only prefix to worry about is $2x$, which marks hashes made by a buggy old PHP version and should be rehashed.

What happens to passwords longer than 72 bytes?

bcrypt ignores everything after the 72nd byte, so two long passwords with the same first 72 bytes hash the same. Non-ASCII characters take two to four bytes each, so the limit arrives sooner than a character count suggests. Pre-hash long input with SHA-256 and encode it, or use Argon2id.

Related tools

More Security & Cryptography tools

  • Hash Generator — SHA-2, SHA-3, BLAKE and legacy digests, in any encoding
  • MD5 Generator — MD5 digests, with a plain account of what they are still good for
  • HMAC Generator — Keyed message authentication codes
  • Key Derivation — Stretch a passphrase into key material with PBKDF2, scrypt or Argon2id
  • Password Generator — Strong random passwords with an entropy estimate
  • Password Strength — Judge a password by what an attacker would actually try
  • JWK Generator — A JSON Web Key for a JOSE algorithm, with its key set and thumbprint id
  • Key Pair Generator — RSA and elliptic-curve key pairs, generated in this tab and never sent
  • TOTP / HOTP Generator — Two-factor codes, the QR code to enrol with, and why one did not match
  • Text Encryption — AES-256-GCM with a PBKDF2 passphrase
  • Bcrypt Generator — Hash a password with bcrypt, verify one against a hash, or read what a hash is made of