Creates a hash of a plain text password.
Description
For integration with other applications, this function can be overwritten to instead use the other package password hashing algorithm.
Parameters
$password
stringrequired- Plain text user password to hash.
Source
function wp_hash_password( $password ) {
global $wp_hasher;
if ( empty( $wp_hasher ) ) {
require_once ABSPATH . WPINC . '/class-phpass.php';
// By default, use the portable hash from phpass.
$wp_hasher = new PasswordHash( 8, true );
}
return $wp_hasher->HashPassword( trim( $password ) );
}
Changelog
Version | Description |
---|---|
2.5.0 | Introduced. |
Compare an already hashed password with its plain-text string:
Use Blowfish or extended DES (if available) instead of MD5 to hash the password with 16 rounds of hashing: