[ 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: | 640 lines (22 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
RC2:: (11 methods):
__construct()
isValidEngineHelper()
setKeyLength()
getKeyLength()
setKey()
encrypt()
decrypt()
encryptBlock()
decryptBlock()
setupKey()
setupInlineCrypt()
__construct($mode) X-Ref |
Default Constructor. param: string $mode |
isValidEngineHelper($engine) X-Ref |
Test for engine validity This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() param: int $engine return: bool see: \phpseclib3\Crypt\Common\SymmetricKey::__construct() |
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 \phpseclib3\Crypt\RC2::setKey() call. param: int $length in bits |
getKeyLength() X-Ref |
Returns the current key length return: int |
setKey($key, $t1 = false) 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. param: string $key param: int|boolean $t1 optional Effective key length in bits. see: \phpseclib3\Crypt\Common\SymmetricKey::setKey() |
encrypt($plaintext) X-Ref |
Encrypts a message. Mostly a wrapper for \phpseclib3\Crypt\Common\SymmetricKey::encrypt, with some additional OpenSSL handling code param: string $plaintext return: string $ciphertext see: self::decrypt() |
decrypt($ciphertext) X-Ref |
Decrypts a message. Mostly a wrapper for \phpseclib3\Crypt\Common\SymmetricKey::decrypt, with some additional OpenSSL handling code param: string $ciphertext return: string $plaintext see: self::encrypt() |
encryptBlock($in) X-Ref |
Encrypts a block param: string $in return: string see: \phpseclib3\Crypt\Common\SymmetricKey::encryptBlock() see: \phpseclib3\Crypt\Common\SymmetricKey::encrypt() |
decryptBlock($in) X-Ref |
Decrypts a block param: string $in return: string see: \phpseclib3\Crypt\Common\SymmetricKey::decryptBlock() see: \phpseclib3\Crypt\Common\SymmetricKey::decrypt() |
setupKey() X-Ref |
Creates the key schedule see: \phpseclib3\Crypt\Common\SymmetricKey::setupKey() |
setupInlineCrypt() X-Ref |
Setup the performance-optimized function for de/encrypt() see: \phpseclib3\Crypt\Common\SymmetricKey::setupInlineCrypt() |