🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
### key待验证 ``` <?php function urlsafe_b64decode($string) { $data = str_replace(array('-', '_'), array('+', '/'), $string); $mod4 = strlen($data) % 4; if ($mod4) { $data .= substr('====', $mod4); } return base64_decode($data); } function decode($final_message, $e_key, $i_key) { $enc_price = urlsafe_b64decode($final_message); $iv = substr($enc_price, 0, 16); $p = substr($enc_price, 16, 8); $sig = substr($enc_price, 24, 4); $price_pad = hash_hmac("sha1", $iv, $e_key, true); $price = $p ^ $price_pad; $conf_sig = hash_hmac("sha1", $price . $iv, $i_key, true); if ($conf_sig != $sig) { return false; } return $price; } $e_key = "encrypriceencodingwhenintegratin"; $i_key = "integpriceencodingwhenintegratin"; foreach(["cHJpY2VlbmNvZGluZ3doZTzUyMb2dirzYcjALQ", "cHJpY2VlbmNvZGluZ3doZTjUy8b2dirzYXcL0Q", "cHJpY2VlbmNvZGluZ3doZTzKyOjDQx_zjiVOmw", "cHJpY2VlbmNvZGluZ3doZTrN1vbBdirz1G52-Q"] as $msg) { echo decode($msg, $e_key, $i_key) . PHP_EOL; } ``` 附注:key生成方式 ``` // 转换一个字符串为byte数组 function getBytes($str){ $str = str_replace(PHP_EOL, '', $str); $bytes = array(); for ($i = 0; $i < strlen($str); $i++) { $bytes[] = ord($str[$i]); } return $bytes; } $e_key = base64_encode(implode('', getBytes('kingsoft'))); $i_key = base64_encode(implode('', getBytes('adx'))); ``` ``` 输出 XJwszwAM1ShpYgxpFjZCHnpjOT-uc5s7eH0PzA== 12 ```