Native
Native
The default password hasher.
class Native implements \Hazaar\Auth\Interface\PasswordHasherImplements: Hazaar\Auth\Interface\PasswordHasher
New hashes are made with PHP's password_hash(), unless the digest method is configured. Stored password_hash() hashes are checked with password_verify(). Anything else is treated as a legacy digest, made by the hash/count/salt/useIdentity chain in Hazaar\Auth\Adapter\Options\Encryption, and is reported by Hazaar\Auth\Hasher\Native::needsRehash so it can be replaced on the user's next login.
Properties
options
private Encryption $optionsType: Hazaar\Auth\Adapter\Options\Encryption
algo
the password_hash() algorithm for new hashes
private string $algo = 'PASSWORD_DEFAULT'Type: string
Methods
__construct
public __construct(array|Encryption $options, string $algo = 'PASSWORD_DEFAULT'): voidParameters
| Parameter | Type | Description |
|---|---|---|
$options | array | Hazaar\Auth\Adapter\Options\Encryption |
$algo | string | the password_hash() algorithm for new hashes |
hash
public hash(string $password, string $identity): stringReturns: string
Parameters
| Parameter | Type | Description |
|---|---|---|
$password | string | |
$identity | string |
verify
public verify(string $password, string $stored, string $identity): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$password | string | |
$stored | string | |
$identity | string |
needsRehash
A legacy digest needs a rehash, unless the digest method is configured, in which case nothing is ever
public needsRehash(string $stored): boolReturns: bool
rehashed.
Parameters
| Parameter | Type | Description |
|---|---|---|
$stored | string |
digest
Computes the legacy digest of a password, using the hash, count, salt and useIdentity options.
public digest(string $password, string $identity): stringReturns: string
An empty password gives an empty digest, which never matches a stored hash.
Parameters
| Parameter | Type | Description |
|---|---|---|
$password | string | |
$identity | string |
usesPasswordHash
private usesPasswordHash(): boolReturns: bool
Generated by Hazaar API Doc Generator on Wed, 28 Oct 2026 08:43:30 +0000