From 24881584c721adc268fbd8c58f57e04fb82c5a08 Mon Sep 17 00:00:00 2001 From: Stefan Thomas Date: Sun, 26 Aug 2012 11:25:18 +0200 Subject: [PATCH] Fix padding issue with exported private keys. --- src/eckey.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/eckey.js b/src/eckey.js index 05b5fda..a01367b 100644 --- a/src/eckey.js +++ b/src/eckey.js @@ -74,6 +74,7 @@ Bitcoin.ECKey = (function () { ECKey.prototype.getExportedPrivateKey = function () { var hash = this.priv.toByteArrayUnsigned(); + while (hash.length < 32) hash.unshift(0); hash.unshift(0x80); var checksum = Crypto.SHA256(Crypto.SHA256(hash, {asBytes: true}), {asBytes: true}); var bytes = hash.concat(checksum.slice(0,4));