[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

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

Pure-PHP implementation of Blowfish. 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: 993 lines (50 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Blowfish:: (13 methods):
  __construct()
  setKeyLength()
  isValidEngine()
  _setupKey()
  _bcrypt_hash()
  bcrypt_pbkdf()
  _expand0state()
  _expandstate()
  _encryptBlock()
  _encryptBlockHelperFast()
  _encryptBlockHelperSlow()
  _decryptBlock()
  _setupInlineCrypt()


Class: Blowfish  - X-Ref

Pure-PHP implementation of Blowfish.

__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.

Key lengths can be between 32 and 448 bits.

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::isValidEngine()
param: int $engine

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

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

_bcrypt_hash($sha2pass, $sha2salt)   X-Ref
bcrypt

return: string
param: string $sha2pass
param: string $sha2salt

bcrypt_pbkdf($pass, $salt, $keylen, $rounds)   X-Ref
Performs OpenSSH-style bcrypt

return: false|string
param: string $pass
param: string $salt
param: int $keylen
param: int $rounds

_expand0state($key, &$sbox0, &$sbox1, &$sbox2, &$sbox3, &$p)   X-Ref
Key expansion without salt

see: self::_bcrypt_hash()
param: int[] $key
param: int[] $sbox0
param: int[] $sbox1
param: int[] $sbox2
param: int[] $sbox3
param: int[] $p

_expandstate($data, $key, &$sbox0, &$sbox1, &$sbox2, &$sbox3, &$p)   X-Ref
Key expansion with salt

see: self::_bcrypt_hash()
param: int[] $data
param: int[] $key
param: int[] $sbox0
param: int[] $sbox1
param: int[] $sbox2
param: int[] $sbox3
param: int[] $p

_encryptBlock($in)   X-Ref
Encrypts a block

return: string
param: string $in

_encryptBlockHelperFast($x0, $x1, $sbox0, $sbox1, $sbox2, $sbox3, $p)   X-Ref
Fast helper function for block encryption

return: int[]
param: int $x0
param: int $x1
param: int[] $sbox0
param: int[] $sbox1
param: int[] $sbox2
param: int[] $sbox3
param: int[] $p

_encryptBlockHelperSlow($x0, $x1, $sbox0, $sbox1, $sbox2, $sbox3, $p)   X-Ref
Slow helper function for block encryption

return: int[]
param: int $x0
param: int $x1
param: int[] $sbox0
param: int[] $sbox1
param: int[] $sbox2
param: int[] $sbox3
param: int[] $p

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