gpt4 book ai didi

php - php password_hash 中允许的最大成本是多少?

转载 作者:行者123 更新时间:2023-12-02 20:06:02 25 4
gpt4 key购买 nike

PHP password_hash() 函数允许的最大成本是多少?

    $options = [
'cost' => 18,
];
$res = password_hash("donkey", PASSWORD_BCRYPT, $options);
var_dump($res);

到目前为止,我已经尝试过这些成本,而且时间正在迅速攀升。

  • 15 花费了大约 1.623... 秒
  • 18 花费了大约 12.756... 秒
  • 19 花费了大约 25.149... 秒
  • 20 花费了大约 51.215... 秒

我尝试使用 120 并得到:

Invalid bcrypt cost parameter specified

所以我知道有一个限制,但我没有在 PHP 文档中看到它。有谁知道这是什么吗?

最佳答案

wikipedia article about the bcrypt algorithm显示 31 是 cost 的最大值。

关于php - php password_hash 中允许的最大成本是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54629379/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com