sha1 (长度40字节)
$str = '203fpid';
sha1 = sha1(str);
echo $sha1.'<br>';
php sha256加密 (长度64)
$str = '203fpidf02lvj!!@#!';
sha256 = hash('sha256',str);
echo $sha256.'<br>';
/** 生成签名(哈希sha256 64位)
* @param $data
* @return false|string
*/
public function _sign($data){
data = array_filter(data);
ksort($data);
$temps = [];
foreach ($data as $key => $value) {
$temps[] = sprintf('%s=%s', $key, $value);
}
$signBefore = $this->app_secret.implode('&', $temps);
return hash('sha256',$signBefore);
}