Метод | Описание | |
---|---|---|
__construct ( string $passwordAlgo, string $cipherMode, string $cipherBlock ) | 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 = 1, integer $max = PHP_INT_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. |
Метод | Описание | |
---|---|---|
generator ( integer $size ) : string | A simple seed generator that uses mcrypt_create_iv (MCRYPT_DEV_URANDOM). | |
getKeyHash ( string $key ) : string | Generates a hash from the given key. The has length is determined by the cipher mode and cipher block. | |
hkdf ( $key, string $digest = 'sha512', $salt = null, $length = null, string $info = '' ) : string | HKDF https://gist.github.com/narfbg/8793435 | |
strLen ( $str ) | ||
subStr ( $str, $start, $len = null ) : string | Helper function for substr. |
public createPasswordHash ( string $password ) : string | ||
$password | string | String you wish to hash. |
Результат | string | Hash of the given string. |
public generateHardReadableString ( integer $length ) : string | ||
$length | integer | Length of the random string. |
Результат | 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. |
Результат | 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. |
Результат | string | Random string with the given $length. |