Constants

ALGORITHM_NAME

ALGORITHM_NAME

The internal name of the algorithm.

ALGORITHM_MAXIMUM_OUTPUT

ALGORITHM_MAXIMUM_OUTPUT

The internal maximum length in bytes of the output digest for the algorithm.

Properties

$derivationSalt

$derivationSalt : string

The derivation salt string property storage.

Type

string — The derivation salting string value.

$contextualString

$contextualString : string

The derivation context/application information string property storage.

Type

string — The derivation context/application information string value.

$outputLength

$outputLength : integer

The derivation output digest size in bytes length property storage.

Type

integer — The derivation output digest size in bytes length value.

$useNative

$useNative : boolean

Flag to force native code polyfill realizations, if available.

Type

boolean — Flag to force native realizations.

$salt

$salt : string

The salt string property storage.

Type

string — The salting string value.

$saltingMode

$saltingMode : integer

The salting mode property storage.

Type

integer — The salting mode integer code value.

$digestFormat

$digestFormat : integer

The digest output format property storage.

Type

integer — The output format integer code value.

$inFrontCases

$inFrontCases : array

List of salting modes that add the salt at the front side of the input data.

Type

array — Salting mode codes.

$inBackCases

$inBackCases : array

List of salting modes that add the salt at the back side of the input data.

Type

array — Salting mode codes.

$inSpecialCases

$inSpecialCases : array

List of salting modes that use complex salt and input data manipulation procedures.

Type

array — Salting mode codes.

Methods

__construct()

__construct() 

Key derivation algorithm constructor.

__debugInfo()

__debugInfo() : array

Get debug information for the class instance.

Returns

array —

Debug information.

hashData()

hashData(string  $data) : string

Calculates a hash value for the given data.

Parameters

string $data

The input string.

Throws

\Exception

Validation errors.

Returns

string —

The digest.

setDerivationSalt()

setDerivationSalt(string  $derivationSalt) : $this

Setter for the derivation salt string property.

Parameters

string $derivationSalt

The derivation salt string.

Throws

\Exception

Validation errors.

Returns

$this —

The hash algorithm object.

getDerivationSalt()

getDerivationSalt() : string

Getter for the derivation salt string property.

Returns

string —

The derivation salt string.

setContextualString()

setContextualString(string  $contextualString) : $this

Setter for the derivation context/application information string property.

Parameters

string $contextualString

The derivation context/application information string.

Throws

\Exception

Validation errors.

Returns

$this —

The hash algorithm object.

getContextualString()

getContextualString() : string

Getter for the derivation context/application information string property.

Returns

string —

The derivation context/application information string.

setOutputLength()

setOutputLength(integer  $byteLength) : $this

Setter for the derivation output digest size in bytes length property.

Parameters

integer $byteLength

The derivation output digest size in bytes length.

Throws

\Exception

Validation errors.

Returns

$this —

The hash algorithm object.

getOutputLength()

getOutputLength() : integer

Getter for the derivation output digest size in bytes length property.

Returns

integer —

The derivation output digest size in bytes length.

repetitiveHashData()

repetitiveHashData(string  $data, integer  $iterations = 2) : string

Calculates a hash value for the given data via repetitive/recursive digestion.

Parameters

string $data

The input string.

integer $iterations

The number of internal iterations to perform.

Throws

\Exception

Validation errors.

Returns

string —

The digest.

setSalt()

setSalt(string  $salt) : $this

Setter for the salt string property.

Parameters

string $salt

The salt string.

Throws

\Exception

Validation errors.

Returns

$this —

The hash algorithm object.

getSalt()

getSalt() : string

Getter for the salt string property.

Returns

string —

The salt string.

setSaltingMode()

setSaltingMode(integer  $saltingMode) : $this

Setter for the salting mode code property.

Parameters

integer $saltingMode

The salting mode code.

Throws

\Exception

Validation errors.

Returns

$this —

The hash algorithm object.

getSaltingMode()

getSaltingMode() : integer

Getter for the salt mode code property.

Returns

integer —

The salt mode code.

setDigestFormat()

setDigestFormat(integer  $digestFormat) : $this

Setter for the digest format code property.

Parameters

integer $digestFormat

The digest format code.

Throws

\Exception

Validation errors.

Returns

$this —

The hash algorithm object.

getDigestFormat()

getDigestFormat() : integer

Getter for the digest format code property.

Returns

integer —

The digest format code.

saltAtFront()

saltAtFront(string  $data) 

Internal method for grouping salting modes that add to the front of the input data.

Parameters

string $data

The input data for hashing.

saltAtBack()

saltAtBack(string  $data) 

Internal method for grouping salting modes that add to the back of the input data.

Parameters

string $data

The input data for hashing.

saltAtSpecial()

saltAtSpecial(string  $data) 

Internal method for grouping salting modes that use complex manipulations of the salt and input data.

Parameters

string $data

The input data for hashing.

addSaltString()

addSaltString(string  $data) : string

Internal method for adding the salt string to the input data via the chosen salting mode.

Parameters

string $data

The input data for hashing.

Returns

string —

The input data with proper salting.

changeOutputFormat()

changeOutputFormat(string  $digest) : string

Internal method for converting the digest's output format representation via the chosen format.

Parameters

string $digest

The output digest.

Returns

string —

The input data with proper salting.