base58check in extendedPrivateKeyString

This commit is contained in:
Ryan X. Charles 2014-09-17 14:43:14 -07:00
parent 70d9f0db93
commit 9e188574f7
1 changed files with 1 additions and 4 deletions

View File

@ -173,10 +173,7 @@ BIP32.prototype.buildExtendedPrivateKey = function() {
BIP32.prototype.extendedPrivateKeyString = function(format) { BIP32.prototype.extendedPrivateKeyString = function(format) {
if (format === undefined || format === 'base58') { if (format === undefined || format === 'base58') {
var hash = Hash.sha256sha256(this.extendedPrivateKey); return Base58Check.encode(this.extendedPrivateKey);
var checksum = hash.slice(0, 4);
var data = Buffer.concat([this.extendedPrivateKey, checksum]);
return base58.encode(data);
} else if (format === 'hex') { } else if (format === 'hex') {
return this.extendedPrivateKey.toString('hex'); return this.extendedPrivateKey.toString('hex');
} else { } else {