根据参数获取内部请求的HASH
string Core_HttpCall::get_hash( string $vars , string $rstr , int $mictime , $other )
参数列表
参数 类型 描述 默认值 $vars
string
$vars $rstr
string
$rstr $mictime
int
$port $other
unknown
string
private static function get_hash($vars, $rstr, $mictime, $other)
{
# 系统调用密钥
$system_exec_pass = Core::config('system_exec_key');
$key = Core::config()->get('system_exec_key', 'system', true);
// 每天更好动态密码
if (!$key || abs(TIME - $key['time'])> 86400)
{
$key = array
(
'str' => Text::random(null, 32),
'time' => TIME,
);
// 直接保存但不更新缓存,避免造成File操作死循环
if (!Core::config()->set('system_exec_key', $key, 'system', false))
{
throw new Exception(__('Updated dynamic password fails, check the server database and configuration'));
}
}
$other .= $key['str'];
if ($system_exec_pass && strlen($system_exec_pass) >= 10)
{
# 如果有则使用系统调用密钥
$hash = sha1($vars.$mictime.$system_exec_pass.$rstr.'_'.$other);
}
else
{
# 没有,则用系统配置和数据库加密
$hash = sha1($vars.$mictime.serialize(Core::config('core')).serialize(Core::config('database')).$rstr.'_'.$other);
}
return $hash;
}