use base58check in extendedPublicKeyString
This commit is contained in:
parent
70659ad9d4
commit
70d9f0db93
|
@ -140,12 +140,9 @@ BIP32.prototype.buildExtendedPublicKey = function() {
|
|||
|
||||
BIP32.prototype.extendedPublicKeyString = function(format) {
|
||||
if (format === undefined || format === 'base58') {
|
||||
var hash = Hash.sha256sha256(this.extendedPublicKey);
|
||||
var checksum = hash.slice(0, 4);
|
||||
var data = Buffer.concat([this.extendedPublicKey, checksum]);
|
||||
return base58.encode(data);
|
||||
return Base58Check.encode(this.extendedPublicKey);
|
||||
} else if (format === 'hex') {
|
||||
return this.extendedPublicKey.toString('hex');;
|
||||
return this.extendedPublicKey.toString('hex');
|
||||
} else {
|
||||
throw new Error('bad format');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue