recover padding functions which are still used

This commit is contained in:
friendica 2013-07-24 17:07:45 -07:00
parent 30da632878
commit f92266d804

View File

@ -18,6 +18,21 @@ function rsa_verify($data,$sig,$key,$alg = 'sha256') {
}
function pkcs5_pad ($text, $blocksize)
{
$pad = $blocksize - (strlen($text) % $blocksize);
return $text . str_repeat(chr($pad), $pad);
}
function pkcs5_unpad($text)
{
$pad = ord($text{strlen($text)-1});
if ($pad > strlen($text)) return false;
if (strspn($text, chr($pad), strlen($text) - $pad) != $pad) return false;
return substr($text, 0, -1 * $pad);
}
function AES256CBC_encrypt($data,$key,$iv) {
return mcrypt_encrypt(
MCRYPT_RIJNDAEL_128,