Comparing version 0.16.0 to 1.0.0
{ | ||
"name": "elliptic", | ||
"version": "0.16.0", | ||
"version": "1.0.0", | ||
"description": "EC cryptography", | ||
@@ -31,7 +31,7 @@ "main": "lib/elliptic.js", | ||
"dependencies": { | ||
"bn.js": "^0.16.0", | ||
"bn.js": "^1.0.0", | ||
"brorand": "^1.0.1", | ||
"hash.js": "^0.3.2", | ||
"hash.js": "^1.0.0", | ||
"inherits": "^2.0.1" | ||
} | ||
} |
@@ -77,2 +77,14 @@ var assert = require('assert'); | ||
it('should compute this problematic secp256k1 multiplication', function() { | ||
var curve = elliptic.curves.secp256k1.curve; | ||
var g1 = curve.g; // precomputed g | ||
assert(g1.precomputed); | ||
var g2 = curve.point(g1.getX(), g1.getY()); // not precomputed g | ||
assert(!g2.precomputed); | ||
var a = new bn('6d1229a6b24c2e775c062870ad26bc261051e0198c67203167273c7c62538846', 16); | ||
var p1 = g1.mul(a); | ||
var p2 = g2.mul(a); | ||
assert(p1.eq(p2)); | ||
}); | ||
it('should not fail on secp256k1 regression', function() { | ||
@@ -102,2 +114,26 @@ var curve = elliptic.curves.secp256k1.curve; | ||
it('should correctly double the affine point on secp256k1', function() { | ||
var bad = { | ||
x: '026a2073b1ef6fab47ace18e60e728a05180a82755bbcec9a0abc08ad9f7a3d4', | ||
y: '9cd8cb48c3281596139f147c1364a3ede88d3f310fdb0eb98c924e599ca1b3c9', | ||
z: 'd78587ad45e4102f48b54b5d85598296e069ce6085002e169c6bad78ddc6d9bd' | ||
}; | ||
var good = { | ||
x: 'e7789226739ac2eb3c7ccb2a9a910066beeed86cdb4e0f8a7fee8eeb29dc7016', | ||
y: '4b76b191fd6d47d07828ea965e275b76d0e3e0196cd5056d38384fbb819f9fcb', | ||
z: 'cbf8d99056618ba132d6145b904eee1ce566e0feedb9595139c45f84e90cfa7d' | ||
}; | ||
var curve = elliptic.curves.secp256k1.curve; | ||
bad = curve.jpoint(bad.x, bad.y, bad.z); | ||
good = curve.jpoint(good.x, good.y, good.z); | ||
// They are the same points | ||
assert(bad.add(good.neg()).isInfinity()); | ||
// But doubling borks them out | ||
assert(bad.dbl().add(good.dbl().neg()).isInfinity()); | ||
}); | ||
it('should store precomputed values correctly on negation', function() { | ||
@@ -104,0 +140,0 @@ var curve = elliptic.curves.secp256k1.curve; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
136411
3612
0
+ Addedbn.js@1.3.0(transitive)
+ Addedhash.js@1.1.7(transitive)
+ Addedminimalistic-assert@1.0.1(transitive)
- Removedbn.js@0.16.1(transitive)
- Removedhash.js@0.3.2(transitive)
Updatedbn.js@^1.0.0
Updatedhash.js@^1.0.0