需要的自行拿走有问题留言

function hashMiaoSpeed($token, $request) {
  $buildTokens = array_merge([$token], explode("|", trim(BUILDTOKEN)));

  $hasher = hash_init("sha512");
  hash_update($hasher, $request);

  foreach ($buildTokens as $t) {
    if ($t == "") {
      $t = "SOME_TOKEN";
    }

    $copy = hash_copy($hasher);
    hash_update($copy, $t);
    hash_update($copy, hash_final($hasher, true));
    $hasher = $copy;
  }

  $hash = hash_final($hasher, true);
  $hashUrlSafe = strtr(base64_encode($hash), '+/', '-_');

  return $hashUrlSafe;
}
最后修改:2023 年 05 月 04 日
如果觉得我的文章对你有用,请随意赞赏