Skip to content

Commit b9a6b47

Browse files
committed
Use native functions when they exist.
1 parent 485d4cb commit b9a6b47

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Authentication/JWT.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ public static function verify($msg, $signature, $key, $method = 'HS256')
192192
case 'hash_hmac':
193193
default:
194194
$hash = hash_hmac($algo, $msg, $key, true);
195+
if (function_exists('hash_equals')) {
196+
return hash_equals($signature, $hash);
197+
}
195198
$len = min(self::safeStrlen($signature), self::safeStrlen($hash));
196199

197200
$status = 0;

0 commit comments

Comments
 (0)