W3cubDocs

/WordPress

WP_Session_Tokens::hash_token( string $token ): string

Hashes the given session token for storage.

Parameters

$tokenstringrequired
Session token to hash.

Return

string A hash of the session token (a verifier).

Source

private function hash_token( $token ) {
	// If ext/hash is not present, use sha1() instead.
	if ( function_exists( 'hash' ) ) {
		return hash( 'sha256', $token );
	} else {
		return sha1( $token );
	}
}

Changelog

Version Description
4.0.0 Introduced.

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