[ Index ]

PHP Cross Reference of DokuWiki




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

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

Defines 1 class

DES:: (7 methods):

Class: DES  - X-Ref

Pure-PHP implementation of DES.

isValidEngine($engine)   X-Ref
Test for engine validity

This is mainly just a wrapper to set things up for \phpseclib\Crypt\Base::isValidEngine()

see: \phpseclib\Crypt\Base::isValidEngine()
return: bool
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

see: \phpseclib\Crypt\Base::_encryptBlock()
see: \phpseclib\Crypt\Base::encrypt()
see: self::encrypt()
return: string
param: string $in

_decryptBlock($in)   X-Ref
Decrypts a block

see: \phpseclib\Crypt\Base::_decryptBlock()
see: \phpseclib\Crypt\Base::decrypt()
see: self::decrypt()
return: string
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.

see: self::_encryptBlock()
see: self::_decryptBlock()
return: string
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()