151                switch (strlen($this->key)) {
 
  153                        $this->cipher_name_openssl = 
'rc4-40';
 
  156                        $this->cipher_name_openssl = 
'rc4-64';
 
  159                        $this->cipher_name_openssl = 
'rc4';
 
  166        return parent::isValidEngine(
$engine);
 
  203            $this->key_length = 1;
 
  204        } elseif ($length > 2048) {
 
  205            $this->key_length = 248;
 
  207            $this->key_length = $length >> 3;
 
  210        parent::setKeyLength($length);
 
  225            return parent::encrypt($plaintext);
 
  227        return $this->
_crypt($plaintext, self::ENCRYPT);
 
  245            return parent::decrypt($ciphertext);
 
  247        return $this->
_crypt($ciphertext, self::DECRYPT);
 
  281        $keyLength = strlen(
$key);
 
  282        $keyStream = range(0, 255);
 
  284        for (
$i = 0; 
$i < 256; 
$i++) {
 
  285            $j = ($j + $keyStream[
$i] + ord(
$key[
$i % $keyLength])) & 255;
 
  286            $temp = $keyStream[
$i];
 
  287            $keyStream[
$i] = $keyStream[$j];
 
  288            $keyStream[$j] = $temp;
 
  291        $this->stream = array();
 
  311        if ($this->changed) {
 
  313            $this->changed = 
false;
 
  317        if ($this->continuousBuffer) {
 
  327        $len = strlen(
$text);
 
  328        for ($k = 0; $k < $len; ++$k) {
 
  330            $ksi = $keyStream[
$i];
 
  331            $j = ($j + $ksi) & 255;
 
  332            $ksj = $keyStream[$j];
 
  334            $keyStream[
$i] = $ksj;
 
  335            $keyStream[$j] = $ksi;
 
  336            $text[$k] = 
$text[$k] ^ chr($keyStream[($ksj + $ksi) & 255]);
 
if(php_sapi_name() !='cli') $in
An exception for terminatinating execution or to throw for unit testing.
const ENGINE_OPENSSL
Base value for the mcrypt implementation $engine switch.
const ENGINE_INTERNAL
#+ @access private
_setup()
Setup the self::ENGINE_INTERNAL $engine.
const MODE_STREAM
Encrypt / decrypt using streaming mode.
isValidEngine($engine)
Test for engine validity.
_decryptBlock($in)
Decrypts a block.
_crypt($text, $mode)
Encrypts or decrypts a message.
__construct()
Default Constructor.
_setupKey()
Setup the key (expansion)
encrypt($plaintext)
Encrypts a message.
decrypt($ciphertext)
Decrypts a message.
setKeyLength($length)
Sets the key length.
_encryptBlock($in)
Encrypts a block.
const ENCRYPT
#+ @access private
setIV($iv)
Dummy function.
Base Class for all \phpseclib\Crypt* cipher classes.
Pure-PHP implementation of RC4.
Pure-PHP implementations of keyed-hash message authentication codes (HMACs) and various cryptographic...