MigratingPasswordHasher
in package
implements
PasswordHasherInterface
FinalYes
Hashes passwords using the best available hasher.
Verifies them using a chain of hashers.
/!\ Don't put a PlaintextPasswordHasher in the list as that'd mean a leaked hash could be used to authenticate successfully without knowing the cleartext password.
Tags
Table of Contents
Interfaces
- PasswordHasherInterface
- Provides password hashing capabilities.
Properties
- $bestHasher : mixed
- $extraHashers : array<string|int, mixed>
Methods
- __construct() : mixed
- hash() : string
- Hashes a plain password.
- needsRehash() : bool
- Checks if a password hash would benefit from rehashing.
- verify() : bool
- Verifies a plain password against a hash.
Properties
$bestHasher
private
mixed
$bestHasher
$extraHashers
private
array<string|int, mixed>
$extraHashers
Methods
__construct()
public
__construct(PasswordHasherInterface $bestHasher, PasswordHasherInterface ...$extraHashers) : mixed
Parameters
- $bestHasher : PasswordHasherInterface
- $extraHashers : PasswordHasherInterface
hash()
Hashes a plain password.
public
hash(string $plainPassword[, string $salt = null ]) : string
Parameters
- $plainPassword : string
- $salt : string = null
Return values
stringneedsRehash()
Checks if a password hash would benefit from rehashing.
public
needsRehash(string $hashedPassword) : bool
Parameters
- $hashedPassword : string
Return values
boolverify()
Verifies a plain password against a hash.
public
verify(string $hashedPassword, string $plainPassword[, string $salt = null ]) : bool
Parameters
- $hashedPassword : string
- $plainPassword : string
- $salt : string = null