Verify a bcrypt fixture and understand why fresh hashes differ
Admin ·
A bcrypt hash stores the variant, cost, salt and digest in one string. Check a fixture by verifying the exact password against that stored hash. A newly generated hash has a fresh salt, so comparing the generated strings would give the wrong test.
Reproduce a known match before debugging a test account
Choose Load verification example. The password is toolmellow-demo and the stored hash is shown below. Select Verify password to confirm the match. Check the result shows variant $2b$, cost 4 and 15 UTF-8 bytes. This fixture uses a low cost so it is quick to verify.
Change the sample password to Toolmellow-demo and verify again. Changing the capital letter results in a mismatch. Restore the original password and paste the entire 60-character hash if testing the pair elsewhere.
$2b$04$abcdefghijklmnopqrstuu5N9NoqE4DOlBZa.kgOG.hgaNxmYiMgKGenerate two fresh salts to test compatibility
Switch Operation to Generate a bcrypt hash, choose cost 10 and hash the public sample again. Save or copy the generated hash, then run it again without changing the password. The new result keeps the $2b$10$ prefix and changes the salt and digest.
Choose Use this hash for verification to move the current result into Verify one password. Both generated strings should verify with the original sample. Use the work factor configured for your test environment when reproducing an existing system. OWASP’s storage guidance treats bcrypt as a legacy option and prefers Argon2id for new systems.
bcrypt.js 3.0.3, implementation and UTF-8 input limitsOWASP Password Storage Cheat Sheet
Measure the 72-byte boundary with accented text
Paste 36 copies of the single character é in the password field and generate a hash at a low cost for the test. That input uses exactly 72 bytes. Add one more é and the generator rejects the 74-byte value, avoiding silent truncation.
Check Unicode if a password looks the same across two systems. A precomposed é takes two UTF-8 bytes. The sequence e followed by a combining acute accent takes three bytes. This tool encodes the text as entered. Match any normalization policy used by the system you are testing.
bcrypt.js 3.0.3, implementation and UTF-8 input limitsUnicode Standard Annex 15, Unicode normalization forms
Common questions
Can I compare bcrypt hash strings to test a password?
Use the verify operation with the original stored hash. Generating a new hash uses a fresh random salt, so its string will normally differ even for the same input.
Why does the tool reject a high-cost saved hash?
Verification uses the cost encoded in the hash. This browser workspace supports costs 4 through 16. Use a compatible local verifier for hashes outside that range.