From 0ebfba0b37d84ec5b9401df7e8f1be5c9ea4ad4b Mon Sep 17 00:00:00 2001 From: coretechs Date: Sun, 11 Mar 2012 01:47:01 -0500 Subject: [PATCH] fix base64 display bug ECKey.toString missing pad --- bitaddress.org.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bitaddress.org.html b/bitaddress.org.html index a6e6993b..cf4bee41 100644 --- a/bitaddress.org.html +++ b/bitaddress.org.html @@ -3797,8 +3797,13 @@ ECKey.prototype.toString = function (format) { format = format || ""; + // Get a copy of private key as a byte array + var bytes = this.priv.toByteArrayUnsigned(); + // zero pad if private key is less than 32 bytes + while (bytes.length < 32) bytes.unshift(0x00); + if (format === "base64" || format === "b64") { - return Crypto.util.bytesToBase64(this.priv.toByteArrayUnsigned()); + return Crypto.util.bytesToBase64(bytes); } // Wallet Import Format else if (format.toString().toLowerCase() == "wif") {