mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-01-01 05:31:53 +00:00
DES: $block wasn't defined
This commit is contained in:
parent
c4b3288851
commit
5f64ab67ab
@ -656,12 +656,13 @@ class Crypt_DES {
|
|||||||
$xor = $this->encryptIV;
|
$xor = $this->encryptIV;
|
||||||
if (strlen($buffer['xor'])) {
|
if (strlen($buffer['xor'])) {
|
||||||
for ($i = 0; $i < strlen($plaintext); $i+=8) {
|
for ($i = 0; $i < strlen($plaintext); $i+=8) {
|
||||||
|
$block = substr($plaintext, $i, 8);
|
||||||
if (strlen($block) > strlen($buffer['xor'])) {
|
if (strlen($block) > strlen($buffer['xor'])) {
|
||||||
$xor = $this->_processBlock($xor, CRYPT_DES_ENCRYPT);
|
$xor = $this->_processBlock($xor, CRYPT_DES_ENCRYPT);
|
||||||
$buffer['xor'].= $xor;
|
$buffer['xor'].= $xor;
|
||||||
}
|
}
|
||||||
$key = $this->_string_shift($buffer['xor'], 8);
|
$key = $this->_string_shift($buffer['xor'], 8);
|
||||||
$ciphertext.= substr($plaintext, $i, 8) ^ $key;
|
$ciphertext.= $block ^ $key;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for ($i = 0; $i < strlen($plaintext); $i+=8) {
|
for ($i = 0; $i < strlen($plaintext); $i+=8) {
|
||||||
@ -845,12 +846,13 @@ class Crypt_DES {
|
|||||||
$xor = $this->decryptIV;
|
$xor = $this->decryptIV;
|
||||||
if (strlen($buffer['xor'])) {
|
if (strlen($buffer['xor'])) {
|
||||||
for ($i = 0; $i < strlen($ciphertext); $i+=8) {
|
for ($i = 0; $i < strlen($ciphertext); $i+=8) {
|
||||||
|
$block = substr($plaintext, $i, 8);
|
||||||
if (strlen($block) > strlen($buffer['xor'])) {
|
if (strlen($block) > strlen($buffer['xor'])) {
|
||||||
$xor = $this->_processBlock($xor, CRYPT_DES_ENCRYPT);
|
$xor = $this->_processBlock($xor, CRYPT_DES_ENCRYPT);
|
||||||
$buffer['xor'].= $xor;
|
$buffer['xor'].= $xor;
|
||||||
}
|
}
|
||||||
$key = $this->_string_shift($buffer['xor'], 8);
|
$key = $this->_string_shift($buffer['xor'], 8);
|
||||||
$plaintext.= substr($ciphertext, $i, 8) ^ $key;
|
$plaintext.= $block ^ $key;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for ($i = 0; $i < strlen($ciphertext); $i+=8) {
|
for ($i = 0; $i < strlen($ciphertext); $i+=8) {
|
||||||
|
Loading…
Reference in New Issue
Block a user