From 8ca49fb523278df556dcbf1c3ba8576a4c93d685 Mon Sep 17 00:00:00 2001
From: Braydon Fuller <braydon@bitpay.com>
Date: Mon, 3 Nov 2014 16:53:14 -0500
Subject: [PATCH] update to include new version of bn.js and elliptic that
 include hex padding

---
 lib/bn.js           | 10 ++--------
 npm-shrinkwrap.json | 30 +++++++++++++++---------------
 package.json        |  8 ++++----
 3 files changed, 21 insertions(+), 27 deletions(-)

diff --git a/lib/bn.js b/lib/bn.js
index 4754556..6b71b67 100644
--- a/lib/bn.js
+++ b/lib/bn.js
@@ -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');
   }
 
diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json
index 2c57469..ebb18f2 100644
--- a/npm-shrinkwrap.json
+++ b/npm-shrinkwrap.json
@@ -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",
diff --git a/package.json b/package.json
index 91feea9..4aa2364 100644
--- a/package.json
+++ b/package.json
@@ -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": {