\CryptoManana\CompatibilityNativePbkdf2Sha3

Class NativePbkdf2Sha3 - Pure PHP implementation of the PBKDF2-SHA-3 algorithm.

Summary

Methods
Properties
Constants
getInstance()
__wakeup()
__sleep()
__toString()
digest224()
digest256()
digest384()
digest512()
No public properties found
No constants found
__construct()
customPbkdf2()
$mbString
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.

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|mixed  $password, string|mixed  $salt, integer  $iterations, integer  $keyLength, boolean|integer|null  $rawOutput = false) : string

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

Parameters

string|mixed $password

The password to use for the derivation.

string|mixed $salt

The salt string to use during derivation.

integer $iterations

The number of internal iterations to perform for the derivation.

integer $keyLength

The length of the output derivation key string.

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  $password, string|mixed  $salt, integer  $iterations, integer  $keyLength, boolean|integer|null  $rawOutput = false) : string

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

Parameters

string|mixed $password

The password to use for the derivation.

string|mixed $salt

The salt string to use during derivation.

integer $iterations

The number of internal iterations to perform for the derivation.

integer $keyLength

The length of the output derivation key string.

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  $password, string|mixed  $salt, integer  $iterations, integer  $keyLength, boolean|integer|null  $rawOutput = false) : string

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

Parameters

string|mixed $password

The password to use for the derivation.

string|mixed $salt

The salt string to use during derivation.

integer $iterations

The number of internal iterations to perform for the derivation.

integer $keyLength

The length of the output derivation key string.

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  $password, string|mixed  $salt, integer  $iterations, integer  $keyLength, boolean|integer|null  $rawOutput = false) : string

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

Parameters

string|mixed $password

The password to use for the derivation.

string|mixed $salt

The salt string to use during derivation.

integer $iterations

The number of internal iterations to perform for the derivation.

integer $keyLength

The length of the output derivation key string.

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.

customPbkdf2()

customPbkdf2(string  $algorithm, string|mixed  $password, string|mixed  $salt, integer  $iterations, integer  $keyLength, boolean|integer|null  $rawOutput = false) : string

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

Parameters

string $algorithm

The SHA-3 algorithm name.

string|mixed $password

The password to use for the derivation.

string|mixed $salt

The salt string to use during derivation.

integer $iterations

The number of internal iterations to perform for the derivation.

integer $keyLength

The length of the output derivation key string.

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.