PHP Class phpseclib\Crypt\Blowfish

Author: Jim Wigginton ([email protected])
Author: Hans-Juergen Petrich ([email protected])
Inheritance: extends phpseclib\Crypt\Base
Show file Open project: phpseclib/phpseclib Class Usage Examples

Public Properties

Property Type Description
$bctx array Holds the expanded key [p] and the key-depended s-boxes [sb]
$block_size integer Block Length of the cipher
$cfb_init_len integer Optimizing value while CFB-encrypting
$cipher_name_mcrypt string The mcrypt specific name of the cipher
$key_length integer The Key Length (in bytes)
$kl array Holds the last used key
$parray array P-Array consists of 18 32-bit subkeys
$sbox0 array S-Box 0
$sbox1 array S-Box 1
$sbox2 array S-Box 2
$sbox3 array S-Box 3

Public Methods

Method Description
__construct ( integer $mode ) Default Constructor.
_decryptBlock ( string $in ) : string Decrypts a block
_encryptBlock ( string $in ) : string Encrypts a block
_setupInlineCrypt ( ) Setup the performance-optimized function for de/encrypt()
_setupKey ( ) Setup the key (expansion)
isValidEngine ( integer $engine ) : boolean Test for engine validity
setKeyLength ( integer $length ) Sets the key length.

Method Details

__construct() public method

Default Constructor.
public __construct ( integer $mode )
$mode integer

_decryptBlock() public method

Decrypts a block
public _decryptBlock ( string $in ) : string
$in string
return string

_encryptBlock() public method

Encrypts a block
public _encryptBlock ( string $in ) : string
$in string
return string

_setupInlineCrypt() public method

Setup the performance-optimized function for de/encrypt()
See also: phpseclib\Crypt\Common\SymmetricKey::_setupInlineCrypt()
public _setupInlineCrypt ( )

_setupKey() public method

Setup the key (expansion)
See also: phpseclib\Crypt\Common\SymmetricKey::_setupKey()
public _setupKey ( )

isValidEngine() public method

This is mainly just a wrapper to set things up for \phpseclib\Crypt\Common\SymmetricKey::isValidEngine()
See also: phpseclib\Crypt\Common\SymmetricKey::isValidEngine()
public isValidEngine ( integer $engine ) : boolean
$engine integer
return boolean

setKeyLength() public method

Key lengths can be between 32 and 448 bits.
public setKeyLength ( integer $length )
$length integer

Property Details

$bctx public property

Holds the expanded key [p] and the key-depended s-boxes [sb]
public array $bctx
return array

$block_size public property

Block Length of the cipher
See also: phpseclib\Crypt\Common\SymmetricKey::block_size
public int $block_size
return integer

$cfb_init_len public property

Optimizing value while CFB-encrypting
See also: phpseclib\Crypt\Common\SymmetricKey::cfb_init_len
public int $cfb_init_len
return integer

$cipher_name_mcrypt public property

The mcrypt specific name of the cipher
See also: phpseclib\Crypt\Common\SymmetricKey::cipher_name_mcrypt
public string $cipher_name_mcrypt
return string

$key_length public property

The Key Length (in bytes)
See also: phpseclib\Crypt\Common\SymmetricKey::setKeyLength()
public int $key_length
return integer

$kl public property

Holds the last used key
public array $kl
return array

$parray public property

P-Array consists of 18 32-bit subkeys
public array $parray
return array

$sbox0 public property

S-Box 0
public array $sbox0
return array

$sbox1 public property

S-Box 1
public array $sbox1
return array

$sbox2 public property

S-Box 2
public array $sbox2
return array

$sbox3 public property

S-Box 3
public array $sbox3
return array