This function can be replaced via plugins. If plugins do not redefine these functions, then this will be used instead.
Creates a hash of a plain text password. Unless the global $wp_hasher is set, the default implementation uses PasswordHash
, which adds salt to the password and hashes it with 8 passes of MD5. MD5 is used by default because it's supported on all platforms. You can configure PasswordHash
to use Blowfish or extended DES (if available) instead of MD5 with the $portable_hashes constructor argument or property (see examples).
For integration with other applications, this function can be overwritten to instead use the other package password checking algorithm.
<?php $hash = wp_hash_password( $password ) ?>
<?php
$wp_hasher = new PasswordHash(8, TRUE);
$password_hashed = '$P$B55D6LjfHDkINU5wF.v2BuuzO0/XPk/';
$plain_password = 'test';
if($wp_hasher->CheckPassword($plain_password, $password_hashed)) {
echo "YES, Matched";
} else {
echo "No, Wrong Password";
}
?>
Use Blowfish or extended DES (if available) instead of MD5 to hash the password with 16 rounds of hashing:
$wp_hasher = new PasswordHash(16, FALSE);
$hashedPassword = wp_hash_password($password);
wp_hash_password() is located in wp-includes/pluggable.php
.
wp_hash_password(), wp_set_password()