PHP Class Dcrypt\Mcrypt

Features: - PKCS #7 padding of messages - random IV selection - checksum validation with HMAC - tested to be compatible with many ciphers, modes and hashing algorithms. - highly customizable, but default options are most secure
Inheritance: extends Cryptobase
Datei anzeigen Open project: dopecode/dcrypt Class Usage Examples

Public Methods

Method Description
decrypt ( string $cyphertext, string $password, integer $cost, string $cipher = MCRYPT_RIJNDAEL_128, string $mode = MCRYPT_MODE_CBC, string $algo = 'sha256' ) : string | boolean Decrypt cyphertext
encrypt ( string $plaintext, string $password, integer $cost, string $cipher = MCRYPT_RIJNDAEL_128, string $mode = MCRYPT_MODE_CBC, string $algo = 'sha256' ) : string Encrypt plaintext

Method Details

decrypt() public static method

Decrypt cyphertext
public static decrypt ( string $cyphertext, string $password, integer $cost, string $cipher = MCRYPT_RIJNDAEL_128, string $mode = MCRYPT_MODE_CBC, string $algo = 'sha256' ) : string | boolean
$cyphertext string Cypher text to decrypt
$password string Password that should be used to decrypt input data
$cost integer Number of HMAC iterations to perform on key
$cipher string Mcrypt cipher
$mode string Mcrypt mode
$algo string Hashing algorithm to use for internal operations
return string | boolean Returns false on checksum validation failure

encrypt() public static method

Encrypt plaintext
public static encrypt ( string $plaintext, string $password, integer $cost, string $cipher = MCRYPT_RIJNDAEL_128, string $mode = MCRYPT_MODE_CBC, string $algo = 'sha256' ) : string
$plaintext string Plaintext string to encrypt
$password string Key used to encrypt data
$cost integer Number of HMAC iterations to perform on key
$cipher string Mcrypt cipher
$mode string Mcrypt mode
$algo string Hashing algorithm to use for internal operations
return string