Skip to content

Commit

Permalink
Update ecdsa-test.js, fix test failure
Browse files Browse the repository at this point in the history
new node-bn.js 5.0.0-1 gives error when the string passed to sign function is not in hex format.

       curve secp256k1
         should have `signature.s <= keys.ec.nh`:
�[0m�[31m     Error: Invalid character in hello�[0m�[90m
      at assert (/usr/share/nodejs/bn.js/lib/bn.js:6:21)
      at parseHex (/usr/share/nodejs/bn.js/lib/bn.js:214:5)
      at BN._parseHex (/usr/share/nodejs/bn.js/lib/bn.js:241:11)
      at BN.init [as _init] (/usr/share/nodejs/bn.js/lib/bn.js:97:12)
      at new BN (/usr/share/nodejs/bn.js/lib/bn.js:39:12)
      at EC.sign (lib/elliptic/ec/index.js:99:27)
      at KeyPair.sign (lib/elliptic/ec/key.js:108:18)
      at Context.<anonymous> (test/ecdsa-test.js:64:25)
      at callFn (/usr/lib/nodejs/mocha/lib/runnable.js:354:21)
      at Test.Runnable.run (/usr/lib/nodejs/mocha/lib/runnable.js:346:7)
      at Runner.runTest (/usr/lib/nodejs/mocha/lib/runner.js:442:10)
      at /usr/lib/nodejs/mocha/lib/runner.js:560:12
      at next (/usr/lib/nodejs/mocha/lib/runner.js:356:14)
      at /usr/lib/nodejs/mocha/lib/runner.js:366:7
      at next (/usr/lib/nodejs/mocha/lib/runner.js:290:14)
      at /usr/lib/nodejs/mocha/lib/runner.js:329:7
      at done (/usr/lib/nodejs/mocha/lib/runnable.js:301:5)
      at callFn (/usr/lib/nodejs/mocha/lib/runnable.js:372:7)
      at Hook.Runnable.run (/usr/lib/nodejs/mocha/lib/runnable.js:346:7)
      at next (/usr/lib/nodejs/mocha/lib/runner.js:304:10)
      at Immediate._onImmediate (/usr/lib/nodejs/mocha/lib/runner.js:334:5)
�[0m
  • Loading branch information
LocutusOfBorg committed Sep 4, 2019
1 parent 71e4e8e commit 228cfc3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/ecdsa-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('ECDSA', function() {

it('should have `signature.s <= keys.ec.nh`', function() {
// key.sign(msg, options)
var sign = keys.sign('hello', { canonical: true });
var sign = keys.sign(msg, { canonical: true });
assert(sign.s.cmp(keys.ec.nh) <= 0);
});

Expand Down

0 comments on commit 228cfc3

Please sign in to comment.