Fix display of SHA-1 fingerprints
authorJonathan McDowell <noodles@earth.li>
Sun, 1 Apr 2012 21:09:12 +0000 (14:09 -0700)
committerJonathan McDowell <noodles@earth.li>
Sun, 1 Apr 2012 21:09:12 +0000 (14:09 -0700)
  SHA-1 fingerprints have a double space in the middle and we were
  putting the extra space in the wrong place.

keyindex.c

index eee2e8a6f867415c3651c5c5d57f0b00424d00ae..4eedf1f648f9f107c85c22ecb799d04af8b5f6a1 100644 (file)
@@ -189,10 +189,11 @@ void display_fingerprint(struct openpgp_publickey *key)
                        (i % 2 == 0)) {
                        printf(" ");
                }
                        (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(" ");
                }
+               printf("%02X", fp[i]);
        }
        printf("\n");
 
        }
        printf("\n");