PHP password_hash() 如何确定PHP_DEFAULT 使用哪种算法?

how PHP password_hash() determine using which algorithm by PHP_DEFAULT?

我在
阅读PHP文档时感到很困惑 http://php.net/manual/en/password.constants.php
PASSWORD_DEFAULT(整数)
如果未提供算法,则用于散列的默认算法。当支持更新、更强大的哈希算法时,这可能会在更新的 PHP 版本中发生变化。

我如何知道我的安装使用哪种算法?
我可以从 phpinfo() 知道吗?
我可以控制默认值吗?

How I know my installation use which algorithm?

查看手册。

来自您引用的页面:

Values for this constant:

  • PHP 5.5.0 - PASSWORD_BCRYPT

can I know it from the phpinfo()?

不(好吧,除了将其用作了解您正在使用的 PHP 版本的机制,然后与手册进行交叉引用)。


can I control the default?

不是没有分叉 PHP 并编译你自己的版本。

您无需担心默认使用哪种算法。 password_hash() 结果的前四个字符表示使用了哪种算法。当您使用 password_verify() 时,它会自动确定算法。