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.

21 lines
470 B
PHP

<?php
namespace Base\Tool;
class Sign
{
const SIGN_NAME = 'sign';
const SIGN_KEY = 'Wmtx_2019!@#API';
public static function generate($params, $signName = self::SIGN_NAME)
{
unset($params[$signName]);
ksort($params);
return md5(http_build_query($params) . self::SIGN_KEY);
}
public static function check($params, $signName = self::SIGN_NAME)
{
return self::generate($params) === $params[$signName];
}
}