Make our hash_hmac compatibility function unit testable even when the real one exists. See #10284.

git-svn-id: http://svn.automattic.com/wordpress/trunk@11920 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2009-09-12 08:26:44 +00:00
parent 7b6e0b16b8
commit b45dcf2df5
1 changed files with 5 additions and 1 deletions

View File

@ -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 ) {