summaryrefslogtreecommitdiffstats
path: root/inc/crypto.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2023-11-14 14:47:55 +0100
committerSimon Rettberg2023-11-14 14:47:55 +0100
commit06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0 (patch)
tree7e5493b102074672d8cfd8fe1a61e49f080edbe8 /inc/crypto.inc.php
parentUpdate phpstorm config (diff)
downloadslx-admin-06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0.tar.gz
slx-admin-06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0.tar.xz
slx-admin-06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0.zip
Add function param/return types, fix a lot more phpstorm complaints
Diffstat (limited to 'inc/crypto.inc.php')
-rw-r--r--inc/crypto.inc.php5
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');