mirror of
https://github.com/danog/phpseclib.git
synced 2024-12-12 09:09:39 +01:00
move more common elements to StreamCipher class
This commit is contained in:
parent
995bf77315
commit
f780640ecf
@ -24,6 +24,28 @@ namespace phpseclib3\Crypt\Common;
|
||||
*/
|
||||
abstract class StreamCipher extends SymmetricKey
|
||||
{
|
||||
/**
|
||||
* Block Length of the cipher
|
||||
*
|
||||
* Stream ciphers do not have a block size
|
||||
*
|
||||
* @see \phpseclib3\Crypt\Common\SymmetricKey::block_size
|
||||
* @var int
|
||||
* @access private
|
||||
*/
|
||||
protected $block_size = 0;
|
||||
|
||||
/**
|
||||
* Default Constructor.
|
||||
*
|
||||
* @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
|
||||
* @return \phpseclib3\Crypt\Common\StreamCipher
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('stream');
|
||||
}
|
||||
|
||||
/**
|
||||
* Stream ciphers not use an IV
|
||||
*
|
||||
|
@ -63,18 +63,6 @@ class RC4 extends StreamCipher
|
||||
const DECRYPT = 1;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Block Length of the cipher
|
||||
*
|
||||
* RC4 is a stream cipher
|
||||
* so we the block_size to 0
|
||||
*
|
||||
* @see \phpseclib3\Crypt\Common\SymmetricKey::block_size
|
||||
* @var int
|
||||
* @access private
|
||||
*/
|
||||
protected $block_size = 0;
|
||||
|
||||
/**
|
||||
* Key Length (in bytes)
|
||||
*
|
||||
@ -111,18 +99,6 @@ class RC4 extends StreamCipher
|
||||
*/
|
||||
private $stream;
|
||||
|
||||
/**
|
||||
* Default Constructor.
|
||||
*
|
||||
* @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
|
||||
* @return \phpseclib3\Crypt\RC4
|
||||
* @access public
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('stream');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for engine validity
|
||||
*
|
||||
|
@ -50,16 +50,6 @@ class Salsa20 extends StreamCipher
|
||||
*/
|
||||
protected $key_length = 32; // = 256 bits
|
||||
|
||||
/**
|
||||
* Block Length of the cipher
|
||||
*
|
||||
* Salsa20 is a stream cipher
|
||||
* so we the block_size to 0
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $block_size = 0;
|
||||
|
||||
/**#@+
|
||||
* @access private
|
||||
* @see \phpseclib3\Crypt\Salsa20::crypt()
|
||||
@ -96,17 +86,6 @@ class Salsa20 extends StreamCipher
|
||||
*/
|
||||
protected $usingGeneratedPoly1305Key = false;
|
||||
|
||||
/**
|
||||
* Default Constructor.
|
||||
*
|
||||
* @see \phpseclib3\Crypt\Common\SymmetricKey::__construct()
|
||||
* @return \phpseclib3\Crypt\Salsa20
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('stream');
|
||||
}
|
||||
|
||||
/**
|
||||
* Salsa20 uses a nonce
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user