Comparing version 0.13.0 to 0.13.1
62
1.js
@@ -1,15 +0,53 @@ | ||
var bn = require('./'); | ||
var BN = require('./'); | ||
var p = new bn('c7f1bc1dfb1be82d244aef01228c1409c198894eca9e21430f1669b4aa3864c9f37f3d51b2b4ba1ab9e80f59d267fda1521e88b05117993175e004543c6e3611242f24432ce8efa3b81f0ff660b4f91c5d52f2511a6f38181a7bf9abeef72db056508bbb4eeb5f65f161dd2d5b439655d2ae7081fcc62fdcb281520911d96700c85cdaf12e7d1f15b55ade867240722425198d4ce39019550c4c8a921fc231d3e94297688c2d77cd68ee8fdeda38b7f9a274701fef23b4eaa6c1a9c15b2d77f37634930386fc20ec291be95aed9956801e1c76601b09c413ad915ff03bfdc0b6b233686ae59e8caf11750b509ab4e57ee09202239baee3d6e392d1640185e1cd', 16); | ||
var red = bn.mont(p); | ||
var a = new bn('3f70f29d3f3ae354a6d2536ceafba83cfc787cd91e7acd2b6bde05e62beb8295ae18e3f786726f8d034bbc15bf8331df959f59d431736d5f306aaba63dacec279484e39d76db9b527738072af15730e8b9956a64e8e4dbe868f77d1414a8a8b8bf65380a1f008d39c5fabe1a9f8343929342ab7b4f635bdc52532d764701ff3d8072c475c012ff0c59373e8bc423928d99f58c3a6d9f6ab21ee20bc8e8818fc147db09f60c81906f2c6f73dc69725f075853a89f0cd02a30a8dd86b660ccdeffc292f398efb54088c822774445a6afde471f7dd327ef9996296898a5747726ccaeeceeb2e459df98b4128cb5ab8c7cd20c563f960a1aa770f3c81f13f967b6cc', 16).toRed(red); | ||
var e = new bn('322e393f76a1c22b147e7d193c00c023afb7c1500b006ff1bc1cc8d391fc38bd', 16); | ||
var a = new BN('c7f1bc1dfb1be82d244aef01228c1409' + | ||
'c198894eca9e21430f1669b4aa3864c9' + | ||
'f37f3d51b2b4ba1ab9e80f59d267fda1' + | ||
'521e88b05117993175e004543c6e3611' + | ||
'242f24432ce8efa3b81f0ff660b4f91c' + | ||
'5d52f2511a6f38181a7bf9abeef72db0' + | ||
'56508bbb4eeb5f65f161dd2d5b439655' + | ||
'd2ae7081fcc62fdcb281520911d96700' + | ||
'c85cdaf12e7d1f15b55ade8672407224' + | ||
'25198d4ce39019550c4c8a921fc231d3' + | ||
'e94297688c2d77cd68ee8fdeda38b7f9' + | ||
'a274701fef23b4eaa6c1a9c15b2d77f3' + | ||
'7634930386fc20ec291be95aed995680' + | ||
'1e1c76601b09c413ad915ff03bfdc0b6' + | ||
'b233686ae59e8caf11750b509ab4e57e' + | ||
'e09202239baee3d6e392d1640185e1cd', 16); | ||
var b = new BN('3f70f29d3f3ae354a6d2536ceafba83c' + | ||
'fc787cd91e7acd2b6bde05e62beb8295' + | ||
'ae18e3f786726f8d034bbc15bf8331df' + | ||
'959f59d431736d5f306aaba63dacec27' + | ||
'9484e39d76db9b527738072af15730e8' + | ||
'b9956a64e8e4dbe868f77d1414a8a8b8' + | ||
'bf65380a1f008d39c5fabe1a9f834392' + | ||
'9342ab7b4f635bdc52532d764701ff3d' + | ||
'8072c475c012ff0c59373e8bc423928d' + | ||
'99f58c3a6d9f6ab21ee20bc8e8818fc1' + | ||
'47db09f60c81906f2c6f73dc69725f07' + | ||
'5853a89f0cd02a30a8dd86b660ccdeff' + | ||
'c292f398efb54088c822774445a6afde' + | ||
'471f7dd327ef9996296898a5747726cc' + | ||
'aeeceeb2e459df98b4128cb5ab8c7cd2' + | ||
'0c563f960a1aa770f3c81f13f967b6cc', 16); | ||
var out = new BN(0); | ||
var out = new bn(0); | ||
// out.words = new Array(40); | ||
var t = 0; | ||
console.time('montSqr'); | ||
for (var i = 0; i < 200000; i++) { | ||
t += a.mulTo(e, out).length; | ||
function toTyped(n) { | ||
var w = new Uint32Array(Math.min(160, n.length)); | ||
for (var i = 0; i < w.length; i++) | ||
w[i] = n.words[i] | 0; | ||
var r = new BN(null); | ||
r.length = n.length; | ||
r.words = w; | ||
return r; | ||
} | ||
console.timeEnd('montSqr'); | ||
var ta = toTyped(a); | ||
var tb = toTyped(b); | ||
var tout = toTyped(out); | ||
a.mulTo(b, out); | ||
ta.mulTo(tb, tout); |
@@ -43,3 +43,4 @@ // Utils | ||
} | ||
module.exports = BN; | ||
if (typeof module === 'object') | ||
module.exports = BN; | ||
@@ -1116,6 +1117,8 @@ BN.BN = BN; | ||
} | ||
a.isub(b); | ||
} while (b.cmpn(0) !== 0); | ||
return a.ishln(shift); | ||
a.isub(a.div(b).mul(b)); | ||
} while (a.cmpn(0) !== 0 && b.cmpn(0) !== 0); | ||
if (a.cmpn(0) === 0) | ||
return b.ishln(shift); | ||
else | ||
return a.ishln(shift); | ||
}; | ||
@@ -1122,0 +1125,0 @@ |
{ | ||
"name": "bn.js", | ||
"version": "0.13.0", | ||
"version": "0.13.1", | ||
"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
61449
1968