Add Destination.toBase32()

This commit is contained in:
zzz
2014-06-23 20:06:03 +00:00
parent 69e56f8f6b
commit 8b1abc08db
11 changed files with 37 additions and 25 deletions

View File

@@ -172,6 +172,19 @@ public class Destination extends KeysAndCert {
return _cachedB64;
}
/**
* For convenience.
* @return "{52 chars}.b32.i2p" or null if fields not set.
* @since 0.9.14
*/
public String toBase32() {
try {
return Base32.encode(getHash().getData()) + ".b32.i2p";
} catch (IllegalStateException ise) {
return null;
}
}
/**
* Clear the cache.
* @since 0.9.9

View File

@@ -427,7 +427,7 @@ public class PrivateKeyFile {
s.append("Dest: ");
s.append(this.dest != null ? this.dest.toBase64() : "null");
s.append("\nB32: ");
s.append(this.dest != null ? Base32.encode(this.dest.calculateHash().getData()) + ".b32.i2p" : "null");
s.append(this.dest != null ? this.dest.toBase32() : "null");
s.append("\nContains: ");
s.append(this.dest);
s.append("\nPrivate Key: ");