本文整理汇总了PHP中_hash_hmac函数的典型用法代码示例。如果您正苦于以下问题:PHP _hash_hmac函数的具体用法?PHP _hash_hmac怎么用?PHP _hash_hmac使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_hash_hmac函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: make_downloadurl
function make_downloadurl($sha1, $filesize, $filename)
{
global $_G;
$filename = trim($filename, ' "');
// Discuz! 默认的filename两侧会加上 双引号
$filename = diconv($filename, CHARSET, 'UTF-8');
$filename = str2hex($filename);
$filename = strtolower($filename[1]);
$post = 'http://dz.xf.qq.com/ftn.php?v=1&&';
$k = _hash_hmac('sha1', sprintf('%s|%s|%s', $sha1, $_G['timestamp'], $_G['setting']['ftn_site_id']), $_G['setting']['xf_storage_enc_key']);
$parm = array('site_id' => $_G['setting']['ftn_site_id'], 't' => $_G['timestamp'], 'sha1' => $sha1, 'filesize' => $filesize, 'filename' => $filename, 'k' => $k, 'ip' => $_G['clientip']);
return $post . cloud_http_build_query($parm, '', '&&');
}
示例2: hash_hmac
function hash_hmac($algo, $data, $key, $raw_output = false)
{
return _hash_hmac($algo, $data, $key, $raw_output);
}
示例3: test_hash_hmac_output
function test_hash_hmac_output()
{
$this->assertEquals(array(1 => '140d1cb79fa12e2a31f32d35ad0a2723'), unpack('H32', _hash_hmac('md5', 'simple', 'key', true)));
$this->assertEquals(array(1 => '993003b95758e0ac2eba451a4c5877eb1bb7b92a'), unpack('H40', _hash_hmac('sha1', 'simple', 'key', true)));
}