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:
commit
b18ee9a49d
File diff suppressed because one or more lines are too long
@ -23,8 +23,6 @@ bnjs.fromBuffer = function(buf, opts) {
|
|||||||
buf = nbuf;
|
buf = nbuf;
|
||||||
}
|
}
|
||||||
var hex = buf.toString('hex');
|
var hex = buf.toString('hex');
|
||||||
if (hex.length % 2)
|
|
||||||
hex = "0" + hex;
|
|
||||||
var bn = new bnjs(hex, 16);
|
var bn = new bnjs(hex, 16);
|
||||||
return bn;
|
return bn;
|
||||||
};
|
};
|
||||||
@ -32,9 +30,7 @@ bnjs.fromBuffer = function(buf, opts) {
|
|||||||
bnjs.prototype.toBuffer = function(opts) {
|
bnjs.prototype.toBuffer = function(opts) {
|
||||||
var buf;
|
var buf;
|
||||||
if (opts && opts.size) {
|
if (opts && opts.size) {
|
||||||
var hex = this.toString(16);
|
var hex = this.toString(16, 2);
|
||||||
if (hex.length % 2)
|
|
||||||
hex = "0" + hex;
|
|
||||||
var natlen = hex.length/2;
|
var natlen = hex.length/2;
|
||||||
buf = new Buffer(hex, 'hex');
|
buf = new Buffer(hex, 'hex');
|
||||||
|
|
||||||
@ -56,9 +52,7 @@ bnjs.prototype.toBuffer = function(opts) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var hex = this.toString(16);
|
var hex = this.toString(16, 2);
|
||||||
if (hex.length % 2)
|
|
||||||
hex = "0" + hex;
|
|
||||||
buf = new Buffer(hex, 'hex');
|
buf = new Buffer(hex, 'hex');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -61,14 +61,14 @@
|
|||||||
"bignum": "=0.6.2",
|
"bignum": "=0.6.2",
|
||||||
"bindings": "=1.1.1",
|
"bindings": "=1.1.1",
|
||||||
"binary": "^0.3.0",
|
"binary": "^0.3.0",
|
||||||
"bn.js": "=0.13.3",
|
"bn.js": "=0.15.0",
|
||||||
"brfs": "=1.0.0",
|
"brfs": "=1.0.0",
|
||||||
"bufferput": "git://github.com/bitpay/node-bufferput.git",
|
"bufferput": "git://github.com/bitpay/node-bufferput.git",
|
||||||
"buffers": "=0.1.1",
|
"buffers": "=0.1.1",
|
||||||
"buffertools": "=2.1.2",
|
"buffertools": "=2.1.2",
|
||||||
"browserify-buffertools": "git://github.com/maraoz/browserify-buffertools.git",
|
"browserify-buffertools": "git://github.com/maraoz/browserify-buffertools.git",
|
||||||
"elliptic": "=0.15.7",
|
"elliptic": "=0.15.12",
|
||||||
"hash.js": "=0.3.1",
|
"hash.js": "=0.3.2",
|
||||||
"jsrsasign": "=0.0.3",
|
"jsrsasign": "=0.0.3",
|
||||||
"preconditions": "^1.0.7",
|
"preconditions": "^1.0.7",
|
||||||
"protobufjs": "=3.0.0",
|
"protobufjs": "=3.0.0",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user