0

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
Artjom B.
  • 61,146
  • 24
  • 125
  • 222
dao hodac
  • 361
  • 2
  • 5
  • 14
  • Reason: https://stackoverflow.com/a/37445613/1816580, you will probably have to fork it and adjust it. – Artjom B. Aug 06 '17 at 10:08
  • It seems that it is not the problem. I have reduced it to a key encoding issue. I have created a new post here: https://stackoverflow.com/q/45533172/1566975?sem=2 Could you have a look @ArtjomB.? – dao hodac Aug 06 '17 at 14:52
  • Please read that answer again. It seems you haven't understood where the difference is. – Artjom B. Aug 06 '17 at 16:22
  • @ArtjomB. I have tried it and it seems it has nothing to do. I have added the encoding and I have the exact same result: changed `.update("hey")` into `.update("hey", 'utf-8')` to specify the encoding See my comment in the question https://stackoverflow.com/q/45533172/1566975?sem=2 – dao hodac Aug 06 '17 at 17:17
  • @ArtjomB. to stick with https://stackoverflow.com/a/37445613/1816580 I have added the encoding to the `update` call in https://stackoverflow.com/q/45533172/1566975?sem=2, and the result is the same – dao hodac Aug 07 '17 at 06:02

1 Answers1

0

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

dao hodac
  • 361
  • 2
  • 5
  • 14