Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/373.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript php和Node.js中MIGS支付中的Hmac不同_Javascript_Php_Node.js_Hmac - Fatal编程技术网

Javascript php和Node.js中MIGS支付中的Hmac不同

Javascript php和Node.js中MIGS支付中的Hmac不同,javascript,php,node.js,hmac,Javascript,Php,Node.js,Hmac,我正在尝试将MIGS支付网关代码从PHP转换为NODE.js 除了生成hmac哈希代码之外,其他一切都正常 PHP代码 strtoupper(hash_hmac('SHA256',$this->hashInput, pack("H*",$this->secureHashSecret))); Javascript/NODE.js代码 var binKey = new Buffer(SecureSecret,"hex"); var hasheddata = new Buffer(

我正在尝试将
MIGS支付网关代码
PHP
转换为
NODE.js

除了生成hmac哈希代码之外,其他一切都正常
PHP代码

strtoupper(hash_hmac('SHA256',$this->hashInput, pack("H*",$this->secureHashSecret)));
Javascript/NODE.js代码

var binKey = new Buffer(SecureSecret,"hex");

var hasheddata = new Buffer(    
    crypto.createHmac('SHA256',binKey).update(hashvalue).digest('hex')                            
).toString().toUpperCase();   

hashInput和securesecret对于上述两个代码都是相同的,但我总是得到不同的值

对不起,我把Hashvalue的顺序弄乱了。。代码运行正常

因此,如果有人想在这里转换相同的。。享受

对不起,我弄乱了Hashvalue的顺序。。代码运行正常

因此,如果有人想在这里转换相同的。。享受

你能发布完整的源代码吗?我被卡住了,不知道该做什么。你能发布完整的源代码吗?我被卡住了,不知道该做什么