PHP Класс Dcrypt\Hash

16 bytes => iv 12 bytes => cost checksum 4 bytes => cost 32 bytes => hmac ivivivivivivivivsssssssssssscosthmachmachmachmachmachmachmachmac
Автор: Michael Meyer (mmeyer2k) ([email protected])
Наследование: extends Support
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
ihmac ( string $data, string $key, integer $iter, string $algo = 'sha256' ) : string Perform a raw iterative HMAC operation with a configurable algo.
make ( string $input, string $password, integer $cost = 250000 ) : string Hash an input string into a salted 512 byte hash.
verify ( string $input, string $hash, string $password ) : boolean Check the validity of a hash.

Приватные методы

Метод Описание
build ( string $input, string $password, integer $cost, string | null $salt = null ) : string Internal function used to build the actual hash.
cost ( integer $cost ) : integer Return a normalized cost value.
costHash ( $cost, $salt, $password )

Описание методов

ihmac() публичный статический Метод

This class always performs at least one hash to prevent the input from being passed back unchanged if bad parameters are set.
public static ihmac ( string $data, string $key, integer $iter, string $algo = 'sha256' ) : string
$data string Data to hash.
$key string Key to use to authenticate the hash.
$iter integer Number of times to iteratate the hash
$algo string Name of algo (sha256 or sha512 recommended)
Результат string

make() публичный статический Метод

Hash an input string into a salted 512 byte hash.
public static make ( string $input, string $password, integer $cost = 250000 ) : string
$input string Data to hash.
$password string HMAC validation password.
$cost integer Cost value of the hash.
Результат string

verify() публичный статический Метод

Check the validity of a hash.
public static verify ( string $input, string $hash, string $password ) : boolean
$input string Input to test.
$hash string Known hash to validate against.
$password string HMAC password to use during iterative hash.
Результат boolean