Rev 1339 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1339 | Rev 1469 | ||
---|---|---|---|
Line 274... | Line 274... | ||
274 | // Version 3: BCrypt (or any other crypt) |
274 | // Version 3: BCrypt (or any other crypt) |
275 | $ok = password_verify($password, $passwordData); |
275 | $ok = password_verify($password, $passwordData); |
276 | } else if (strpos($passwordData, '$') !== false) { |
276 | } else if (strpos($passwordData, '$') !== false) { |
277 | // Version 2: SHA3-512 with salt |
277 | // Version 2: SHA3-512 with salt |
278 | list($salt, $hash) = explode('$', $passwordData, 2); |
278 | list($salt, $hash) = explode('$', $passwordData, 2); |
279 | $ok = hash_equals(sha3_512($salt.$password, true), base64_decode($hash)); |
279 | $ok = hash_equals(base64_decode($hash), sha3_512($salt.$password, true)); |
280 | } else { |
280 | } else { |
281 | // Version 1: SHA3-512 without salt |
281 | // Version 1: SHA3-512 without salt |
282 | $ok = hash_equals(sha3_512($password, true), base64_decode($passwordData)); |
282 | $ok = hash_equals(base64_decode($passwordData), sha3_512($password, true)); |
283 | } |
283 | } |
284 | if ($ok) return true; |
284 | if ($ok) return true; |
285 | } |
285 | } |
286 | 286 | ||
287 | return false; |
287 | return false; |