小编Mar*_*ark的帖子

什么是password_hash()替代(PHP 5 <5.5.0)?

根据手册:password_hash可以使用此功能(PHP 5 >= 5.5.0)

在寻找替代方法后,我从这里找到了这个简单的功能:http://www.sitepoint.com/password-hashing-in-php/

function generateHash($password) {
    if (defined("CRYPT_BLOWFISH") && CRYPT_BLOWFISH) {
        $salt = '$2y$11$' . substr(md5(uniqid(rand(), true)), 0, 22);
        return crypt($password, $salt);
    }
}
Run Code Online (Sandbox Code Playgroud)

我可以在使用function_exists前管理我的代码,但我的问题是关于上面的替代代码,如果它的安全与否,或者在旧版本的PHP中有没有其他选择?

php security passwords hash php-password-hash

14
推荐指数
2
解决办法
9399
查看次数

标签 统计

hash ×1

passwords ×1

php ×1

php-password-hash ×1

security ×1