Files
jyshd_mWtK2/addons/kefu/library/WechatCrypto/SHA1.php
T
li 1b24994e74 feat: 后端全量更新 - 含所有本次需求
- Contract.php: 返回合约账户余额(balance_contract)
- My.php: 地址管理增加BTC/ETH
- AppContract.php: 一键平仓(closeall)
- AppProxy.php: 代理专属注册链接 + 分级权限(L1/L2)
- site.php: 手续费减半(0.018→0.009)
- agent_permission_setup.sql: 代理权限SQL
- crypto_news_crawler.py: 新闻自动采集脚本
2026-03-30 20:16:32 +08:00

38 lines
847 B
PHP
Executable File

<?php
namespace addons\kefu\library\WechatCrypto;
use addons\kefu\library\WechatCrypto\ErrorCode;
/**
* SHA1 class
*
* 计算公众平台的消息签名接口.
*/
class SHA1
{
/**
* 用SHA1算法生成安全签名
* @param string $token 票据
* @param string $timestamp 时间戳
* @param string $nonce 随机字符串
* @param string $encrypt 密文消息
*/
public function getSHA1($token, $timestamp, $nonce, $encrypt_msg)
{
//排序
try {
$array = [$encrypt_msg, $token, $timestamp, $nonce];
sort($array, SORT_STRING);
$str = implode($array);
return [ErrorCode::$OK, sha1($str)];
} catch (Exception $e) {
//print $e . "\n";
return [ErrorCode::$ComputeSignatureError, null];
}
}
}
?>