generate fingerprint as a hex String, leave formatting for display code

When the fingerprint is generated to be stored in the database in the repo
table, make it a single String that is a hex number.  This is a natural
format for working with the fingerprints programmatically.  The display
formatting can then be handled by the display code, and can freely change
without affecting the underlying function of the code.
This commit is contained in:
Hans-Christoph Steiner 2013-11-21 21:35:29 -05:00
parent 9b485bece3
commit ee21a2724c

View File

@ -238,10 +238,8 @@ public class ManageRepo extends ListActivity {
digest.update(Hasher.unhex(repo.pubkey));
byte[] fingerprint = digest.digest();
Formatter formatter = new Formatter(new StringBuilder());
formatter.format("%02X", fingerprint[0]);
for (int i = 1; i < fingerprint.length; i++) {
formatter.format(i % 5 == 0 ? " %02X" : ":%02X",
fingerprint[i]);
formatter.format("%02X", fingerprint[i]);
}
ret = formatter.toString();
formatter.close();