Documentation

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
author

Nicolas Grekas p@tchwork.com

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

Methods

hash()

Hashes a plain password.

public hash(string $plainPassword[, string $salt = null ]) : string
Parameters
$plainPassword : string
$salt : string = null
Return values
string

needsRehash()

Checks if a password hash would benefit from rehashing.

public needsRehash(string $hashedPassword) : bool
Parameters
$hashedPassword : string
Return values
bool

verify()

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
Return values
bool

        
On this page

Search results