[ Index ] |
PHP Cross Reference of DokuWiki |
[Source view] [Print] [Project Stats]
Pure-PHP implementation of DES. Uses mcrypt, if available, and an internal implementation, otherwise.
Author: | Jim Wigginton |
Copyright: | 2007 Jim Wigginton |
License: | http://www.opensource.org/licenses/mit-license.html MIT License |
Link: | http://phpseclib.sourceforge.net |
File Size: | 1449 lines (72 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
DES:: (7 methods):
isValidEngine()
setKey()
_encryptBlock()
_decryptBlock()
_processBlock()
_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() return: bool see: \phpseclib\Crypt\Base::isValidEngine() param: int $engine |
setKey($key) X-Ref |
Sets the key. Keys can be of any length. DES, itself, uses 64-bit keys (eg. strlen($key) == 8), however, we only use the first eight, if $key has more then eight characters in it, and pad $key with the null byte if it is less then eight characters long. DES also requires that every eighth bit be a parity bit, however, we'll ignore that. If the key is not explicitly set, it'll be assumed to be all zero's. see: \phpseclib\Crypt\Base::setKey() param: string $key |
_encryptBlock($in) X-Ref |
Encrypts a block return: string see: \phpseclib\Crypt\Base::_encryptBlock() see: \phpseclib\Crypt\Base::encrypt() see: self::encrypt() param: string $in |
_decryptBlock($in) X-Ref |
Decrypts a block return: string see: \phpseclib\Crypt\Base::_decryptBlock() see: \phpseclib\Crypt\Base::decrypt() see: self::decrypt() param: string $in |
_processBlock($block, $mode) X-Ref |
Encrypts or decrypts a 64-bit block $mode should be either self::ENCRYPT or self::DECRYPT. See {@link http://en.wikipedia.org/wiki/Image:Feistel.png Feistel.png} to get a general idea of what this function does. return: string see: self::_encryptBlock() see: self::_decryptBlock() param: string $block param: int $mode |
_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() |