PHP Class phpseclib\Crypt\Twofish

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

Public Properties

Property Type Description
$K array The Key Schedule Array
$S0 array The Key depended S-Table 0
$S1 array The Key depended S-Table 1
$S2 array The Key depended S-Table 2
$S3 array The Key depended S-Table 3
$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
$m0 array M-Table
$m1 array M-Table
$m2 array M-Table
$m3 array M-Table
$q0 array Q-Table
$q1 array Q-Table

Public Methods

Method Description
__construct ( integer $mode ) Default Constructor.
_decryptBlock ( string $in ) : string Decrypts a block
_encryptBlock ( string $in ) : string Encrypts a block
_mdsrem ( string $A, string $B ) : array _mdsrem function using by the twofish cipher algorithm
_setupInlineCrypt ( ) Setup the performance-optimized function for de/encrypt()
_setupKey ( ) Setup the key (expansion)
setKey ( string $key ) Sets the key.
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

_mdsrem() public method

_mdsrem function using by the twofish cipher algorithm
public _mdsrem ( string $A, string $B ) : array
$A string
$B string
return array

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

setKey() public method

Rijndael supports five different key lengths
See also: setKeyLength()
public setKey ( string $key )
$key string

setKeyLength() public method

Valid key lengths are 128, 192 or 256 bits
public setKeyLength ( integer $length )
$length integer

Property Details

$K public property

The Key Schedule Array
public array $K
return array

$S0 public property

The Key depended S-Table 0
public array $S0
return array

$S1 public property

The Key depended S-Table 1
public array $S1
return array

$S2 public property

The Key depended S-Table 2
public array $S2
return array

$S3 public property

The Key depended S-Table 3
public array $S3
return array

$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: Crypt_Twofish::setKeyLength()
public int $key_length
return integer

$kl public property

Holds the last used key
public array $kl
return array

$m0 public property

M-Table
public array $m0
return array

$m1 public property

M-Table
public array $m1
return array

$m2 public property

M-Table
public array $m2
return array

$m3 public property

M-Table
public array $m3
return array

$q0 public property

Q-Table
public array $q0
return array

$q1 public property

Q-Table
public array $q1
return array