From cc45f18cb81028af284f4eb9e7f7c3d2f057fa46 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Tue, 12 May 2020 08:15:40 -0500 Subject: [PATCH] stream ciphers don't use IVs --- phpseclib/Crypt/Common/StreamCipher.php | 10 ++++++++++ phpseclib/Crypt/RC4.php | 11 ----------- phpseclib/Crypt/Salsa20.php | 10 ---------- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/phpseclib/Crypt/Common/StreamCipher.php b/phpseclib/Crypt/Common/StreamCipher.php index 00107803..bb176cfe 100644 --- a/phpseclib/Crypt/Common/StreamCipher.php +++ b/phpseclib/Crypt/Common/StreamCipher.php @@ -24,4 +24,14 @@ namespace phpseclib3\Crypt\Common; */ abstract class StreamCipher extends SymmetricKey { + /** + * Stream ciphers not use an IV + * + * @access public + * @return bool + */ + public function usesIV() + { + return false; + } } diff --git a/phpseclib/Crypt/RC4.php b/phpseclib/Crypt/RC4.php index 35efd30a..8d791f6c 100644 --- a/phpseclib/Crypt/RC4.php +++ b/phpseclib/Crypt/RC4.php @@ -161,17 +161,6 @@ class RC4 extends StreamCipher return parent::isValidEngineHelper($engine); } - /** - * RC4 does not use an IV - * - * @access public - * @return bool - */ - public function usesIV() - { - return false; - } - /** * Sets the key length * diff --git a/phpseclib/Crypt/Salsa20.php b/phpseclib/Crypt/Salsa20.php index ba60af6e..9d35dafa 100644 --- a/phpseclib/Crypt/Salsa20.php +++ b/phpseclib/Crypt/Salsa20.php @@ -107,16 +107,6 @@ class Salsa20 extends StreamCipher parent::__construct('stream'); } - /** - * Salsa20 does not use an IV - * - * @return bool - */ - public function usesIV() - { - return false; - } - /** * Salsa20 uses a nonce *