Skip to content

Hash

  • Full name: \Zemit\Mvc\Model\Traits\Hash

Methods

hash

Hash a string

public hash(string $string, string|null $salt = null, string|null $workFactor = null): string

Parameters:

Parameter Type Description
$string string The string to be hashed
$salt **string null**
$workFactor **string null**

Return Value:

The salted hash value of the input string


checkHash

Checks whether a given hash is valid for a given string.

public checkHash(string|null $hash = null, string|null $string = null, int $maxPassLength): bool

Parameters:

Parameter Type Description
$hash **string null**
$string **string null**
$maxPassLength int The maximum length of the password.

Return Value:

Returns true if the hash is valid for the string, false otherwise.