Merge pull request #552 from braydonf/bn-hex-padding

upgrade to new version of bn.js that includes hex padding
This commit is contained in:
Manuel Aráoz 2014-11-10 11:29:24 -03:00
commit b18ee9a49d
3 changed files with 196 additions and 206 deletions

File diff suppressed because one or more lines are too long

View File

@ -23,8 +23,6 @@ bnjs.fromBuffer = function(buf, opts) {
buf = nbuf;
}
var hex = buf.toString('hex');
if (hex.length % 2)
hex = "0" + hex;
var bn = new bnjs(hex, 16);
return bn;
};
@ -32,9 +30,7 @@ bnjs.fromBuffer = function(buf, opts) {
bnjs.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');
@ -56,9 +52,7 @@ bnjs.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');
}

View File

@ -61,14 +61,14 @@
"bignum": "=0.6.2",
"bindings": "=1.1.1",
"binary": "^0.3.0",
"bn.js": "=0.13.3",
"bn.js": "=0.15.0",
"brfs": "=1.0.0",
"bufferput": "git://github.com/bitpay/node-bufferput.git",
"buffers": "=0.1.1",
"buffertools": "=2.1.2",
"browserify-buffertools": "git://github.com/maraoz/browserify-buffertools.git",
"elliptic": "=0.15.7",
"hash.js": "=0.3.1",
"elliptic": "=0.15.12",
"hash.js": "=0.3.2",
"jsrsasign": "=0.0.3",
"preconditions": "^1.0.7",
"protobufjs": "=3.0.0",