From: Jonathan McDowell <noodles@earth.li>
Date: Sun, 1 Apr 2012 21:09:12 +0000 (-0700)
Subject: Fix display of SHA-1 fingerprints
X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/commitdiff_plain/0419ca8378046fbf42cb837dcbb54682ef7495c6

Fix display of SHA-1 fingerprints

  SHA-1 fingerprints have a double space in the middle and we were
  putting the extra space in the wrong place.
---

diff --git a/keyindex.c b/keyindex.c
index eee2e8a..4eedf1f 100644
--- a/keyindex.c
+++ b/keyindex.c
@@ -189,10 +189,11 @@ void display_fingerprint(struct openpgp_publickey *key)
 			(i % 2 == 0)) {
 			printf(" ");
 		}
-		printf("%02X", fp[i]);
-		if ((i * 2) == length) {
+		if (length == 20 && (i * 2) == length) {
+			/* Extra space in the middle of a SHA1 fingerprint */
 			printf(" ");
 		}
+		printf("%02X", fp[i]);
 	}
 	printf("\n");