mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-09-28 15:19:02 +00:00
- 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:
parent
4ab5b5c16f
commit
bf49338fa9
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user