← 所有 pwn.watch 安全工具

Bcrypt 生成器与哈希验证器
使用 bcrypt 以 4–12 的成本因子对密码进行哈希,查看耗时,将哈希拆解为版本、成本因子、盐值和校验和,并用密码验证任意 $2a$ / $2b$ / $2y$ 哈希。使用 bcryptjs 在浏览器中运行。
生成 bcrypt 哈希
Cost 10 (1,024 rounds) — recommended production baseline
Good balance between login speed and offline cracking resistance.
Cost factor benchmark guide
Each +1 increment in bcrypt cost doubles the key-setup iterations (2cost). Target ~200–300 ms on your production auth servers. For greenfield systems, OWASP also recommends Argon2id (memory-hard against GPU/ASIC cracking).
| Cost | Iterations | Native server | Browser JS | Rating | Guidance |
|---|---|---|---|---|---|
| 4 | 16 | < 1 ms | ~2 ms | Testing only | Unit tests & CI fixtures only; trivial to brute-force on GPUs. |
| 8 | 256 | ~15 ms | ~30 ms | Legacy | Below OWASP minimum; rehash on next login. |
| 10 | 1,024 | ~60–80 ms | ~120 ms | Recommended | OWASP 2026 baseline floor for interactive web logins. |
| 11 | 2,048 | ~120–160 ms | ~250 ms | Recommended | Balanced latency and brute-force resistance for modern APIs. |
| 12 | 4,096 | ~240–320 ms | ~500 ms | High security | Strong choice for admin/privileged accounts; noticeable pause in JS. |
| 13 | 8,192 | ~500 ms | ~1 s | Server-only | Use native C/Rust bcrypt on backend workers; watch login DoS limits. |
| 14 | 16,384 | ~1.0 s | ~2 s+ | Server-only | Offline / low-concurrency vaults; consider Argon2id for new apps. |
需要快速摘要,而不是密码哈希?试试 SHA-256 / HMAC 工具。
赞助内容
由以下赞助商呈现Tinkerer Club
为拥有自己的服务器、运行自己的 AI,并且每月软件开销为 0 美元的人打造的私人俱乐部。
Bcrypt 常见问题
- bcrypt 应该用多大的 cost factor?
- 选择能让登录哈希在生产硬件上耗时约 250 毫秒的最高 cost。2026 年常见默认值是 10;高价值账户通常用 12。每增加 1,计算量就翻倍。
- $2a$、$2b$ 和 $2y$ 分别是什么意思?
- 它们是 bcrypt 的版本前缀。$2b$ 是当前的 OpenBSD 版本,修复了 $2a$ 中的长度环绕漏洞。$2y$ 是 PHP 对修正版算法的称呼。大多数库在验证时都接受这三种前缀。
- bcrypt 哈希的结构是什么?
- $2b$10$ + 22 个字符的盐值 + 31 个字符的哈希,总计 60 个字符。盐值和哈希使用 bcrypt 自有的 Base64 字符集(./A-Za-z0-9)。
- bcrypt 对密码长度有限制吗?
- 有。只会使用 UTF-8 密码的前 72 个字节;超出的部分会被静默截断。发生截断时,工具会发出警告。
- 我的密码会发送到服务器吗?
- 不。哈希和验证都在浏览器中通过 bcryptjs(纯 JavaScript)运行。即便如此,也不要把正在使用的生产环境密码粘贴到任何网站。