Skip to content

Commit

Permalink
Use the binary parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
BurntimeX committed Nov 1, 2023
1 parent 03e8dc1 commit c52ab83
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function verify(
}
[$hash, $salt, $algo, $iterations, $length] = $parts;

return \hash_equals($hash, \hash_pbkdf2($algo, $password, $salt, $iterations, $length));
return \hash_equals($hash, \bin2hex(\hash_pbkdf2($algo, $password, $salt, $iterations, $length, true)));
}

/**
Expand All @@ -43,7 +43,7 @@ public function hash(
$algo = 'sha256';
$iterations = 600000;
$length = 32;
$hash = \hash_pbkdf2($algo, $password, $salt, $iterations, $length);
$hash = \bin2hex(\hash_pbkdf2($algo, $password, $salt, $iterations, $length, true));

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

0 comments on commit c52ab83

Please sign in to comment.