Fix padding issue with exported private keys.

This commit is contained in:
Stefan Thomas 2012-08-26 11:25:18 +02:00
parent e90780d3d3
commit 24881584c7

View file

@ -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));