interface PasswordHashingStrategyInterface (View source)

A password hashing strategy interface

Methods

string
hashPassword(string $password, string $staticSalt = null)

Hash a password for storage

bool
validatePassword(string $password, string $hashedPasswordAndSalt, string $staticSalt = null)

Validate a hashed password against a cleartext password

Details

string hashPassword(string $password, string $staticSalt = null)

Hash a password for storage

Parameters

string $password

Cleartext password that will be hashed

string $staticSalt

Optional static salt that will not be stored in the hashed password

Return Value

string

The hashed password with dynamic salt (if used)

bool validatePassword(string $password, string $hashedPasswordAndSalt, string $staticSalt = null)

Validate a hashed password against a cleartext password

Parameters

string $password
string $hashedPasswordAndSalt

Hashed password with dynamic salt (if used)

string $staticSalt

Optional static salt that will not be stored in the hashed password

Return Value

bool

true if the given cleartext password matched the hashed password