hash_hkdf
Function • Misc changes in PHP 8.2
Generate a HKDF key derivation of a supplied key input.
hash_hkdf Function synopsis
hash_hkdf(
string $algo,
string $key,
int $length = 0,
string $info = "",
string $salt = ""
): string
Parameters
$algo
Typestring
Name of selected hashing algorithm (e.g. "sha256").
For a list of supported algorithms see hash_hmac_algos.
$key
Typestring
Input keying material (raw binary). Cannot be empty.
$length
OptionalTypeintDefault value0
Desired output length in bytes. Cannot be greater than 255 times the chosen hash function size.
$info
OptionalTypestringDefault value""
Application/context-specific info string.
$salt
OptionalTypestringDefault value""
Salt to use during derivation.
Return value
Typestring
Returns a string containing a raw binary representation of the derived key (also known as output keying material - OKM).
Changes to the hash_hkdf Function
PHP 8.2
- Attribute added for parameter
$key:#[SensitiveParameter]
PHP 8.0
- Return type added:
string - Parameter name of parameter #1 changed:
$ikmto$algo - Parameter type added for parameter #1 (
$algo):string - Parameter name of parameter #2 changed:
$algoto$key - Parameter type added for parameter #2 (
$key):string - Parameter type added for parameter #3 (
$length):int - Parameter default value added for position #3 (
$length):0 - Parameter name of parameter #4 changed:
$stringto$info - Parameter type added for parameter #4 (
$info):string - Parameter default value added for position #4 (
$info):"" - Parameter type added for parameter #5 (
$salt):string - Parameter default value added for position #5 (
$salt):""
hash_hkdf(
- $ikm,
+ string $algo,
- $algo,
+ string $key,
- $length,
+ int $length = 0,
- $string,
+ string $info = "",
- $salt
+ string $salt = ""
- )
+ ): string PHP 7.1
- Function added
hash_hkdf Function Availability
hash_hkdf Function Availability| PHP Version | Availability |
|---|---|
| PHP 8.6Upcoming Release | Yes |
| PHP 8.5Supported (Latest) | Yes |
| PHP 8.4Supported | Yes |
| PHP 8.3Security-Fixes Only | Yes |
| PHP 8.2Security-Fixes Only | Yes |
| PHP 8.1Unsupported | Yes |
| PHP 8.0Unsupported | Yes |
| PHP 7.4Unsupported | Yes |
| PHP 7.3Unsupported | Yes |
| PHP 7.2Unsupported | Yes |
| PHP 7.1Unsupported | Yes |
| PHP 7.0Unsupported | No |
| PHP 5.6Unsupported | No |
| PHP 5.5Unsupported | No |
| PHP 5.4Unsupported | No |
| PHP 5.3Unsupported | No |