From ade9edeb849803082856f7633194913ad4df93a0 Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Sun, 26 Apr 2020 21:03:08 +0200 Subject: Automatic code formatting --- ratatoeskr/sys/pwhash.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'ratatoeskr/sys/pwhash.php') diff --git a/ratatoeskr/sys/pwhash.php b/ratatoeskr/sys/pwhash.php index 78c3d33..3d3c589 100644 --- a/ratatoeskr/sys/pwhash.php +++ b/ratatoeskr/sys/pwhash.php @@ -19,7 +19,9 @@ */ class PasswordHash { - private function __construct() {} /* Prevent construction */ + private function __construct() + { + } /* Prevent construction */ private static $saltlen_min = 20; private static $saltlen_max = 30; @@ -29,8 +31,9 @@ class PasswordHash private static function hash($data, $salt, $iterations) { $hash = $data . $salt; - for($i = $iterations ;$i--;) + for ($i = $iterations ;$i--;) { $hash = sha1($data . $hash . $salt, (bool) $i); + } return $iterations . '$' . bin2hex($salt) . '$' . $hash; } @@ -48,8 +51,9 @@ class PasswordHash { $salt = ""; $saltlen = mt_rand(self::$saltlen_min, self::$saltlen_max); - for($i = 0; $i < $saltlen; $i++) - $salt .= chr(mt_rand(0,255)); + for ($i = 0; $i < $saltlen; $i++) { + $salt .= chr(mt_rand(0, 255)); + } return self::hash($password, $salt, mt_rand(self::$iterations_min, self::$iterations_max)); } -- cgit v1.2.3-54-g00ecf