class Passwords

Password Hashing.

Methods

__construct($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 33
__construct($algo = PASSWORD_DEFAULT, array $options = [])

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

Parameters

$algo
array $options

See also

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

at line 43
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 63
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 72
bool needsRehash(string $hash)

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

Parameters

string $hash

Return Value

bool

Traits

SmartObject