Encryption
Encryption
Credential hashing options for Hazaar\Auth\Adapter.
class Encryption extends \Hazaar\Model\StructExtends: Hazaar\Model\Struct
By default credentials are hashed with PHP's password_hash() (bcrypt, or whatever PASSWORD_DEFAULT is), which salts every hash and is slow to brute-force. The hash, count, salt and useIdentity options configure the legacy digest method, which is still used to verify credentials stored before the switch.
Properties
method
How new credential hashes are made: password (password_hash(), the default) or digest (the legacy
public string $method = 'password'Type: string
hash/count/salt chain, only for data that other systems must also read).
Either way, stored password_hash() hashes and legacy digests both verify, and with password a legacy digest is replaced with a password_hash() hash the next time its user logs in, if the adapter can store it.
hash
The hash algorithm(s) the digest method uses to encrypt credentials. Either a single algorithm name
public array|string $hash = 'sha1'Type: array|string
(e.g. sha256) or an array of algorithm names applied in order, each iteration appending the original credential (and salt, if set) before hashing with the next algorithm.
count
The number of times to "hash the hash" for extra obfuscation.
public int $count = 1Type: int
salt
Value appended to the credential (and hash, on subsequent iterations) before hashing.
public mixed $salt = 'hazaar-default-salt'Type: mixed
useIdentity
Whether to prepend the identity to the credential before hashing.
public bool $useIdentityType: bool
Generated by Hazaar API Doc Generator on Thu, 22 Oct 2026 05:05:29 +0000