A GPG key ID is a 8 or 16 hex character identifier derived from the key's fingerprint. The short key ID is the last 8 hex chars of the fingerprint; the long key ID is the last 16 hex chars. The fingerprint is the SHA-1 hash of the key packet (20 bytes = 40 hex chars).