Comparing version 0.10.1 to 0.11.0
@@ -992,3 +992,2 @@ // Utils | ||
a = a.clone(); | ||
assert(a.cmpn(0) !== 0); | ||
@@ -1246,3 +1245,4 @@ var x2 = new BN(0); | ||
p224: null, | ||
p192: null | ||
p192: null, | ||
p25519: null | ||
}; | ||
@@ -1311,2 +1311,10 @@ | ||
function P25519() { | ||
// 2 ^ 255 - 19 | ||
MPrime.call( | ||
this, | ||
'7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); | ||
} | ||
inherits(P25519, MPrime); | ||
// Exported mostly for testing purposes, use plain name instead | ||
@@ -1325,2 +1333,4 @@ BN._prime = function prime(name) { | ||
prime = new P192(); | ||
else if (name === 'p25519') | ||
prime = new P25519(); | ||
else | ||
@@ -1430,3 +1440,4 @@ throw new Error('Unknown prime ' + name); | ||
Red.prototype.sqrt = function sqrt(a) { | ||
assert(a.cmpn(0) !== 0); | ||
if (a.cmpn(0) === 0) | ||
return a.clone(); | ||
@@ -1488,3 +1499,3 @@ var mod3 = this.m.andln(3); | ||
if (inv.sign) | ||
return this.imod(inv).redNeg(); | ||
return this.imod(inv.neg()).redNeg(); | ||
else | ||
@@ -1491,0 +1502,0 @@ return this.imod(inv); |
{ | ||
"name": "bn.js", | ||
"version": "0.10.1", | ||
"version": "0.11.0", | ||
"description": "Big number implementation in pure javascript", | ||
@@ -5,0 +5,0 @@ "main": "lib/bn.js", |
@@ -118,3 +118,10 @@ var assert = require('assert'); | ||
}); | ||
it('should not fail to invm number mod k256', function() { | ||
var regr2 = new BN( | ||
'6c150c4aa9a8cf1934485d40674d4a7cd494675537bda36d49405c5d2c6f496f', 16); | ||
regr2 = regr2.toRed(BN.red('k256')); | ||
assert.equal(regr2.redInvm().redMul(regr2).fromRed().cmpn(1), 0); | ||
}); | ||
}); | ||
}); |
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
54045
1735