[ 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: 640 lines (22 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

RC2:: (11 methods):
  __construct()
  isValidEngineHelper()
  setKeyLength()
  getKeyLength()
  setKey()
  encrypt()
  decrypt()
  encryptBlock()
  decryptBlock()
  setupKey()
  setupInlineCrypt()


Class: RC2  - X-Ref

Pure-PHP implementation of RC2.

__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()

see: \phpseclib3\Crypt\Common\SymmetricKey::__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
\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.

see: \phpseclib3\Crypt\Common\SymmetricKey::setKey()
param: string $key
param: int|boolean $t1 optional Effective key length in bits.

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

Mostly a wrapper for \phpseclib3\Crypt\Common\SymmetricKey::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 \phpseclib3\Crypt\Common\SymmetricKey::decrypt, with some additional OpenSSL handling code

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

encryptBlock($in)   X-Ref
Encrypts a block

see: \phpseclib3\Crypt\Common\SymmetricKey::encryptBlock()
see: \phpseclib3\Crypt\Common\SymmetricKey::encrypt()
return: string
param: string $in

decryptBlock($in)   X-Ref
Decrypts a block

see: \phpseclib3\Crypt\Common\SymmetricKey::decryptBlock()
see: \phpseclib3\Crypt\Common\SymmetricKey::decrypt()
return: string
param: string $in

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()