hash_hmac()WP 3.2.0

Compat function to mimic hash_hmac().

The Hash extension is bundled with PHP by default since PHP 5.1.2. However, the extension may be explicitly disabled on select servers. As of PHP 7.4.0, the Hash extension is a core PHP extension and can no longer be disabled. I.e. when PHP 7.4.0 becomes the minimum requirement, this polyfill and the associated _hash_hmac() function can be safely removed.

No Hooks.

Return

String|false. The hash in output determined by $binary. False if $algo is unknown or invalid.

Usage

hash_hmac( $algo, $data, $key, $binary );
$algo(string) (required)
Hash algorithm. Accepts 'md5' or 'sha1'.
$data(string) (required)
Data to be hashed.
$key(string) (required)
Secret key to use for generating the hash.
$binary(true|false)
Whether to output raw binary data (true), or lowercase hexits (false).
Default: false

Notes

Changelog

Since 3.2.0 Introduced.

hash_hmac() code WP 6.5.2

function hash_hmac( $algo, $data, $key, $binary = false ) {
	return _hash_hmac( $algo, $data, $key, $binary );
}