Codex

Function Reference/wp hash password

Contents

Description

This function can be replaced via plugins. If plugins do not redefine these functions, then this will be used instead.

Create a hash (encrypt) of a plain text password.

For integration with other applications, this function can be overwritten to instead use the other package password checking algorithm.

Usage

<?php wp_hash_password$password ?>

Parameters

$password
(string) (required) Plain text user password to hash.
Default: None

Return Values

(string) 
The hash string of the password.

Examples

Compare an already hashed password with it's plain-text string:

<?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";
}
?>

Notes

  • This function can be replaced via plugins. If plugins do not redefine these functions, then this will be used instead.
  • Uses: PasswordHash::HashPassword()
  • Uses global: (unknown type) $wp_hasher

Change Log

  • Since: 2.5

Source File

wp_hash_password() is located in wp-includes/pluggable.php.

Related

See also index of Function Reference and index of Template Tags.