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:
parent
9b485bece3
commit
ee21a2724c
@ -238,10 +238,8 @@ public class ManageRepo extends ListActivity {
|
|||||||
digest.update(Hasher.unhex(repo.pubkey));
|
digest.update(Hasher.unhex(repo.pubkey));
|
||||||
byte[] fingerprint = digest.digest();
|
byte[] fingerprint = digest.digest();
|
||||||
Formatter formatter = new Formatter(new StringBuilder());
|
Formatter formatter = new Formatter(new StringBuilder());
|
||||||
formatter.format("%02X", fingerprint[0]);
|
|
||||||
for (int i = 1; i < fingerprint.length; i++) {
|
for (int i = 1; i < fingerprint.length; i++) {
|
||||||
formatter.format(i % 5 == 0 ? " %02X" : ":%02X",
|
formatter.format("%02X", fingerprint[i]);
|
||||||
fingerprint[i]);
|
|
||||||
}
|
}
|
||||||
ret = formatter.toString();
|
ret = formatter.toString();
|
||||||
formatter.close();
|
formatter.close();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user