password_hash equivalent for php 5.4?(php 5.4的password_hash等价物?)
问题描述
我使用安装了 php 5.5 的 XAMPP 开发了我的网站.我只是意识到我的主机只有 php 5.4(还不能更新到 5.5).我的问题是我不能使用新的 php 5.5 password_hash()
功能.php 5.4 是否有等效的盐散列方法?
I developed my site using XAMPP with php 5.5 installed. I just realize that my host only has php 5.4 (cannot update to 5.5 yet). My problem is that I cannot use the new php 5.5 password_hash()
feature. Is there an equivalent method for hashing with salt for php 5.4?
有没有办法让这个等效代码(如下)在 php 5.4 中工作?
Is there a way to get this equivalent code (below) to work in php 5.4?
$options = [
'salt' => uniqid(mt_rand(), true),
'cost' => 12
];
$hash = password_hash($mypassword, PASSWORD_DEFAULT, $options);
推荐答案
使用password_compat.这是一个向后兼容的库,用于模拟 password_hash()
在旧版本的 PHP (5.3.7+) 中.
Use password_compat. It's a backward compatible library to emulate password_hash()
in older versions of PHP (5.3.7+).
这篇关于php 5.4的password_hash等价物?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:php 5.4的password_hash等价物?
基础教程推荐
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- 在多维数组中查找最大值 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- 超薄框架REST服务两次获得输出 2022-01-01