parent
d127431303
commit
249d564821
|
@ -1028,7 +1028,7 @@ function des_encode($key, $text){
|
|||
return base64_encode($encrypted);
|
||||
}
|
||||
function pkcs5_unpad($text){
|
||||
$pad = ord($text{strlen($text)-1});
|
||||
$pad = ord($text[strlen($text)-1]);
|
||||
if ($pad > strlen($text)) return $text;
|
||||
if (strspn($text, chr($pad), strlen($text) - $pad) != $pad) return $text;
|
||||
return substr($text, 0, -1 * $pad);
|
||||
|
@ -1036,4 +1036,4 @@ function pkcs5_unpad($text){
|
|||
function pkcs5_pad($text, $block = 8){
|
||||
$pad = $block - (strlen($text) % $block);
|
||||
return $text . str_repeat(chr($pad), $pad);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue