[ Index ] |
PHP Cross Reference of DokuWiki |
[Source view] [Print] [Project Stats]
Pure-PHP implementation of Rijndael. Uses mcrypt, if available/possible, and an internal implementation, otherwise.
Author: | Jim Wigginton |
Copyright: | 2008 Jim Wigginton |
License: | http://www.opensource.org/licenses/mit-license.html MIT License |
Link: | http://phpseclib.sourceforge.net |
File Size: | 941 lines (42 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
Rijndael:: (10 methods):
setKeyLength()
setBlockLength()
isValidEngine()
_encryptBlock()
_decryptBlock()
_setupKey()
_subWord()
_getTables()
_getInvTables()
_setupInlineCrypt()
setKeyLength($length) X-Ref |
Sets the key length. Valid key lengths are 128, 160, 192, 224, and 256. If the length is less than 128, it will be rounded up to 128. If the length is greater than 128 and invalid, it will be rounded down to the closest valid amount. Note: phpseclib extends Rijndael (and AES) for using 160- and 224-bit keys but they are officially not defined and the most (if not all) implementations are not able using 160/224-bit keys but round/pad them up to 192/256 bits as, for example, mcrypt will do. That said, if you want be compatible with other Rijndael and AES implementations, you should not setKeyLength(160) or setKeyLength(224). Additional: In case of 160- and 224-bit keys, phpseclib will/can, for that reason, not use the mcrypt php extension, even if available. This results then in slower encryption. param: int $length |
setBlockLength($length) X-Ref |
Sets the block length Valid block lengths are 128, 160, 192, 224, and 256. If the length is less than 128, it will be rounded up to 128. If the length is greater than 128 and invalid, it will be rounded down to the closest valid amount. param: int $length |
isValidEngine($engine) X-Ref |
Test for engine validity This is mainly just a wrapper to set things up for \phpseclib\Crypt\Base::isValidEngine() return: bool see: \phpseclib\Crypt\Base::__construct() param: int $engine |
_encryptBlock($in) X-Ref |
Encrypts a block return: string param: string $in |
_decryptBlock($in) X-Ref |
Decrypts a block return: string param: string $in |
_setupKey() X-Ref |
Setup the key (expansion) see: \phpseclib\Crypt\Base::_setupKey() |
_subWord($word) X-Ref |
Performs S-Box substitutions param: int $word |
_getTables() X-Ref |
Provides the mixColumns and sboxes tables return: array &$tables see: self::_encryptBlock() see: self::_setupInlineCrypt() see: self::_subWord() |
_getInvTables() X-Ref |
Provides the inverse mixColumns and inverse sboxes tables return: array &$tables see: self::_decryptBlock() see: self::_setupInlineCrypt() see: self::_setupKey() |
_setupInlineCrypt() X-Ref |
Setup the performance-optimized function for de/encrypt() see: \phpseclib\Crypt\Base::_setupInlineCrypt() |