[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/vendor/phpseclib/phpseclib/phpseclib/Crypt/ -> RC2.php (summary)

Pure-PHP implementation of RC2. Uses mcrypt, if available, and an internal implementation, otherwise.

Author: Patrick Monnerat
License: http://www.opensource.org/licenses/mit-license.html MIT License
Link: http://phpseclib.sourceforge.net
File Size: 688 lines (23 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

RC2:: (11 methods):
  isValidEngine()
  setKeyLength()
  getKeyLength()
  setKey()
  encrypt()
  decrypt()
  _encryptBlock()
  _decryptBlock()
  _setupMcrypt()
  _setupKey()
  _setupInlineCrypt()


Class: RC2  - X-Ref

Pure-PHP implementation of RC2.

isValidEngine($engine)   X-Ref
Test for engine validity

This is mainly just a wrapper to set things up for \phpseclib\Crypt\Base::isValidEngine()

see: \phpseclib\Crypt\Base::__construct()
param: int $engine
return: bool

setKeyLength($length)   X-Ref
Sets the key length.

Valid key lengths are 8 to 1024.
Calling this function after setting the key has no effect until the next
\phpseclib\Crypt\RC2::setKey() call.

param: int $length in bits

getKeyLength()   X-Ref
Returns the current key length

return: int

setKey($key, $t1 = 0)   X-Ref
Sets the key.

Keys can be of any length. RC2, itself, uses 8 to 1024 bit keys (eg.
strlen($key) <= 128), however, we only use the first 128 bytes if $key
has more then 128 bytes in it, and set $key to a single null byte if
it is empty.

If the key is not explicitly set, it'll be assumed to be a single
null byte.

see: \phpseclib\Crypt\Base::setKey()
param: string $key
param: int $t1 optional Effective key length in bits.

encrypt($plaintext)   X-Ref
Encrypts a message.

Mostly a wrapper for \phpseclib\Crypt\Base::encrypt, with some additional OpenSSL handling code

see: self::decrypt()
param: string $plaintext
return: string $ciphertext

decrypt($ciphertext)   X-Ref
Decrypts a message.

Mostly a wrapper for \phpseclib\Crypt\Base::decrypt, with some additional OpenSSL handling code

see: self::encrypt()
param: string $ciphertext
return: string $plaintext

_encryptBlock($in)   X-Ref
Encrypts a block

see: \phpseclib\Crypt\Base::_encryptBlock()
see: \phpseclib\Crypt\Base::encrypt()
param: string $in
return: string

_decryptBlock($in)   X-Ref
Decrypts a block

see: \phpseclib\Crypt\Base::_decryptBlock()
see: \phpseclib\Crypt\Base::decrypt()
param: string $in
return: string

_setupMcrypt()   X-Ref
Setup the \phpseclib\Crypt\Base::ENGINE_MCRYPT $engine

see: \phpseclib\Crypt\Base::_setupMcrypt()

_setupKey()   X-Ref
Creates the key schedule

see: \phpseclib\Crypt\Base::_setupKey()

_setupInlineCrypt()   X-Ref
Setup the performance-optimized function for de/encrypt()

see: \phpseclib\Crypt\Base::_setupInlineCrypt()