Skip to content

Commit abc63f3

Browse files
authored
fix: correct order for hash_equals (#393)
1 parent 0541cba commit abc63f3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/JWT.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ private static function verify($msg, $signature, $key, $alg)
284284
case 'hash_hmac':
285285
default:
286286
$hash = \hash_hmac($algorithm, $msg, $key, true);
287-
return self::constantTimeEquals($signature, $hash);
287+
return self::constantTimeEquals($hash, $signature);
288288
}
289289
}
290290

@@ -420,8 +420,8 @@ private static function getKey($keyOrKeyArray, $kid = null)
420420
}
421421

422422
/**
423-
* @param string $left
424-
* @param string $right
423+
* @param string $left The string of known length to compare against
424+
* @param string $right The user-supplied string
425425
* @return bool
426426
*/
427427
public static function constantTimeEquals($left, $right)

0 commit comments

Comments
 (0)