\CryptoManana\CompatibilityNativeHmacSha3

Class NativeHmacSha3 - Pure PHP implementation of the HMAC-SHA-3 algorithm.

Summary

Methods
Properties
Constants
getInstance()
__wakeup()
__sleep()
__toString()
digest224()
digest256()
digest384()
digest512()
No public properties found
No constants found
__construct()
customHmac()
$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  $inputData, string|mixed  $hashingKey, boolean|integer|null  $rawOutput = false) : string

The HMAC-SHA-3-224 hashing function.

Parameters

string|mixed $inputData

The input message to be hashed.

string|mixed $hashingKey

The HMAC algorithm key.

boolean|integer|null $rawOutput

When set to TRUE, outputs raw binary data. FALSE outputs lowercase hexits.

Throws

\Exception

Validation errors.

Returns

string —

The output HMAC digest.

digest256()

digest256(string|mixed  $inputData, string|mixed  $hashingKey, boolean|integer|null  $rawOutput = false) : string

The HMAC-SHA-3-256 hashing function.

Parameters

string|mixed $inputData

The input message to be hashed.

string|mixed $hashingKey

The HMAC algorithm key.

boolean|integer|null $rawOutput

When set to TRUE, outputs raw binary data. FALSE outputs lowercase hexits.

Throws

\Exception

Validation errors.

Returns

string —

The output HMAC digest.

digest384()

digest384(string|mixed  $inputData, string|mixed  $hashingKey, boolean|integer|null  $rawOutput = false) : string

The HMAC-SHA-3-384 hashing function.

Parameters

string|mixed $inputData

The input message to be hashed.

string|mixed $hashingKey

The HMAC algorithm key.

boolean|integer|null $rawOutput

When set to TRUE, outputs raw binary data. FALSE outputs lowercase hexits.

Throws

\Exception

Validation errors.

Returns

string —

The output HMAC digest.

digest512()

digest512(string|mixed  $inputData, string|mixed  $hashingKey, boolean|integer|null  $rawOutput = false) : string

The HMAC-SHA-3-512 hashing function.

Parameters

string|mixed $inputData

The input message to be hashed.

string|mixed $hashingKey

The HMAC algorithm key.

boolean|integer|null $rawOutput

When set to TRUE, outputs raw binary data. FALSE outputs lowercase hexits.

Throws

\Exception

Validation errors.

Returns

string —

The output HMAC digest.

__construct()

__construct() 

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

customHmac()

customHmac(string  $algorithm, string|mixed  $data, string|mixed  $key, boolean|integer|null  $rawOutput = false) : string

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

Parameters

string $algorithm

The SHA-3 algorithm name.

string|mixed $data

The input data for hashing.

string|mixed $key

The hashing key or password.

boolean|integer|null $rawOutput

Flag for using raw byte output instead of HEX.

Throws

\Exception

Validation errors.

Returns

string —

The output HMAC digest.

__clone()

__clone() 

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