是否值得一遍又一遍地重新密码?

时间:2011-07-03 20:33:00

标签: php security hash cryptography passwords

  

可能重复:
  Is “double hashing” a password less secure than just hashing it once?

通过这样做可以获得什么?它会减慢散列...是否会自动降低以某种方式从散列中找出密码的可能性?

$password = '123456';

$iterations = 8;

$is_first = true;
for ($i = 0; $i < $iterations; ++$i) {
    if ($is_first === true) {

        $hashed_password = hash('sha256', $password);

    } else {

        $hashed_password = hash('sha256', $hashed_password);

    }

    $is_first = false;
}

如果答案是肯定的......有多少次迭代是可选的?

您会推荐哪些其他改善密码安全性的方法(盐和花生除外)?

1 个答案:

答案 0 :(得分:1)

缓慢散列良好

如果敌人获得了您的密码哈希值,您希望他被迫花费很长时间来尝试每个哈希值。

相关问题