Fix convertKeyIdToHex

The previous code would base the short representation on whether
the first 32 bit of the key ID would be greater than 0, which wasn't
the case for half the key IDs, as they'd result in a negative number.

Also introduce convertKeyIdToHexShort, which is used wherever it
makes sense to use the short (32bit) representation of key IDs.