hash_hkdf() - php 密码散列哈希函数
hash_hkdf()
(PHP 7 >= 7.1.2)
Generate a HKDF key derivation of a supplied key input
说明
hash_hkdf(string $algo,string $ikm[,int $length= 0[,string $info=''[,string $salt='']]]): string参数
$algoName of selected hashing algorithm (i.e."sha256","sha512","haval160,4", etc..)Seehash_algos()for a list of supported algorithms.Note:
Non-cryptographic hash functions are not allowed.
$ikmInput keying material (raw binary). Cannot be empty.
$lengthDesired output length in bytes. Cannot be greater than 255 times the chosen hash function size.
If$lengthis0, the output length will default to the chosen hash function size.
$infoApplication/context-specific info string.
$saltSalt to use during derivation.
While optional, adding random salt significantly improves the strength of HKDF.
返回值
Returns a string containing a raw binary representation of the derived key (also known as output keying material - OKM);orFALSE
on failure.
错误/异常
AnE_WARNING
will be raised if$ikmis empty,$algois unknown/non-cryptographic,$lengthis less than0or too large (greater than 255 times the size of the hash function).
范例
Example #1hash_hkdf()example
The above example produces a pair of separate keys, suitable for creation of an encrypt-then-HMAC construct, using AES-256 and SHA-256 for encryption and authentication respectively.
参见
hash_pbkdf2()
生成所提供密码的 PBKDF2 密钥导出- » RFC 5869
- » userland implementation
鹏仔微信 15129739599 鹏仔QQ344225443 鹏仔前端 pjxi.com 共享博客 sharedbk.com
图片声明:本站部分配图来自网络。本站只作为美观性配图使用,无任何非法侵犯第三方意图,一切解释权归图片著作权方,本站不承担任何责任。如有恶意碰瓷者,必当奉陪到底严惩不贷!