diff --git a/security.php b/security.php index c2f266a..07b87db 100644 --- a/security.php +++ b/security.php @@ -15,6 +15,10 @@ public static function encrypt($input, $key) { private static function pkcs5_pad ($text, $blocksize) { $pad = $blocksize - (strlen($text) % $blocksize); + if($pad == 0) { + // if text size is multiple of blocksize, then is added an extra block + $pad = $blocksize; + } return $text . str_repeat(chr($pad), $pad); }