Back to MD5Handler class

Method hashPassword

public string
hashPassword
(mixed $plaintext, array $options = [])
Generate a hash for a plaintext password
Parameters
  • string $pla intext The plaintext password to validate
  • array $options Options for the hashing operation
Returns
  • string
Since
  • 4.0.0
Class: MD5Handler
Project: Joomla

Method hashPassword - Source code

/**
 * Generate a hash for a plaintext password
 *
 * @param   string  $plaintext  The plaintext password to validate
 * @param   array   $options    Options for the hashing operation
 *
 * @return  string
 *
 * @since   4.0.0
 */
public function hashPassword($plaintext, array $options = [])
{
    $salt = UserHelper::genRandomPassword(32);
    $crypted = md5($plaintext . $salt);
    return $crypted . ':' . $salt;
}