[英]How to generate hash_hmac sha1 php?
I have two problem with hmac 我的hmac有两个问题
First: 第一:
$klucz = "";
$url = "";
$nazwaUsera = "";
$nazwaKlucza = "faktura";
$curlHandle = curl_init($url);
$hashWiadomosci = hmac($klucz, $url .$nazwaUsera.$nazwaKlucza);
$headers = array(
'Accept: application/pdf',
'Content-type: application/pdf; charset = UTF-8',
'Authentication: IAPIS user='.$nazwaUsera.', hmac-
sha1='.$hashWiadomosci
);
if is hmac problem is: Fatal error: Uncaught Error: Call to undefined function hmac() 如果是hmac,问题是:致命错误:未捕获的错误:调用未定义函数hmac()
Bat if is 蝙蝠如果是
$klucz = "";
$url = "";
$nazwaUsera = "";
$nazwaKlucza = "faktura";
$curlHandle = curl_init($url);
$hashWiadomosci = hash_hmac($klucz, $url, $nazwaUsera.$nazwaKlucza);
$headers = array(
'Accept: application/pdf',
'Content-type: application/pdf; charset = UTF-8',
'Authentication: IAPIS user='.$nazwaUsera.', hmac-
sha1='.$hashWiadomosci
);
problem is: Warning: hash_hmac(): Unknown hashing algorithm: EC8A18CEC9D1F1B2 问题是:警告:hash_hmac():未知的哈希算法:EC8A18CEC9D1F1B2
how solved this? 如何解决呢?
Try this: 尝试这个:
hashWiadomosci = hash_hmac('sha256', $klucz . $url, $nazwaUsera.$nazwaKlucza);
First parameter must be the hash algorithm you need to be used (you can call hash_algos
to inspect supported algorithms in your platform. IE md5", "sha256", "haval160,4". 第一个参数必须是您需要使用的哈希算法(您可以调用hash_algos
来检查平台中支持的算法hash_algos
“,” sha256“,” haval160,4“。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.