You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
495 B
PHTML
22 lines
495 B
PHTML
2 years ago
|
<?php
|
||
|
|
||
|
declare(strict_types=1);
|
||
|
|
||
|
namespace App\Helper;
|
||
|
|
||
|
class Signer
|
||
|
{
|
||
|
public static function sign($params, $secretKey) {
|
||
|
$signString = $params['app_id'] . '&'
|
||
|
. $params['timestamp'] . '&'
|
||
|
. $params['nonce_str'] . '&'
|
||
|
. $params['data'] . '&'
|
||
|
. $secretKey;
|
||
|
return md5($signString);
|
||
|
}
|
||
|
|
||
|
public static function verify($params, $secretKey) {
|
||
|
$sign = self::sign($params, $secretKey);
|
||
|
return $sign == $params['sign'];
|
||
|
}
|
||
|
}
|