class Passwords

Password Hashing.

Methods

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

Chooses which secure algorithm is used for hashing and how to configure it.

string
hash(string $password)

Computes password´s hash. The result contains the algorithm ID and its settings, cryptographical salt and the hash itself.

bool
verify(string $password, string $hash)

Finds out, whether the given password matches the given hash.

bool
needsRehash(string $hash)

Finds out if the hash matches the options given in constructor.

Details

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

Chooses which secure algorithm is used for hashing and how to configure it.

Parameters

string $algo
array $options

See also

https://php.net/manual/en/password.constants.php

at line 40
string hash(string $password)

Computes password´s hash. The result contains the algorithm ID and its settings, cryptographical salt and the hash itself.

Parameters

string $password

Return Value

string

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

Finds out, whether the given password matches the given hash.

Parameters

string $password
string $hash

Return Value

bool

at line 67
bool needsRehash(string $hash)

Finds out if the hash matches the options given in constructor.

Parameters

string $hash

Return Value

bool

Traits

SmartObject