1
1
Fork 0

basic diaspora decryption

This commit is contained in:
Friendika 2011-07-30 00:31:00 -07:00
commit a61ec584d6
2 changed files with 117 additions and 30 deletions

View file

@ -2969,4 +2969,19 @@ function generate_guid() {
$found = false;
} while ($found == true );
return $guid;
}
}
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);
}