mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
New secure cookie protocol. see #5367
git-svn-id: https://develop.svn.wordpress.org/trunk@6387 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -147,6 +147,27 @@ if (!function_exists('stripos')) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('hash_hmac') ):
|
||||
function hash_hmac($algo, $data, $key, $raw_output = false) {
|
||||
$packs = array('md5' => 'H32', 'sha1' => 'H40');
|
||||
|
||||
if ( !isset($packs[$algo]) )
|
||||
return false;
|
||||
|
||||
$pack = $packs[$algo];
|
||||
|
||||
if (strlen($key) > 64)
|
||||
$key = pack($pack, $algo($key));
|
||||
else if (strlen($key) < 64)
|
||||
$key = str_pad($key, 64, chr(0));
|
||||
|
||||
$ipad = (substr($key, 0, 64) ^ str_repeat(chr(0x36), 64));
|
||||
$opad = (substr($key, 0, 64) ^ str_repeat(chr(0x5C), 64));
|
||||
|
||||
return $algo($opad . pack($pack, $algo($ipad . $data)));
|
||||
}
|
||||
endif;
|
||||
|
||||
// Added in PHP 4.3.0?
|
||||
if (!defined('IMAGETYPE_GIF'))
|
||||
define('IMAGETYPE_GIF', 1);
|
||||
|
||||
Reference in New Issue
Block a user