Skip to content

Commit d32e101

Browse files
committed
fix order of hash_equals
1 parent 7da361d commit d32e101

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/Tqdev/PhpCrudApi/Middleware/JwtAuthMiddleware.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,7 @@ private function getVerifiedClaims(string $token, int $time, int $leeway, int $t
4646
switch ($algorithm[0]) {
4747
case 'H':
4848
$hash = hash_hmac($hmac, $data, $secret, true);
49-
if (function_exists('hash_equals')) {
50-
$equals = hash_equals($signature, $hash);
51-
} else {
52-
$equals = $signature == $hash;
53-
}
49+
$equals = hash_equals($hash, $signature);
5450
if (!$equals) {
5551
return array();
5652
}

0 commit comments

Comments
 (0)