wp_hash

Get hash of given string.

Description

(string) wp_hash( (string) $data, (string) $scheme = 'auth' ); 

Returns (string)

Hash of $data

Parameters (2)

0. $data (string)
Plain text to hash
1. $scheme — Optional. (string) => 'auth'
Authentication scheme (auth, secure_auth, logged_in, nonce)

Usage

  1. if ( !function_exists( 'wp_hash' ) ) { 
  2. require_once ABSPATH . WPINC . '/pluggable.php'; 
  3.  
  4. // Plain text to hash 
  5. $data = ''; 
  6.  
  7. // Authentication scheme (auth, secure_auth, logged_in, nonce) 
  8. $scheme = 'auth'; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = wp_hash($data, $scheme); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/pluggable.php  
  1. function wp_hash($data, $scheme = 'auth') { 
  2. $salt = wp_salt($scheme); 
  3.  
  4. return hash_hmac('md5', $data, $salt);