diff options
author | petko <petko@524c5546-5005-0410-9a3e-e25e191bd360> | 2023-05-08 09:10:18 +0000 |
---|---|---|
committer | petko <petko@524c5546-5005-0410-9a3e-e25e191bd360> | 2023-05-08 09:10:18 +0000 |
commit | 733e660521349b409aac265b19641eb907a1e31b (patch) | |
tree | 5c7f216f2823300a71b8ba9dd90b72951d7cc19d /pmwiki.php | |
parent | 9835577b151d6f681f86b3b7c02feb3407207fe8 (diff) | |
download | pmwiki.svn-733e660521349b409aac265b19641eb907a1e31b.tar.bz2 |
Add $PmCryptAlgo, pmcrypt() to call password_verify() if it exists.
git-svn-id: svn://pmwiki.org/pmwiki/trunk@4462 524c5546-5005-0410-9a3e-e25e191bd360
Diffstat (limited to 'pmwiki.php')
-rw-r--r-- | pmwiki.php | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -851,11 +851,17 @@ function cb_toupper($m) { return strtoupper($m[1]); } function cb_tolower($m) { return strtolower($m[1]); } function pmcrypt($str, $salt=null) { + global $PmCryptAlgo; + SDV($PmCryptAlgo, PASSWORD_DEFAULT); if ($salt && preg_match('/^(-?@|\\*$)/', $salt)) return false; - if (!is_null($salt)) return crypt($str, $salt); + if (!is_null($salt)) { + if(function_exists('password_verify')) + return password_verify($str, $salt); + return crypt($str, $salt); + } if (function_exists('password_hash')) - return password_hash($str, PASSWORD_DEFAULT); + return password_hash($str, $PmCryptAlgo); return crypt($str); } |