base\Security pbkdf2()

pbkdf2() public method

Derives a key from the given password using the standard PBKDF2 algorithm.

Implements HKDF2 specified in RFC 2898 Recommend use one of the SHA-2 hash algorithms: sha224, sha256, sha384 or sha512.

public string pbkdf2 ( $algo, $password, $salt, $iterations, $length = 0 )
$algo string

A hash algorithm supported by hash_hmac(), e.g. 'SHA-256'

$password string

The source password

$salt string

The random salt

$iterations integer

The number of iterations of the hash algorithm. Set as high as possible to hinder dictionary password attacks.

$length integer

Length of the output key in bytes. If 0, the output key is the length of the hash algorithm output.

return string

The derived key

throws yii\base\InvalidParamException

when hash generation fails due to invalid params given.

doc_Yii
2016-10-30 16:52:22
Comments
Leave a Comment

Please login to continue.