HMAC根据节点版本(付费箱模块) [英] HMAC changes according to node version (paybox module)

查看:137
本文介绍了HMAC根据节点版本(付费箱模块)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 https://www.npmjs.com/package/paybox 和我需要升级我的节点版本(从5.6到6+)

正如您在下面看到的, generateHMAC 创建一个散列,如果我更改我的节点版本,它会有所不同。

你能帮我理解这一点,并告诉我它是否会危及某些东西(也许它是好的?几种哈希值都可以?)

以下是我的代码片段:

 use strict; 
const paybox = require('./ node_modules / paybox / lib / paybox.js')

let calculated_hmac = paybox.generateHMAC({a:12},'aaaaaaabbbbbbbcccccccc1111122233');
console.log(computed_hmac);

这是节点

的版本5.6.0的结果

  $ node -v 
v5.6.0
$ node testPaybox.sh
D0643202B4AF2A23055933597ACB6CB024A26F7DEBC4798B5AB0AC6242D1C9D0F1BC481B86CEF0505546D1D30F4A6807D193A00E5A4E81F874447BC0EE040D87



以及从6.11.1开始的任何版本(至最新版本)

  $ node -v 
v6.11.1
orange:easy-sport-web dao $ node testPaybox.sh
E5A70879F038F35103524AB5157205C8169DDBAD3B41465D19690F87C64FACB6E098C283812B6D6AC79F23AE7A7DC2B0EEEDF5796E4BFC9DE87A517AFCE7E049


解决方案

由于 https://stackoverflow.com/a/45582931/1566975 更喜欢使用fork https:/ /github.com/daohodac/node-paybox 可解决此问题。


I am using https://www.npmjs.com/package/paybox and I need to upgrade my node version (from 5.6 to 6+)

As you can see below, the generateHMAC creates a hash that differs if I change my version of node.

Can you help me understand this, and tell me if it can compromise something (maybe it is OK? several hashes could be OK?)

Here is my code snippet:

"use strict";
const paybox = require('./node_modules/paybox/lib/paybox.js')

let computed_hmac = paybox.generateHMAC({a:12}, 'aaaaaaabbbbbbbcccccccc1111122233');
console.log(computed_hmac);

Here is the result with version 5.6.0 of node

$ node -v
v5.6.0
$ node testPaybox.sh
D0643202B4AF2A23055933597ACB6CB024A26F7DEBC4798B5AB0AC6242D1C9D0F1BC481B86CEF0505546D1D30F4A6807D193A00E5A4E81F874447BC0EE040D87

and with any version from 6.11.1 (up to the latest)

$ node -v
v6.11.1
orange:easy-sport-web dao$ node testPaybox.sh
E5A70879F038F35103524AB5157205C8169DDBAD3B41465D19690F87C64FACB6E098C283812B6D6AC79F23AE7A7DC2B0EEEDF5796E4BFC9DE87A517AFCE7E049

解决方案

Because of https://stackoverflow.com/a/45582931/1566975 prefer using the fork https://github.com/daohodac/node-paybox that solves the issue

这篇关于HMAC根据节点版本(付费箱模块)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆