update elliptic. remove ec.curve.n workaround.

This commit is contained in:
Christopher Jeffrey 2015-12-08 17:34:36 -08:00
parent 22e092d6b8
commit 71ea61e467
2 changed files with 2 additions and 11 deletions

View File

@ -326,16 +326,7 @@ HDPriv.prototype.derive = function(index, hard) {
var leftPart = new bn(hash.slice(0, 32));
var chainCode = hash.slice(32, 64);
// XXX This causes a call stack overflow with bn.js@4.0.5 and elliptic@3.0.3
// Example: new bn(0).mod(ec.curve.n)
//var privateKey = leftPart.add(new bn(this.privateKey)).mod(ec.curve.n).toArray();
// Use this as a workaround:
var n = new bn(
'fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141',
'hex'
);
var privateKey = leftPart.add(new bn(this.privateKey)).mod(n).toArray();
var privateKey = leftPart.add(new bn(this.privateKey)).mod(ec.curve.n).toArray();
return new HDPriv({
// version: this.version,

View File

@ -23,7 +23,7 @@
"dependencies": {
"async": "^0.8.0",
"bn.js": "^4.5.0",
"elliptic": "^3.0.3",
"elliptic": "^6.0.2",
"hash.js": "^1.0.3",
"inherits": "^2.0.1"
},