mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-26 11:37:33 +00:00
- keys should now be null padded if they're too short
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@136 21d32557-59b3-4da0-833f-c5933fad653e
This commit is contained in:
parent
fb0f03c904
commit
4d4cc0e0f5
@ -362,7 +362,7 @@ class Crypt_DES {
|
||||
*/
|
||||
function setKey($key)
|
||||
{
|
||||
$this->keys = ( CRYPT_DES_MODE == CRYPT_DES_MODE_MCRYPT ) ? substr($key, 0, 8) : $this->_prepareKey($key);
|
||||
$this->keys = ( CRYPT_DES_MODE == CRYPT_DES_MODE_MCRYPT ) ? str_pad(substr($key, 0, 8), 8, chr(0)) : $this->_prepareKey($key);
|
||||
$this->changed = true;
|
||||
}
|
||||
|
||||
|
@ -532,7 +532,7 @@ class Crypt_Rijndael {
|
||||
*/
|
||||
function setKey($key)
|
||||
{
|
||||
$this->key = $key;
|
||||
$this->key = str_pad(substr($key, 0, $this->key_size), $this->key_size, chr(0));
|
||||
$this->changed = true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user