Class

Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder

class MessageDigestPasswordEncoder extends BasePasswordEncoder

MessageDigestPasswordEncoder uses a message digest algorithm.

Constants

MAX_PASSWORD_LENGTH

Methods

__construct(string $algorithm = 'sha512', bool $encodeHashAsBase64 = true, int $iterations = 5000)

Constructor.

string encodePassword(string $raw, string $salt)

Encodes the raw password.

bool isPasswordValid(string $encoded, string $raw, string $salt)

Checks a raw password against an encoded password.

Details

at line 34
public __construct(string $algorithm = 'sha512', bool $encodeHashAsBase64 = true, int $iterations = 5000)

Constructor.

Parameters

string $algorithm The digest algorithm to use
bool $encodeHashAsBase64 Whether to base64 encode the password hash
int $iterations The number of iterations to use to stretch the password hash

at line 44
public string encodePassword(string $raw, string $salt)

Encodes the raw password.

Parameters

string $raw The password to encode
string $salt The salt

Return Value

string The encoded password

at line 68
public bool isPasswordValid(string $encoded, string $raw, string $salt)

Checks a raw password against an encoded password.

Parameters

string $encoded An encoded password
string $raw A raw password
string $salt The salt

Return Value

bool true if the password is valid, false otherwise