[ Index ] |
PHP Cross Reference of DokuWiki |
[Source view] [Print] [Project Stats]
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: | 694 lines (23 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
RC2:: (11 methods):
isValidEngine()
setKeyLength()
getKeyLength()
setKey()
encrypt()
decrypt()
_encryptBlock()
_decryptBlock()
_setupMcrypt()
_setupKey()
_setupInlineCrypt()
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() return: bool param: int $engine |
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() return: string $ciphertext param: string $plaintext |
decrypt($ciphertext) X-Ref |
Decrypts a message. Mostly a wrapper for \phpseclib\Crypt\Base::decrypt, with some additional OpenSSL handling code see: self::encrypt() return: string $plaintext param: string $ciphertext |
_encryptBlock($in) X-Ref |
Encrypts a block see: \phpseclib\Crypt\Base::_encryptBlock() see: \phpseclib\Crypt\Base::encrypt() return: string param: string $in |
_decryptBlock($in) X-Ref |
Decrypts a block see: \phpseclib\Crypt\Base::_decryptBlock() see: \phpseclib\Crypt\Base::decrypt() return: string param: string $in |
_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() |