Documentation

MessageDigestPasswordHasher
in package
implements LegacyPasswordHasherInterface Uses CheckPasswordLengthTrait

MessageDigestPasswordHasher uses a message digest algorithm.

Tags
author

Fabien Potencier fabien@symfony.com

Table of Contents

Interfaces

LegacyPasswordHasherInterface
Provides password hashing and verification capabilities for "legacy" hashers that require external salts.

Properties

$algorithm  : string
$encodeHashAsBase64  : bool
$hashLength  : int
$iterations  : int

Methods

__construct()  : mixed
hash()  : string
Hashes a plain password.
needsRehash()  : bool
verify()  : bool
Checks that a plain password and a salt match a password hash.
isPasswordTooLong()  : bool
mergePasswordAndSalt()  : string

Properties

Methods

__construct()

public __construct([string $algorithm = 'sha512' ][, bool $encodeHashAsBase64 = true ][, int $iterations = 5000 ]) : mixed
Parameters
$algorithm : string = 'sha512'

The digest algorithm to use

$encodeHashAsBase64 : bool = true

Whether to base64 encode the password hash

$iterations : int = 5000

The number of iterations to use to stretch the password hash

hash()

Hashes a plain password.

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

needsRehash()

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

verify()

Checks that a plain password and a salt match a password hash.

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

isPasswordTooLong()

private isPasswordTooLong(string $password) : bool
Parameters
$password : string
Return values
bool

mergePasswordAndSalt()

private mergePasswordAndSalt(string $password, string|null $salt) : string
Parameters
$password : string
$salt : string|null
Return values
string

        
On this page

Search results