- the ciphertext wasn't being null padded correctly when it wasn't a multiple of the block size (thanks Elledan!)

git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@139 21d32557-59b3-4da0-833f-c5933fad653e
This commit is contained in:
Jim Wigginton 2010-12-04 14:48:06 +00:00
parent 4ab5b5c16f
commit bf49338fa9

View File

@ -779,7 +779,7 @@ class Crypt_Rijndael {
if ($this->paddable) {
// we pad with chr(0) since that's what mcrypt_generic does. to quote from http://php.net/function.mcrypt-generic :
// "The data is padded with "\0" to make sure the length of the data is n * blocksize."
$ciphertext = str_pad($ciphertext, (strlen($ciphertext) + $this->block_size - 1) % $this->block_size, chr(0));
$ciphertext = str_pad($ciphertext, strlen($ciphertext) + ($this->block_size - strlen($ciphertext) % $this->block_size) % $this->block_size, chr(0));
}
$block_size = $this->block_size;