0

我想从 bcrypt 切换到 Argon2 加密。phpinfo() 返回可用的 ARGON2:

 SNIP
 '--with-iconv-dir=/Applications/MAMP/Library'
 '--with-sodium=/Applications/MAMP/Library'
 **'--with-password-argon2=/Applications/MAMP/Library'**
 '--disable-cgi' '--with-zip' '--with-xmlrpc' 
 SNAP

PHP 版本 7.4.9

根据文档,我编写了以下代码行:

$options = [  
    'memory_cost' => PASSWORD_ARGON2_DEFAULT_MEMORY_COST,  
    'time_cost' => PASSWORD_ARGON2_DEFAULT_TIME_COST,  
    'threads' => PASSWORD_ARGON2_DEFAULT_THREADS,  
];
// encrypt the user's password with the ARGON2 algorithm
try {
     $userPasswordHash = password_hash($password, PASSWORD_ARGON2ID, $options);
} catch (Exception $exp) {
     $error = $exp->getMessage();
}

我也尝试使用参数“PASSWORD_ARGON2I”......

这会在没有调用 catch 块的情况下转储。我怎样才能找出问题所在?

谢谢!

4

0 回答 0