3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-01-31 07:12:17 +00:00

Remove private key from ECKey.toString and put it in toStringWithPrivate

This commit is contained in:
Miron Cuperman 2012-02-29 14:50:57 -08:00
parent 812ca60b9b
commit feb85a13d3

View File

@ -181,15 +181,21 @@ public class ECKey implements Serializable {
public String toString() {
StringBuffer b = new StringBuffer();
b.append("pub:").append(Utils.bytesToHexString(pub));
if (priv != null) {
b.append(" priv:").append(Utils.bytesToHexString(priv.toByteArray()));
}
if (creationTimeSeconds != 0) {
b.append(" timestamp:" + creationTimeSeconds);
}
return b.toString();
}
public String toStringWithPrivate() {
StringBuffer b = new StringBuffer();
b.append(toString());
if (priv != null) {
b.append(" priv:").append(Utils.bytesToHexString(priv.toByteArray()));
}
return b.toString();
}
/**
* Returns the address that corresponds to the public part of this ECKey. Note that an address is derived from
* the RIPEMD-160 hash of the public key and is not the public key itself (which is too large to be convenient).