From 06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 14 Nov 2023 14:47:55 +0100 Subject: Add function param/return types, fix a lot more phpstorm complaints --- inc/crypto.inc.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'inc/crypto.inc.php') 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'); -- cgit v1.2.3-55-g7522