sodium_crypto_kdf_derive_from_key

FunctionParams and return types changed in PHP 8.0

Derive a subkey.

PHP 5
PHP 7.0-7.1
PHP 7.2
Added
PHP 7.3-7.4
PHP 8.0
Improved
PHP 8.1
PHP 8.2
PHP 8.3
PHP 8.4
PHP 8.5

sodium_crypto_kdf_derive_from_key Function synopsis

sodium_crypto_kdf_derive_from_key(
    int $subkey_length,
    int $subkey_id,
    string $context,
    string $key
  ): string

Parameters

$subkey_length

Typeint

Length of the key to return (in bytes)

$subkey_id

Typeint

Return the Nth subkey from a given root key. Useful for seeking.

$context

Typestring

Application-specific context.

$key

Typestring

The root key from which the subkey is derived.

Return value

Typestring

A string of pseudorandom (raw binary) bytes.

Changes to the sodium_crypto_kdf_derive_from_key Function

PHP 8.0

  • Return type added: string
  • Parameter name of parameter #1 changed: $subkey_len to $subkey_length
  • Parameter type added for parameter #1 ($subkey_length): int
  • Parameter type added for parameter #2 ($subkey_id): int
  • Parameter type added for parameter #3 ($context): string
  • Parameter type added for parameter #4 ($key): string
  sodium_crypto_kdf_derive_from_key(
-     $subkey_len,
+     int $subkey_length,
-     $subkey_id,
+     int $subkey_id,
-     $context,
+     string $context,
-     $key
+     string $key
-   )
+   ): string

PHP 7.2

  • Function added

sodium_crypto_kdf_derive_from_key Function Availability

PHP VersionAvailability
PHP 8.5Future Release Yes
PHP 8.4Upcoming Release Yes
PHP 8.3Supported (Latest) Yes
PHP 8.2Supported Yes
PHP 8.1Security-Fixes Only Yes
PHP 8.0Unsupported Yes
PHP 7.4Unsupported Yes
PHP 7.3Unsupported Yes
PHP 7.2Unsupported Yes
PHP 7.1Unsupported No
PHP 7.0Unsupported No
PHP 5.6Unsupported No
PHP 5.5Unsupported No
PHP 5.4Unsupported No
PHP 5.3Unsupported No