mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-28 12:10:59 +00:00
Rijndael, TripleDES: $block not defined in these either
This commit is contained in:
parent
5f64ab67ab
commit
994c2c6c79
@ -900,12 +900,13 @@ class Crypt_Rijndael {
|
||||
$xor = $this->encryptIV;
|
||||
if (strlen($buffer['xor'])) {
|
||||
for ($i = 0; $i < strlen($plaintext); $i+=$block_size) {
|
||||
$block = substr($plaintext, $i, $block_size);
|
||||
if (strlen($block) > strlen($buffer['xor'])) {
|
||||
$xor = $this->_encryptBlock($xor);
|
||||
$buffer['xor'].= $xor;
|
||||
}
|
||||
$key = $this->_string_shift($buffer['xor'], $block_size);
|
||||
$ciphertext.= substr($plaintext, $i, $block_size) ^ $key;
|
||||
$ciphertext.= $block ^ $key;
|
||||
}
|
||||
} else {
|
||||
for ($i = 0; $i < strlen($plaintext); $i+=$block_size) {
|
||||
@ -1040,12 +1041,13 @@ class Crypt_Rijndael {
|
||||
$xor = $this->decryptIV;
|
||||
if (strlen($buffer['xor'])) {
|
||||
for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) {
|
||||
$block = substr($ciphertext, $i, $block_size);
|
||||
if (strlen($block) > strlen($buffer['xor'])) {
|
||||
$xor = $this->_encryptBlock($xor);
|
||||
$buffer['xor'].= $xor;
|
||||
}
|
||||
$key = $this->_string_shift($buffer['xor'], $block_size);
|
||||
$plaintext.= substr($ciphertext, $i, $block_size) ^ $key;
|
||||
$plaintext.= $block ^ $key;
|
||||
}
|
||||
} else {
|
||||
for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) {
|
||||
@ -1973,6 +1975,7 @@ class Crypt_Rijndael {
|
||||
|
||||
if (strlen($buffer["xor"])) {
|
||||
for ($i = 0; $i < $plaintext_len; $i+= '.$block_size.') {
|
||||
$block = substr($text, $i, '.$block_size.');
|
||||
if (strlen($block) > strlen($buffer["xor"])) {
|
||||
$in = $xor;
|
||||
'.$_encryptBlock.'
|
||||
@ -1980,7 +1983,7 @@ class Crypt_Rijndael {
|
||||
$buffer["xor"].= $xor;
|
||||
}
|
||||
$key = $self->_string_shift($buffer["xor"], '.$block_size.');
|
||||
$ciphertext.= substr($text, $i, '.$block_size.') ^ $key;
|
||||
$ciphertext.= $block ^ $key;
|
||||
}
|
||||
} else {
|
||||
for ($i = 0; $i < $plaintext_len; $i+= '.$block_size.') {
|
||||
@ -2008,6 +2011,7 @@ class Crypt_Rijndael {
|
||||
|
||||
if (strlen($buffer["xor"])) {
|
||||
for ($i = 0; $i < $ciphertext_len; $i+= '.$block_size.') {
|
||||
$block = substr($text, $i, '.$block_size.');
|
||||
if (strlen($block) > strlen($buffer["xor"])) {
|
||||
$in = $xor;
|
||||
'.$_encryptBlock.'
|
||||
@ -2015,7 +2019,7 @@ class Crypt_Rijndael {
|
||||
$buffer["xor"].= $xor;
|
||||
}
|
||||
$key = $self->_string_shift($buffer["xor"], '.$block_size.');
|
||||
$plaintext.= substr($text, $i, '.$block_size.') ^ $key;
|
||||
$plaintext.= $block ^ $key;
|
||||
}
|
||||
} else {
|
||||
for ($i = 0; $i < $ciphertext_len; $i+= '.$block_size.') {
|
||||
|
@ -669,6 +669,7 @@ class Crypt_TripleDES {
|
||||
$xor = $this->encryptIV;
|
||||
if (strlen($buffer['xor'])) {
|
||||
for ($i = 0; $i < strlen($plaintext); $i+=8) {
|
||||
$block = substr($plaintext, $i, 8);
|
||||
if (strlen($block) > strlen($buffer['xor'])) {
|
||||
$xor = $des[0]->_processBlock($xor, CRYPT_DES_ENCRYPT);
|
||||
$xor = $des[1]->_processBlock($xor, CRYPT_DES_DECRYPT);
|
||||
@ -676,7 +677,7 @@ class Crypt_TripleDES {
|
||||
$buffer['xor'].= $xor;
|
||||
}
|
||||
$key = $this->_string_shift($buffer['xor'], 8);
|
||||
$ciphertext.= substr($plaintext, $i, 8) ^ $key;
|
||||
$ciphertext.= $block ^ $key;
|
||||
}
|
||||
} else {
|
||||
for ($i = 0; $i < strlen($plaintext); $i+=8) {
|
||||
@ -882,6 +883,7 @@ class Crypt_TripleDES {
|
||||
$xor = $this->decryptIV;
|
||||
if (strlen($buffer['xor'])) {
|
||||
for ($i = 0; $i < strlen($ciphertext); $i+=8) {
|
||||
$block = substr($ciphertext, $i, 8);
|
||||
if (strlen($block) > strlen($buffer['xor'])) {
|
||||
$xor = $des[0]->_processBlock($xor, CRYPT_DES_ENCRYPT);
|
||||
$xor = $des[1]->_processBlock($xor, CRYPT_DES_DECRYPT);
|
||||
@ -889,7 +891,7 @@ class Crypt_TripleDES {
|
||||
$buffer['xor'].= $xor;
|
||||
}
|
||||
$key = $this->_string_shift($buffer['xor'], 8);
|
||||
$plaintext.= substr($ciphertext, $i, 8) ^ $key;
|
||||
$plaintext.= $block ^ $key;
|
||||
}
|
||||
} else {
|
||||
for ($i = 0; $i < strlen($ciphertext); $i+=8) {
|
||||
|
Loading…
Reference in New Issue
Block a user