WP_Session_Tokens::hash_token()privateWP 4.0.0

Hashes the given session token for storage.

Method of the class: WP_Session_Tokens{}

No Hooks.

Return

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

Usage

// private - for code of main (parent) class only
$result = $this->hash_token( $token );
$token(string) (required)
Session token to hash.

Changelog

Since 4.0.0 Introduced.

WP_Session_Tokens::hash_token() code WP 6.5.2

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 );
	}
}