aboutsummaryrefslogtreecommitdiff
path: root/ratatoeskr/sys/pwhash.php
diff options
context:
space:
mode:
authorLaria Carolin Chabowski <laria@laria.me>2020-04-26 21:03:08 +0200
committerLaria Carolin Chabowski <laria@laria.me>2020-04-26 21:13:51 +0200
commitade9edeb849803082856f7633194913ad4df93a0 (patch)
treea864c593f92851678d7ab9fe4e7e9cfdefb539c8 /ratatoeskr/sys/pwhash.php
parentc3cc300a952a793b9655226db1aad050daaa3803 (diff)
downloadratatoeskr-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.php12
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));
}