W3cubDocs

/WordPress

wp_hash( string $data, string $scheme = ‘auth’ ): string

Gets hash of given string.

Parameters

$datastringrequired
Plain text to hash.
$schemestringoptional
Authentication scheme (auth, secure_auth, logged_in, nonce).

Default:'auth'

Return

string Hash of $data.

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.

Source

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

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

Changelog

Version Description
2.0.3 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_hash