wp_hash() WordPress Function

The wp_hash() function is used to create a hash of a given string. This function is used by the WordPress software to create password hashes.

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

Get hash of given string.


Parameters

$data

(string)(Required)Plain text to hash

$scheme

(string)(Optional)Authentication scheme (auth, secure_auth, logged_in, nonce)

Default value: 'auth'


Top ↑

Return

(string) Hash of $data


Top ↑

More Information

Usage:
wp_hash( $data, $scheme );
Notes:
  • This function can be replaced via plugins. If plugins do not redefine these functions, then this will be used instead.
  • Uses: wp_salt() Get WordPress salt.

Top ↑

Source

File: wp-includes/pluggable.php

	function wp_hash( $data, $scheme = 'auth' ) {
		$salt = wp_salt( $scheme );

		return hash_hmac( 'md5', $data, $salt );
	}


Top ↑

Changelog

Changelog
VersionDescription
2.0.3Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by the Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More