class Passwords

Password hashing and verification.

Methods

__construct(string $algo = PASSWORD_DEFAULT, array $options = [])

Configures the hashing algorithm and its options.

string
hash(string $password)

Computes a password hash containing the algorithm ID, settings, salt, and the hash itself.

bool
verify(string $password, string $hash)

Checks whether the password matches the given hash.

bool
needsRehash(string $hash)

Checks whether the hash needs to be rehashed with the current algorithm and options.

Details

at line 21
__construct(string $algo = PASSWORD_DEFAULT, array $options = [])

Configures the hashing algorithm and its options.

Parameters

string $algo
array $options

at line 32
string hash(string $password)

Computes a password hash containing the algorithm ID, settings, salt, and the hash itself.

Parameters

string $password

Return Value

string

at line 53
bool verify(string $password, string $hash)

Checks whether the password matches the given hash.

Parameters

string $password
string $hash

Return Value

bool

at line 66
bool needsRehash(string $hash)

Checks whether the hash needs to be rehashed with the current algorithm and options.

Parameters

string $hash

Return Value

bool