Skip to content

Commit

Permalink
针对招行的补丁处理
Browse files Browse the repository at this point in the history
  • Loading branch information
lpilp committed Sep 23, 2022
1 parent 0dfd45a commit 3af1566
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/util/FormatSign.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ public function run($sign)
*/
public function format_cmbc($sign){
list($binR, $binS) = $this->_decode_rs(base64_decode($sign));
if(strlen($binR)<32){
while(strlen($binR)<32){
$binR = chr(0).$binR;
}
if(strlen($binS)<32){
while(strlen($binS)<32){
$binS = chr(0).$binS;
}
$lenR = strlen($binR);
Expand All @@ -39,14 +39,18 @@ public function format_cmbc($sign){
}
private function _trim_int_pad($binStr)
{
if (ord($binStr[0]) > 0) {
return $binStr;
} else {
if (ord($binStr[1]) <= 127) {
return substr($binStr, 1);
}
return $binStr;
// echo bin2hex($binStr)."\n";
//trim 0
while(ord($binStr[0])==0){
$binStr = substr($binStr,1);
}
// add 0 if necessary
if(ord($binStr[0])>127){
$binStr = chr(0).$binStr;
}
// echo bin2hex($binStr)."\n";
return $binStr;

}
private function _decode_rs($binSign)
{
Expand Down

0 comments on commit 3af1566

Please sign in to comment.