Make our hash_hmac compatibility function unit testable even when the real one exists. See #10284.
git-svn-id: https://develop.svn.wordpress.org/trunk@11920 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
2cac41ba40
commit
772b9e3392
|
@ -58,6 +58,11 @@ if (!function_exists('stripos')) {
|
||||||
|
|
||||||
if ( !function_exists('hash_hmac') ):
|
if ( !function_exists('hash_hmac') ):
|
||||||
function hash_hmac($algo, $data, $key, $raw_output = false) {
|
function hash_hmac($algo, $data, $key, $raw_output = false) {
|
||||||
|
return _hash_hmac($algo, $data, $key, $raw_output);
|
||||||
|
}
|
||||||
|
endif;
|
||||||
|
|
||||||
|
function _hash_hmac($algo, $data, $key, $raw_output = false) {
|
||||||
$packs = array('md5' => 'H32', 'sha1' => 'H40');
|
$packs = array('md5' => 'H32', 'sha1' => 'H40');
|
||||||
|
|
||||||
if ( !isset($packs[$algo]) )
|
if ( !isset($packs[$algo]) )
|
||||||
|
@ -75,7 +80,6 @@ function hash_hmac($algo, $data, $key, $raw_output = false) {
|
||||||
|
|
||||||
return $algo($opad . pack($pack, $algo($ipad . $data)));
|
return $algo($opad . pack($pack, $algo($ipad . $data)));
|
||||||
}
|
}
|
||||||
endif;
|
|
||||||
|
|
||||||
if ( !function_exists('mb_substr') ):
|
if ( !function_exists('mb_substr') ):
|
||||||
function mb_substr( $str, $start, $length=null, $encoding=null ) {
|
function mb_substr( $str, $start, $length=null, $encoding=null ) {
|
||||||
|
|
Loading…
Reference in New Issue