跳到主要内容
uencoder

Hash password 和验证它 稍后无 storing plaintext

Use 慢 password-哈希函数 (bcrypt/PBKDF2/scrypt) 到存储 salted hash, 然后验证候选 password 针对它.

  1. 1

    从不存储 passwords 在 plaintext 或具有快 hashes (MD5/SHA-256) — 它们是 trivially brute-forced. Use 慢, salted KDF (bcrypt, scrypt, PBKDF2) 该 deliberately costs CPU/内存 per attempt, making bulk cracking infeasible.

  2. 2
    bcrypt 哈希生成器 →

    Enter password 和成本因子 (10-12 为交互, 12-14 为 sensitive). tool 输出 self-describing hash containing algorithm, 成本, salt, 和 digest.

  3. 3
    哈希对比器 →

    到验证: enter 候选 password 和 stored bcrypt hash. tool re-hashes 具有 embedded salt 和成本和 compares 在常量时间 — returns 真/假无 revealing timing 信息.

  4. 4

    Use hash-and-验证链接到 测试完整 lifecycle: hash password, 然后验证正确和 不正确候选在 one 通过.

常见问题

为什么 can't I use SHA-256 为 password 哈希?
SHA-256 是快 — GPU 能够计算 billions per 第二. bcrypt/scrypt 是 deliberately 慢和 内存-困难, making 每个 guess 成本 milliseconds. 此 asymmetry 是什么 protects 慢 hashes 针对离线 brute force.
什么成本因子应该 I 选择?
Choose highest 成本该 仍然 meets 你的延迟 budget. 为 bcrypt, 成本 10 takes ~100ms, 成本 12 ~400ms, 成本 14 ~1.6s. Increase 成本 as hardware speeds 上 — hash embeds 成本所以旧 hashes 仍然验证.

解决此任务的工作流

相关工具