瀏覽代碼

fix order of hash_equals

Maurits van der Schee 5 年之前
父節點
當前提交
8b3b0a4327
共有 1 個檔案被更改,包括 1 行新增5 行删除
  1. 1
    5
      api.php

+ 1
- 5
api.php 查看文件

@@ -7528,11 +7528,7 @@ namespace Tqdev\PhpCrudApi\Middleware {
7528 7528
             switch ($algorithm[0]) {
7529 7529
                 case 'H':
7530 7530
                     $hash = hash_hmac($hmac, $data, $secret, true);
7531
-                    if (function_exists('hash_equals')) {
7532
-                        $equals = hash_equals($signature, $hash);
7533
-                    } else {
7534
-                        $equals = $signature == $hash;
7535
-                    }
7531
+                    $equals = hash_equals($hash, $signature);
7536 7532
                     if (!$equals) {
7537 7533
                         return array();
7538 7534
                     }

Loading…
取消
儲存