我有兩個問題,HMAC如何生成hash_hmac sha1 php?
第一:
$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
);
如果是HMAC問題是:致命錯誤:未捕獲的錯誤:調用未定義功能HMAC()
蝙蝠如果是
$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
);
問題是:警告:hash_hmac():未知哈希算法:EC8A18CEC9D1F1B2
這個怎麼解決?
好像你正在使用的哈希錯誤的語法它試圖解釋你輸入'EC8A18CEC9D1F1B2'作爲哈希函數的名稱/參數 – RuDevel