代码初始化

This commit is contained in:
2025-08-07 20:21:47 +08:00
commit 50f3a2dbb0
2191 changed files with 374790 additions and 0 deletions

31
extend/Yzh/Utils/Hmac.php Normal file
View File

@@ -0,0 +1,31 @@
<?php
namespace Yzh\Utils;
class Hmac
{
protected $mode = "sha256";
protected $app_key;
/**
* @param string $appKey
*/
public function __construct($appKey)
{
$this->app_key = $appKey;
}
/**
* @param string $data
* @param string $key
*/
public function sign($data): string
{
return hash_hmac($this->mode, $data, $this->app_key);
}
public function verify($data, $sign)
{
return $this->sign($data) == $sign;
}
}