diff options
Diffstat (limited to 'inc/crypto.inc.php')
-rw-r--r-- | inc/crypto.inc.php | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/inc/crypto.inc.php b/inc/crypto.inc.php index d26a94ab..c82a5d82 100644 --- a/inc/crypto.inc.php +++ b/inc/crypto.inc.php @@ -10,8 +10,11 @@ class Crypto */ public static function hash6(string $password): string { + $bytes = Util::randomBytes(16); + if ($bytes === null) + ErrorHandler::traceError('Could not get random bytes'); $salt = substr(str_replace('+', '.', - base64_encode(Util::randomBytes(16))), 0, 16); + base64_encode($bytes)), 0, 16); $hash = crypt($password, '$6$' . $salt); if ($hash === null || strlen($hash) < 60) { ErrorHandler::traceError('Error hashing password using SHA-512'); |