class SaltedMd5HashingStrategy implements PasswordHashingStrategyInterface (View source)

deprecated since Flow 6.0, will be removed with Flow 7.0

A salted MD5 based password hashing strategy

Methods

static string
generateSaltedMd5(string $clearString)

Generates a salted md5 hash over the given string.

static bool
validateSaltedMd5(string $clearString, string $hashedStringAndSalt)

Tests if the given string would produce the same hash given the specified salt.

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

Hash a password using salted MD5

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

Validate a hashed password using salted MD5

Details

static string generateSaltedMd5(string $clearString)

Generates a salted md5 hash over the given string.

Parameters

string $clearString

The unencrypted string which is the subject to be hashed

Return Value

string

Salted hash and the salt, separated by a comma ","

Exceptions

Exception

static bool validateSaltedMd5(string $clearString, string $hashedStringAndSalt)

Tests if the given string would produce the same hash given the specified salt.

Use this method to validate hashes generated with generateSlatedMd5().

Parameters

string $clearString
string $hashedStringAndSalt

Return Value

bool

true if the clear string matches, otherwise false

Exceptions

InvalidArgumentException

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

Hash a password using salted MD5

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)

Exceptions

Exception

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

Validate a hashed password using salted MD5

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