WC_Session_Handler::verify_hashprivateWC 1.0

Verify a hash using wp_verify_fast_hash (from WP 6.8 onwards).

This method can be removed when the minimum version supported is 6.8.

Method of the class: WC_Session_Handler{}

No Hooks.

Returns

true|false. Whether the hash is valid.

Usage

// private - for code of main (parent) class only
$result = $this->verify_hash( $message, $hash );
$message(string) (required)
Message to verify.
$hash(string) (required)
Hash to verify.

WC_Session_Handler::verify_hash() code WC 10.3.3

private function verify_hash( string $message, string $hash ) {
	if ( function_exists( 'wp_verify_fast_hash' ) ) {
		return wp_verify_fast_hash( $message, $hash );
	}
	return hash_equals( hash_hmac( 'md5', $message, wp_hash( $message ) ), $hash );
}