diff options
author | Laria Carolin Chabowski <laria@laria.me> | 2020-04-26 21:03:08 +0200 |
---|---|---|
committer | Laria Carolin Chabowski <laria@laria.me> | 2020-04-26 21:13:51 +0200 |
commit | ade9edeb849803082856f7633194913ad4df93a0 (patch) | |
tree | a864c593f92851678d7ab9fe4e7e9cfdefb539c8 /ratatoeskr/sys/pwhash.php | |
parent | c3cc300a952a793b9655226db1aad050daaa3803 (diff) | |
download | ratatoeskr-cms-ade9edeb849803082856f7633194913ad4df93a0.tar.gz ratatoeskr-cms-ade9edeb849803082856f7633194913ad4df93a0.tar.bz2 ratatoeskr-cms-ade9edeb849803082856f7633194913ad4df93a0.zip |
Automatic code formatting
Diffstat (limited to 'ratatoeskr/sys/pwhash.php')
-rw-r--r-- | ratatoeskr/sys/pwhash.php | 12 |
1 files changed, 8 insertions, 4 deletions
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)); } |