[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

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

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

Author: Jim Wigginton
Author: Hans-Juergen Petrich
Copyright: 2007 Jim Wigginton
License: http://www.opensource.org/licenses/mit-license.html MIT License
Link: http://phpseclib.sourceforge.net
File Size: 852 lines (39 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Twofish:: (7 methods):
  __construct()
  setKeyLength()
  _setupKey()
  _mdsrem()
  _encryptBlock()
  _decryptBlock()
  _setupInlineCrypt()


Class: Twofish  - X-Ref

Pure-PHP implementation of Twofish.

__construct($mode = self::MODE_CBC)   X-Ref
Default Constructor.

Determines whether or not the mcrypt extension should be used.

$mode could be:

- CRYPT_MODE_ECB

- CRYPT_MODE_CBC

- CRYPT_MODE_CTR

- CRYPT_MODE_CFB

- CRYPT_MODE_OFB

(or the alias constants of the chosen cipher, for example for AES: CRYPT_AES_MODE_ECB or CRYPT_AES_MODE_CBC ...)

If not explicitly set, CRYPT_MODE_CBC will be used.

param: int $mode

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

Valid key lengths are 128, 192 or 256 bits

param: int $length

_setupKey()   X-Ref
Setup the key (expansion)

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

_mdsrem($A, $B)   X-Ref
_mdsrem function using by the twofish cipher algorithm

return: array
param: string $A
param: string $B

_encryptBlock($in)   X-Ref
Encrypts a block

return: string
param: string $in

_decryptBlock($in)   X-Ref
Decrypts a block

return: string
param: string $in

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

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