Bcrypt Verifier — Verify a Password Against a Bcrypt Hash
Understanding the Basics
Bcrypt password verification is the process of checking whether a plain-text password, when hashed with the salt embedded in a stored bcrypt hash, produces the same hash value. This is how every bcrypt-based authentication system validates login credentials without storing the plain-text password. The verification process extracts the algorithm version, cost factor, and 22-character salt directly from the stored hash string — because bcrypt hashes are self-contained and include all parameters needed for verification. It then computes the bcrypt hash of the candidate password using those extracted parameters and performs a constant-time comparison of the computed hash against the stored hash. The constant-time comparison is critical for security: a timing attack can recover information if the comparison short-circuits when the first differing byte is found. Bcrypt libraries always use constant-time comparison to prevent this. Understanding the difference between hashing (a one-way, salted, slow transformation) and verification (computing the hash and comparing) is fundamental to building secure authentication. Our tool demonstrates this verification process entirely in the browser, making it safe to test authentication logic with real (or test) hashes.
How to Use the Tool
- Enter the plain-text password to verify in the "Password" field.
- Enter the full bcrypt hash string (starting with $2b$, $2a$, or $2y$) in the "Hash" field.
- Click "Verify" — the tool extracts the cost factor and salt from the hash, recomputes the hash for your password, and compares using constant-time comparison.
- A green "✓ Password matches" indicator confirms a successful match; red "✗ Password does not match" indicates a mismatch.
- The cost factor and algorithm version embedded in the hash are displayed for informational purposes.
Key Features & Specifications
- Verifies passwords against bcrypt hashes using constant-time comparison (timing-attack safe)
- Supports $2a$, $2b$, and $2y$ bcrypt algorithm variants
- Extracts and displays the cost factor and salt embedded in the hash for debugging
- Shows estimated time the hash would take to brute-force at 10,000 guesses/second
- 100% browser-side using bcryptjs — sensitive passwords and hashes never leave your device
Frequently Asked Questions (FAQ)
- Q:What is the difference between $2a$, $2b$, and $2y$ bcrypt prefixes?
- $2a$ is the original bcrypt prefix with a known bug in how it handled high-bit characters. $2b$ is the corrected version introduced by OpenBSD bcrypt. $2y$ was created by PHP as a workaround for the same bug. In practice, $2b$ is the correct current prefix; most libraries treat all three identically on the verify side for backwards compatibility.
- Q:Can I use this to recover a forgotten password from a bcrypt hash?
- No. Bcrypt is a one-way function — it is computationally infeasible to reverse. The only way to "recover" a password from a bcrypt hash is by guessing: trying millions of candidates (dictionary attack) until one matches. This is precisely why bcrypt is used — its intentional slowness makes such attacks impractical for strong passwords.
- Q:My bcrypt verification returns false for a password I know is correct — why?
- Common causes: (1) the password is being truncated — bcrypt silently truncates passwords longer than 72 bytes; (2) different bcrypt library implementations have rare incompatibilities with non-ASCII passwords due to encoding differences (always use UTF-8); (3) the hash was generated with a pepper (additional server-side secret) that must be prepended/appended to the password before verification.