interface PasswordHasherInterface (View source)

Hashes and verifies user passwords; the Application layer owns the algorithm and cost settings.

Methods

string
hashPassword(string $password)

Hash a password using the specified method.

bool
verifyPassword(string $password, string $hash)

Verify if a password matches the hashed password.

string
dummyVerificationHash()

A well-formed hash no password matches, for spending the same time on a refusal for a missing account as on a wrong password.

Details

string hashPassword(string $password)

Hash a password using the specified method.

Parameters

string $password

The password to be hashed.

Return Value

string

The hashed password.

Exceptions

InvalidArgumentException

bool verifyPassword(string $password, string $hash)

Verify if a password matches the hashed password.

Parameters

string $password

The password to be verified.

string $hash

The hashed password.

Return Value

bool

True if the password matches, false otherwise.

Exceptions

InvalidArgumentException

string dummyVerificationHash()

A well-formed hash no password matches, for spending the same time on a refusal for a missing account as on a wrong password.

Return Value

string