Comparing version 0.11.6 to 0.11.7
2
1.js
@@ -7,3 +7,3 @@ var bn = require('./'); | ||
var c = a.sqr(); | ||
var m = bn.red('k256'); | ||
var m = bn.red('p25519'); | ||
var am = a.toRed(m); | ||
@@ -10,0 +10,0 @@ |
@@ -70,3 +70,3 @@ // Utils | ||
this.words[j] |= (w << off) & 0x3ffffff; | ||
this.words[j + 1] = (w >> (26 - off)) & 0x3ffffff; | ||
this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; | ||
off += 24; | ||
@@ -113,3 +113,3 @@ if (off >= 26) { | ||
this.words[j] |= (w << off) & 0x3ffffff; | ||
this.words[j + 1] |= w >> (26 - off) & 0x3fffff; | ||
this.words[j + 1] |= w >>> (26 - off) & 0x3fffff; | ||
off += 24; | ||
@@ -124,3 +124,3 @@ if (off >= 26) { | ||
this.words[j] |= (w << off) & 0x3ffffff; | ||
this.words[j + 1] |= w >> (26 - off) & 0x3fffff; | ||
this.words[j + 1] |= w >>> (26 - off) & 0x3fffff; | ||
} | ||
@@ -262,3 +262,3 @@ this.strip(); | ||
var word = (((w << off) | carry) & 0xffffff).toString(16); | ||
carry = (w >> (24 - off)) & 0xffffff; | ||
carry = (w >>> (24 - off)) & 0xffffff; | ||
if (carry !== 0 || i !== this.length - 1) | ||
@@ -425,3 +425,3 @@ out = zero6(word) + out; | ||
this.words[i] = r & 0x3ffffff; | ||
carry = r >> 26; | ||
carry = r >>> 26; | ||
} | ||
@@ -431,3 +431,3 @@ for (; carry !== 0 && i < a.length; i++) { | ||
this.words[i] = r & 0x3ffffff; | ||
carry = r >> 26; | ||
carry = r >>> 26; | ||
} | ||
@@ -604,3 +604,3 @@ | ||
rword = lo & 0x3ffffff; | ||
ncarry += lo >> 26; | ||
ncarry += lo >>> 26; | ||
} | ||
@@ -658,3 +658,3 @@ out.words[k] = rword; | ||
rword = lo & 0x3ffffff; | ||
carry += lo >> 26; | ||
carry += lo >>> 26; | ||
} | ||
@@ -692,3 +692,3 @@ this.words[k] = rword; | ||
var s = (bits - r) / 26; | ||
var carryMask = (0x3ffffff >> (26 - r)) << (26 - r); | ||
var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); | ||
@@ -702,3 +702,3 @@ var o = this.clone(); | ||
this.words[i] = c | carry; | ||
carry = newCarry >> (26 - r); | ||
carry = newCarry >>> (26 - r); | ||
} | ||
@@ -734,3 +734,3 @@ if (carry) { | ||
var s = Math.min((bits - r) / 26, this.length); | ||
var mask = 0x3ffffff ^ ((0x3ffffff >> r) << r); | ||
var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); | ||
var maskedWords = extended; | ||
@@ -762,3 +762,3 @@ | ||
var word = this.words[i]; | ||
this.words[i] = (carry << (26 - r)) | (this.words[i] >> r); | ||
this.words[i] = (carry << (26 - r)) | (word >>> r); | ||
carry = word & mask; | ||
@@ -806,3 +806,3 @@ } | ||
if (r !== 0) { | ||
var mask = 0x3ffffff ^ ((0x3ffffff >> r) << r); | ||
var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); | ||
this.words[this.length - 1] &= mask; | ||
@@ -1119,3 +1119,3 @@ } | ||
w += carry; | ||
carry = w >> 26; | ||
carry = w >>> 26; | ||
w &= 0x3ffffff; | ||
@@ -1419,2 +1419,18 @@ this.words[i] = w; | ||
P25519.prototype.imulK = function imulK(num) { | ||
// K = 0x13 | ||
var carry = 0; | ||
for (var i = 0; i < num.length; i++) { | ||
var hi = num.words[i] * 0x13 + carry; | ||
var lo = hi & 0x3ffffff; | ||
hi >>>= 26; | ||
num.words[i] = lo; | ||
carry = hi; | ||
} | ||
if (carry !== 0) | ||
num.words[num.length++] = carry; | ||
return num; | ||
}; | ||
// Exported mostly for testing purposes, use plain name instead | ||
@@ -1421,0 +1437,0 @@ BN._prime = function prime(name) { |
{ | ||
"name": "bn.js", | ||
"version": "0.11.6", | ||
"version": "0.11.7", | ||
"description": "Big number implementation in pure javascript", | ||
@@ -5,0 +5,0 @@ "main": "lib/bn.js", |
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
57596
1857