密码加密在PHP [重复]

问题描述 投票:-4回答:1

这个问题在这里已有答案:

我正在构建纯php web应用程序,我目前正在使用md5方法来加密用户密码我想知道在纯php应用程序中加密密码的最佳方法是什么

php mysql
1个回答
0
投票
$hash = \password_hash($password, PASSWORD_DEFAULT);

if (\password_verify($password, $hash)) {
    // Authenticated.
    if (\password_needs_rehash($hash, PASSWORD_DEFAULT)) {
        // Rehash, update database.
    }
}

More info

© www.soinside.com 2019 - 2024. All rights reserved.