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 $raw_output. False if $algo is unknown or invalid.
Usage
hash_hmac( $algo, $data, $key, $raw_output );
- $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.
- $raw_output(true/false)
- Whether to output raw binary data (true), or lowercase hexits (false).
Default: false
Notes
- See: _hash_hmac()
Changelog
Since 3.2.0 | Introduced. |
Code of hash_hmac() hash hmac WP 5.6
function hash_hmac( $algo, $data, $key, $raw_output = false ) {
return _hash_hmac( $algo, $data, $key, $raw_output );
}