\CryptoManana\CompatibilityNativeHkdfSha3

Class NativeHkdfSha3 - Pure PHP implementation of the HKDF-SHA-3 algorithm.

Summary

Methods
Properties
Constants
getInstance()
__wakeup()
__sleep()
__toString()
digest224()
digest256()
digest384()
digest512()
No public properties found
No constants found
__construct()
customHkdf()
$mbString
$sizes
N/A
__clone()
No private properties found
N/A

Properties

$mbString

$mbString : null|boolean

Internal flag to enable or disable the `mbstring` extension usage.

Note: null => auto-check on next call, true => available, false => not available.

Type

null|boolean — Is the `mbstring` extension supported.

$sizes

$sizes : array

Internal storage of the SHA-3 algorithm sizes.

Type

array — The algorithm sizes information.

Methods

getInstance()

getInstance() : static|null

Gives a unified access point for the current object instance.

Returns

static|null —

An instance.

__wakeup()

__wakeup() 

Lock the reinitialization and unserialization abilities of the class.

__sleep()

__sleep() 

Lock the serialization abilities of the class.

__toString()

__toString() : string

Return the name of the current defined class that extends the class.

Returns

string —

Name of the class.

digest224()

digest224(string  $ikm, integer  $length, string  $information = '', string  $salt = '', boolean|integer|null  $rawOutput = false) : string

The HKDF-SHA-3-224 key derivation function.

Parameters

string $ikm

The input keying material (cannot be empty).

integer $length

The desired output string length in bytes.

string $information

The application or context-specific string.

string $salt

The salt string to use during derivation.

boolean|integer|null $rawOutput

Flag for using raw byte output instead of HEX.

Throws

\Exception

Validation errors.

Returns

string —

The output derived key (output keying material).

digest256()

digest256(string|mixed  $ikm, integer  $length, string|mixed  $information = '', string|mixed  $salt = '', boolean|integer|null  $rawOutput = false) : string

The HKDF-SHA-3-256 key derivation function.

Parameters

string|mixed $ikm

The input keying material (cannot be empty).

integer $length

The desired output string length in bytes.

string|mixed $information

The application or context-specific string.

string|mixed $salt

The salt string to use during derivation.

boolean|integer|null $rawOutput

Flag for using raw byte output instead of HEX.

Throws

\Exception

Validation errors.

Returns

string —

The output derived key (output keying material).

digest384()

digest384(string|mixed  $ikm, integer  $length, string|mixed  $information = '', string|mixed  $salt = '', boolean|integer|null  $rawOutput = false) : string

The HKDF-SHA-3-384 key derivation function.

Parameters

string|mixed $ikm

The input keying material (cannot be empty).

integer $length

The desired output string length in bytes.

string|mixed $information

The application or context-specific string.

string|mixed $salt

The salt string to use during derivation.

boolean|integer|null $rawOutput

Flag for using raw byte output instead of HEX.

Throws

\Exception

Validation errors.

Returns

string —

The output derived key (output keying material).

digest512()

digest512(string|mixed  $ikm, integer  $length, string|mixed  $information = '', string|mixed  $salt = '', boolean|integer|null  $rawOutput = false) : string

The HKDF-SHA-3-512 key derivation function.

Parameters

string|mixed $ikm

The input keying material (cannot be empty).

integer $length

The desired output string length in bytes.

string|mixed $information

The application or context-specific string.

string|mixed $salt

The salt string to use during derivation.

boolean|integer|null $rawOutput

Flag for using raw byte output instead of HEX.

Throws

\Exception

Validation errors.

Returns

string —

The output derived key (output keying material).

__construct()

__construct() 

Locks the creation of new objects but allows static creation and extending.

customHkdf()

customHkdf(string  $algorithm, string|mixed  $ikm, integer  $length, string|mixed  $info = '', string|mixed  $salt = '', boolean|integer|null  $rawOutput = false) : string

Internal static method for single point consumption of the HKDF-SHA-3 implementation.

Parameters

string $algorithm

The SHA-3 algorithm name.

string|mixed $ikm

The input keying material (cannot be empty).

integer $length

The desired output string length in bytes.

string|mixed $info

The application or context-specific string.

string|mixed $salt

The salt string to use during derivation.

boolean|integer|null $rawOutput

Flag for using raw byte output instead of HEX.

Throws

\Exception

Validation errors.

Returns

string —

The output derived key (output keying material).

__clone()

__clone() 

Lock the ability to clone properties and create a new dynamic instance of the class.