Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Ebert <ebert@woltlab.com>
  • Loading branch information
BurntimeX and dtdesign authored Oct 27, 2023
1 parent caf8783 commit 03e8dc1
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ public function verify(
string $hash
): bool {
$parts = \explode(':', $hash, 5);
$hash = $parts[0];
$salt = $parts[1];
$algo = $parts[2];
$iterations = $parts[3];
$length = $parts[4];
if (\count($parts) !== 5) {
return false;
}
[$hash, $salt, $algo, $iterations, $length] = $parts;

return \hash_equals($hash, \hash_pbkdf2($algo, $password, $salt, $iterations, $length));
}
Expand All @@ -46,7 +45,7 @@ public function hash(
$length = 32;
$hash = \hash_pbkdf2($algo, $password, $salt, $iterations, $length);

return implode(':', [$hash, $salt, $algo, $iterations, $length]);
return \implode(':', [$hash, $salt, $algo, $iterations, $length]);
}

/**
Expand Down

0 comments on commit 03e8dc1

Please sign in to comment.