update to include new version of bn.js and elliptic that include hex padding

This commit is contained in:
Braydon Fuller 2014-11-03 16:53:14 -05:00
parent 4a710e8fa6
commit 8ca49fb523
3 changed files with 21 additions and 27 deletions

View File

@ -41,8 +41,6 @@ BN.fromBuffer = function(buf, opts) {
buf = nbuf;
}
var hex = buf.toString('hex');
if (hex.length % 2)
hex = "0" + hex;
var bn = new BN(hex, 16);
return bn;
};
@ -57,9 +55,7 @@ BN.prototype.fromBuffer = function(buf, opts) {
BN.prototype.toBuffer = function(opts) {
var buf;
if (opts && opts.size) {
var hex = this.toString(16);
if (hex.length % 2)
hex = "0" + hex;
var hex = this.toString(16, 2);
var natlen = hex.length/2;
buf = new Buffer(hex, 'hex');
@ -81,9 +77,7 @@ BN.prototype.toBuffer = function(opts) {
}
}
else {
var hex = this.toString(16);
if (hex.length % 2)
hex = "0" + hex;
var hex = this.toString(16, 2);
buf = new Buffer(hex, 'hex');
}

30
npm-shrinkwrap.json generated
View File

@ -8,9 +8,9 @@
"resolved": "https://registry.npmjs.org/aes/-/aes-0.1.0.tgz"
},
"bn.js": {
"version": "0.14.0",
"from": "bn.js@0.14.0",
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-0.14.0.tgz"
"version": "0.15.0",
"from": "bn.js@0.15.0",
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-0.15.0.tgz"
},
"bs58": {
"version": "1.2.1",
@ -18,19 +18,19 @@
"resolved": "https://registry.npmjs.org/bs58/-/bs58-1.2.1.tgz"
},
"elliptic": {
"version": "0.15.10",
"from": "elliptic@0.15.10",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-0.15.10.tgz",
"version": "0.15.12",
"from": "elliptic@0.15.12",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-0.15.12.tgz",
"dependencies": {
"bn.js": {
"version": "0.11.7",
"from": "bn.js@0.11.7",
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-0.11.7.tgz"
"version": "0.15.0",
"from": "bn.js@0.15.0",
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-0.15.0.tgz"
},
"hash.js": {
"version": "0.2.1",
"from": "hash.js@0.2.1",
"resolved": "https://registry.npmjs.org/hash.js/-/hash.js-0.2.1.tgz"
"version": "0.3.2",
"from": "hash.js@0.3.2",
"resolved": "https://registry.npmjs.org/hash.js/-/hash.js-0.3.2.tgz"
},
"inherits": {
"version": "2.0.1",
@ -39,9 +39,9 @@
}
},
"hash.js": {
"version": "0.3.1",
"from": "hash.js@0.3.1",
"resolved": "https://registry.npmjs.org/hash.js/-/hash.js-0.3.1.tgz",
"version": "0.3.2",
"from": "hash.js@0.3.2",
"resolved": "https://registry.npmjs.org/hash.js/-/hash.js-0.3.2.tgz",
"dependencies": {
"inherits": {
"version": "2.0.1",

View File

@ -5,7 +5,7 @@
"author": "BitPay <dev@bitpay.com>",
"main": "index.js",
"scripts": {
"test": "mocha",
"test": "mocha --reporter spec",
"coverage": "istanbul cover _mocha"
},
"contributors": [
@ -65,10 +65,10 @@
},
"dependencies": {
"aes": "=0.1.0",
"bn.js": "=0.14.0",
"bn.js": "=0.15.0",
"bs58": "=1.2.1",
"elliptic": "=0.15.10",
"hash.js": "=0.3.1",
"elliptic": "=0.15.12",
"hash.js": "=0.3.2",
"sha512": "=0.0.1"
},
"devDependencies": {