通知功能
36587

hmac函数未定义已解决悬赏5积分

提问者MES答案数1阅读数1335发表时间2019-08-22 11:43:32


禅道版本:11.6.stable

安装包类型:源码包

操作系统:CentOS

客户端浏览器:Chrome

设置备注
内容
答案列表
2019/08/22 最佳答案

提示的这个文件,打开,然后追加下下面代码,看下呢?

/**
 * Calculate an MD5 HMAC hash.
 * Works like hash_hmac('md5', $data, $key)
 * in case that function is not available.
 *
 * @param string $data The data to hash
 * @param string $key  The key to hash with
 *
 * @return string
 */
protected function hmac($data, $key)
{
    if (function_exists('hash_hmac')) {
        return hash_hmac('md5', $data, $key);
    }
    // The following borrowed from
    // http://php.net/manual/en/function.mhash.php#27225
    // RFC 2104 HMAC implementation for php.
    // Creates an md5 HMAC.
    // Eliminates the need to install mhash to compute a HMAC
    // by Lance Rushing
    $bytelen = 64; // byte length for md5
    if (strlen($key) > $bytelen) {
        $key = pack('H*', md5($key));
    }
    $key = str_pad($key, $bytelen, chr(0x00));
    $ipad = str_pad('', $bytelen, chr(0x36));
    $opad = str_pad('', $bytelen, chr(0x5c));
    $k_ipad = $key ^ $ipad;
    $k_opad = $key ^ $opad;
    return md5($k_opad . pack('H*', md5($k_ipad . $data)));
}


🍟
MES2019/08/22
使用该函数,问题解决。
回复
联系我们
联系人
张淑钧/高级客户经理
电话(微信)
13156280939
QQ号码
2082428410
联系邮箱
zhangshujun@chandao.com
其他相关问答
35004
已解决
悬赏10积分
提问者: damizao 于 2019-04-171154次浏览,1个答案
提问者: jack_yuen 于 2021-04-28922次浏览,1个答案
提问者: john_yan008 于 2018-05-141986次浏览,1个答案
提问者: iwub 于 2014-10-248032次浏览,2个答案
返回顶部
客服头像
张淑钧
高级客户经理
客服微信
13156280939
2082428410
统一服务热线 4006-8899-23
我要提问提问有任何问题,您都可以在这里提问。问题反馈反馈点击这里,让我们聆听您的建议与反馈。