Password Hash Verifier
生成密码哈希,校验既有哈希是否还对得上
浏览器内实现 bcrypt、Argon2id、scrypt、PBKDF2-SHA256,不依赖外部库与网络。可生成 PHC 字符串、校验登录哈希、解析参数并给出强度体检,密码不出本机。
生成哈希
等待生成尚未生成。选择算法后点“生成”。
生成会占用本机 CPU,Argon2id 在 m=19456 时约 1 秒,bcrypt cost=12 时约 1 秒。
校验哈希
粘贴数据库里的哈希校验不会上传密码,也不会修改数据库。
| 字段 | 值 |
|---|
哈希指纹识别
0 行把导出的一列密码字段粘进来,先判断它到底是什么:PHC 家族、phpass、crypt(3)、裸 MD5/SHA 十六进制,还是根本没哈希。识别只做格式判断,不推断内容。
| # | 识别结果 | 强度 | 迁移建议 |
|---|---|---|---|
| 尚未识别。 | |||
口令强度评估
未评估在生成哈希之前先看密码本身够不够。评估按长度、字符集、常见弱口令片段、键盘序列与重复模式打分,纯本地规则,不联网比对。
- 评估后会列出长度、字符集与模式命中项。
批量校验
分片异步0 行等待开始。分片执行,每 3 条让出一次主线程,页面不会卡死。
| # | 算法 | 结果 | 说明 |
|---|
合规对照
按当前哈希同一份参数在不同标准下结论不同。这里按 NIST SP 800-63B、OWASP、FIPS 140-3、PCI DSS 4.0 与等保 2.0 的公开口径给出对照,只做技术判断,不替代合规评估。
| 标准 | 结论 | 依据 |
|---|---|---|
| 先生成或粘贴一条哈希,再点“生成合规对照”。 | ||
实战检查清单
交付前逐条过- 上线前用真实流量压测登录接口,确认 P95 延迟在团队可接受区间,而不是只看单机 benchmark。
- 把“改密即重算哈希”写进流程:老哈希在用户下次登录成功时透明 rehash,避免一次性批量重算压垮数据库。
- 哈希列长度按算法上限留足:bcrypt 60、Argon2id 96+、PBKDF2 1024 的十六进制形式要 256。
- 禁止在日志、埋点、错误上报里记录密码或哈希原文;异常栈里出现哈希同样算泄露。
- 数据库迁移时用同一份盐重算会得到不同结果,校验必须走原哈希,不能“重算后比对”。
- 对同一账号的连续失败做指数退避,并在 5 次后触发验证码,哈希强度再高也挡不住在线撞库。
- 多因子与哈希是两件事:TOTP/WebAuthn 不能替代强哈希,强哈希也不能替代二次验证。
- 定期复核参数:CPU 每换代一次就把 bcrypt cost +1 或 Argon2 内存 +25%,并用本工具实测耗时。
算法决策表
按场景选| 场景 | 推荐 | 理由 |
|---|---|---|
| PHP 存量系统 | bcrypt cost 12 | password_hash 原生支持,迁移成本最低 |
| 新系统、内存充足 | Argon2id m=47104,t=1,p=1 | 抗 GPU、抗侧信道,OWASP 首选 |
| 共享主机、内存受限 | bcrypt cost 10-11 | 单次内存仅 4KB,不触发配额 |
| FIPS / 合规要求 | PBKDF2-SHA256 600000 | 标准库普遍内置,审计口径明确 |
| 需要固定内存上限 | scrypt N=32768,r=8,p=1 | 内存 = 128×r×N,可精确预估 |
| 侧信道敏感硬件 | Argon2i | 数据无关寻址,执行时间可预测 |
决策表给的是起点,不是结论。最终参数必须用本机实测耗时校验,落在 100-500 ms 区间才算合适。
一密多哈希匹配
0 行一个密码对多条哈希:常用于判断同一口令被哪些账号复用。逐行校验,命中的行会标出行号与算法。
最多 50 条;Argon2 单条接近 1 秒,条数多时请分批。
| 行号 | 算法 | 结果 | 耗时 |
|---|
参数校准
未测量先在本机测一次实际耗时,再按目标时延外推参数。不同机型差 2-5 倍,照抄参数是最常见的性能事故来源。
| 目标时延 | 建议参数 | 预估耗时 |
|---|
迁移片段
登录时透明升级按当前哈希与目标参数生成重算代码:PHP 用 password_needs_rehash,SQL 只给模板,执行前先在事务里试跑。
生成后会显示可直接粘贴的代码片段。
参数体检
未体检- 校验或生成一次哈希后,这里会列出参数是否符合当前推荐基线。
算法基线体检
0 行按 OWASP 口令存储基线与 NIST SP 800-63B 比对每条哈希的实际参数,并给出与 PHP password_needs_rehash() 等价的结论。只读哈希字符串,不需要密码。
| # | 算法 | 参数 | 结论 | 需重哈希 | 说明 |
|---|---|---|---|---|---|
| 尚未体检。 | |||||
基线:bcrypt cost ≥ 10(推荐 12);Argon2id m ≥ 19456 KiB 且 t ≥ 2;scrypt N ≥ 32768;PBKDF2-HMAC-SHA256 ≥ 600000 次。
点“生成迁移计划”,按“保留 / 登录时透明升级 / 强制重置”三类动作给出逐条计划。
哈希库体检(批量盘点)
0 行把数据库导出的哈希一列粘进来,一次看清算法分布、弱参数占比和升级优先级,结果可导出 CSV 交给运维排期。
尚未盘点。
| 行号 | 算法 | 关键参数 | 等级 | 处理建议 |
|---|
推荐基线
2026 常见口径| 算法 | 最低可用 | 推荐 |
|---|---|---|
| bcrypt | cost ≥ 10 | cost 12(成本随硬件上调) |
| Argon2id | m=19456,t=2,p=1 | m=47104,t=1,p=1 或 m=19456,t=2 |
| scrypt | N=16384,r=8,p=1 | N=32768,r=8,p=1 |
| PBKDF2-SHA256 | 600000 次 | 600000 次以上(OWASP) |
哈希只解决“存库不落明文”。登录接口仍需限流、失败锁定与二次验证,否则再强的参数也挡不住在线撞库。
边界说明
如实标注- bcrypt 只取密码前 72 字节,超长部分被忽略;Argon2id 与 scrypt 无此限制。
- 纯 JS 实现比服务端原生库慢,参数按本机实测耗时选择,不要照抄别人的数字。
- 生成的是随机盐,同一密码每次结果都不同,属正常现象。
- 本工具不存储、不上传密码与哈希,关闭页面即清空。
How to Use
📖 What it does
It is rarely obvious from a database column whether the stored value is bcrypt or Argon2id, whether the cost setting still matches current hardware, and whether hashes written by the previous framework will still verify after a migration.
This page implements bcrypt (Blowfish), Argon2id (Blake2b compression), scrypt (Salsa20/8) and PBKDF2-SHA256 in plain JavaScript. It can mint a fresh PHC string and it can take a stored hash plus a candidate password and tell you whether they match.
Everything runs on your machine: passwords and hashes never leave the browser tab. The trade-off is speed, because pure JavaScript is slower than a native library, so treat the timing numbers as a property of this device rather than of your server.
✨ Features
- Generate bcrypt ($2b$, cost 4 to 15), Argon2id (m, t and p configurable), scrypt (N, r, p) and PBKDF2-SHA256 hashes as standard PHC strings.
- Verify an existing hash by pasting it in: $2a$, $2b$ and $2y$, $argon2id$, $scrypt$, $pbkdf2-sha256$ and Django pbkdf2_sha256$ notations are recognised automatically.
- Parse the structure of a hash and list algorithm, cost, memory, iteration count, salt length, digest length and the raw salt, which is what you need when comparing migration output.
- Grade parameters A to D against current baselines for bcrypt cost, Argon2id memory and passes, scrypt memory footprint and PBKDF2 iterations, together with the measured time on this machine.
- Batch verification takes one hash and one password per line, separated by a tab, up to 200 rows, and exports the verdicts as CSV for a migration record.
- Compare digests in constant time so response timing does not leak how much of a digest matched, and report failures without exposing internal detail.
- Copy or download the generated values; salts come from crypto.getRandomValues on every run, so two generations of the same password differ by design.
- State the limits honestly: bcrypt consumes only the first 72 bytes, Argon2i and Argon2d are not claimed as supported, and the JavaScript implementation is slower than a native one.
- Argon2i and Argon2d are now verified and generated for real: data-independent and data-dependent addressing are implemented separately and match the reference implementation byte for byte.
- A hash inventory view parses a whole column of hashes at once, reports the algorithm and parameter distribution plus the share of weak parameters, and exports a prioritised CSV.
- An algorithm decision table maps legacy PHP, memory-constrained hosts and compliance requirements to starting parameters, with a reminder to confirm timing on your own machine.
- A one-password-many-hashes check verifies up to fifty hashes against a single password, marking the line number and algorithm of every hit to expose password reuse.
- Calibration measures one real bcrypt or Argon2id hash on this machine, then extrapolates suggested parameters and predicted timings for 250 ms and 500 ms targets.
- Migration snippets cover a transparent password_needs_rehash upgrade inside a PHP login and a SQL template for widening the column and backfilling with an optimistic lock.
- A compliance view maps the current hash to NIST SP 800-63B, OWASP, FIPS 140-3, PCI DSS 4.0 and China MLPS level 3, with a PASS, conditional or FAIL verdict and the reason.
- An audit summary JSON export records algorithm, parameters, grade and compliance verdicts without the password, hash or salt.
- Batch verification now runs in slices that yield every 40 ms, with progress and a stop button, so two hundred rows no longer freeze the page.
- A hash fingerprint pass separates PHC families, phpass, crypt(3), Apache MD5 and bare MD5/SHA hex digests, with a risk label and a migration note.
- A password strength check scores length, character classes, common weak strings, keyboard runs and repeats before you hash anything.
- Optional pepper support pre-hashes with SHA-256(pepper + password) before the KDF, which also sidesteps the 72-byte bcrypt limit.
- Fixed a broken export: the audit summary JSON referenced an undefined version constant and threw on click.
- A parameter baseline audit compares every hash against OWASP storage guidance and NIST SP 800-63B, grading each one pass, low or fail.
- A password_needs_rehash equivalent answers whether a hash must be recomputed for bcrypt cost 12, Argon2id m=19456 t=2, scrypt N>=32768 or PBKDF2 >=600000.
- A migration plan groups rows into keep, upgrade-on-login and force-reset, with reasons, target parameters and an execution order, exportable as CSV.
🚀 How to use it
- Choose an algorithm in the generate panel and type a password; set cost for bcrypt, m, t and p for Argon2id, or N, r and p for scrypt.
- Press Generate to get the PHC string and the elapsed time; a different result for the same password each time is the random salt doing its job.
- To check a stored hash, paste it into the verify panel, type the password a user would submit and press Verify.
- Read the audit grade and its findings to decide whether the cost or memory setting needs raising the next time that user signs in.
- For a batch, paste hash-tab-password lines, run the batch and export the CSV so the migration decisions are documented.
⚠️ Before you rely on it
- bcrypt silently ignores everything past the first 72 bytes, so long passphrases belong on Argon2id instead.
- Argon2id at m=19456 takes roughly half a second here and PBKDF2 at 600000 iterations several seconds; that is expected for pure JavaScript.
- Baselines move with hardware. Measure the round trip on the target server before shipping and aim for 50 to 500 milliseconds.
- Hashing protects storage only; the login endpoint still needs rate limiting, lockout and a second factor to stop online guessing.
- Never paste production hashes into a public channel. This page does not upload them, but extensions and screen recording can still leak them.
- Hashes in Argon2i or Argon2d form are reported as unsupported rather than guessed, so you never get a confidently wrong answer.