Property | Type | Description | |
---|---|---|---|
$cipher | string | * @var string Mcrypt cipher used for encryption and decryption. | |
$cipherMode | Mcrypt mode used for encryption and decryption. | ||
$passwordAlgo | Password algorithm used by password_hash |
Method | Description | |
---|---|---|
__construct ( ) | Base constructor. | |
createPasswordHash ( string $password ) : string | Creates a hash from the given $password string. | |
decrypt ( string $string, string $key ) : string | Decrypt a string that has been encrypted with the 'encrypt' method. | |
encrypt ( string $string, string $key ) : string | Encrypt the given $string using a cypher and the secret $key | |
generateHardReadableString ( integer $length ) : string | Generates a random string with a lot of 'noise' (special characters). | |
generateRandomInt ( integer $min, integer $max ) : integer | Generates a random integer between the given $min and $max values. | |
generateRandomString ( integer $length, string $chars = '' ) : string | Generates a random string using the defined character set. | |
generateUserReadableString ( integer $length ) : string | Generates a random string, but without using special characters that are hard to read. | |
verifyPasswordHash ( string $password, string $hash ) : boolean | Verify if the given $hash matches the given $password. |
public createPasswordHash ( string $password ) : string | ||
$password | string | String you wish to hash. |
return | string | Hash of the given string. |
public generateHardReadableString ( integer $length ) : string | ||
$length | integer | Length of the random string. |
return | string | Random string with the given $length. |
public generateRandomString ( integer $length, string $chars = '' ) : string | ||
$length | integer | Length of the generated string. |
$chars | string | A string containing a list of chars that will be uses for generating the random string. |
return | string | Random string with the given $length containing only the provided set of $chars. |
public generateUserReadableString ( integer $length ) : string | ||
$length | integer | Length of the random string. |
return | string | Random string with the given $length. |
protected string $cipher | ||
return | string |
protected $cipherMode |