Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
FREEDOM251

Freedom251 › Blog › cryptography basics

Public Key Hash Definition: What a Public Key Fingerprint Is and How It Is Calculated

By Freedom251 Team · · 5 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A public key hash is a short digest calculated from public-key data. In most protocols it is called a public key fingerprint, and people use it to check that a key they received matches the key they expected. There is no single universal calculation. Which bytes are hashed, which hash algorithm is used, and how the result is written out all depend on the protocol and the key version.

What the term means

A public key is often a long encoded value. A public key hash replaces that long value with a fixed-length digest computed from it. The digest is not a name, a certificate, or proof of identity by itself. It is a compact representation of one specific key, so two people can compare a short string instead of comparing the entire key.

As an Amazon Associate I earn from qualifying purchases.

The same idea appears under different labels. The standards use the term “public key fingerprint,” and that is the phrase most readers will see in SSH and OpenPGP documentation.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why people compare hashes instead of full keys

RFC 4716, which defines the SSH public key file format, explains the motivation in Section 4: “Since public keys tend to be very large, it is difficult for a human to verify an entire host key.” A fingerprint solves that readability problem. It gives a person a value they can read aloud, copy, or compare against a stored reference.

A match tells you only that the presented key equals the key that produced the reference value. Whether that reference can be trusted is a separate question, covered in the verification section below.

How the calculation changes between systems

The input bytes matter as much as the hash function. A protocol must define which key data is hashed and how that data is serialized or prefixed. RFC 4253, the SSH transport layer specification, represents an SSH public key or certificate with a format identifier followed by key or certificate data. A fingerprint built from one encoding will not match a fingerprint built from another, even when the underlying key is the same.

The table below compares the two specifications that define fingerprints in the most detail.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Item SSH public key file format (RFC 4716) OpenPGP version 4 key OpenPGP version 6 key
Hashed input Public-key data as specified by RFC 4253 0x99 octet, two-octet packet length, public-key packet 0x9B octet, four-octet packet length, public-key packet
Digest algorithm MD5, which the RFC describes as used for historical reasons SHA-1 SHA2-256
Digest length 16 octets 160 bits 256 bits
Written form Lowercase hexadecimal pairs separated by colons Not covered in this summary of the specification Not covered in this summary of the specification

SSH public key file format (RFC 4716)

For this format, the fingerprint is the MD5 digest of the public-key data specified by RFC 4253, shown as 16 octets in lowercase hexadecimal separated by colons. RFC 4716 notes that MD5 is used for historical reasons and that its collision resistance is weak. Treat this as the behavior of that specific SSH specification. Do not assume every SSH fingerprint you encounter is MD5. RFC 4251, the SSH architecture document, includes an example fingerprint computed with SHA-1, so SSH values can use more than one digest.

OpenPGP version 4 keys

RFC 9580 defines the OpenPGP fingerprint for each key version. For a version 4 key, the calculation runs in this order:

  1. Take the public-key packet for the key.
  2. Prepend the 0x99 octet and a two-octet packet length.
  3. Hash the result with SHA-1 to produce a 160-bit fingerprint.

OpenPGP version 6 keys

For a version 6 key, the same general idea changes in three places. The prefix is 0x9B, the length field is four octets, and the digest is SHA2-256, which produces 256 bits. A version 4 fingerprint and a version 6 fingerprint for the same key are therefore different values with different lengths.

Why the same key can produce different fingerprints

  • Different ecosystems use different rules. An SSH fingerprint and an OpenPGP fingerprint are not interchangeable, even if both describe a key with the same mathematical parameters.
  • Key versions change the construction. OpenPGP version 4 and version 6 differ in prefix, length field, and digest.
  • Digest algorithms vary. MD5, SHA-1, and SHA2-256 all appear in the specifications discussed here, and their output lengths differ.
  • Display formats differ. A value shown as colon-separated hexadecimal is the same kind of object as one shown in another encoding only after you convert it, and a comparison should be made in a single format.

How to verify a key with a fingerprint

A fingerprint is useful when you compare a key received through one channel against a trusted value obtained through another. SSH architecture guidance in RFC 4251 recommends a best-effort check of host keys, storing host keys for later comparison, and offering a way to reject host keys that cannot be verified. The steps below apply the same logic to any ecosystem.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Identify the ecosystem and key version. An SSH key, an OpenPGP version 4 key, and an OpenPGP version 6 key each have their own fingerprint rules.
  2. Obtain the expected value through a trusted channel, such as a fingerprint you verified in person, a value published by a trusted party, or an existing trust mechanism you already rely on.
  3. Generate or display the fingerprint in the format used by that system, with the same digest and encoding as the reference.
  4. Compare the full value, not only the first few characters.
  5. Store the verified value so later connections can be checked against it.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When a fingerprint does not match

A mismatch is a signal to investigate. It is not a reason to accept the new key automatically. Work through these checks before you decide what to do:

  • Confirm that both values use the same ecosystem, key version, digest algorithm, and encoding. A value calculated with MD5 cannot be compared with one calculated with SHA-256.
  • Confirm that the reference value came from a source you trust, and not from the same channel that delivered the new key.
  • Confirm that the key you received is the key you expected to receive. A legitimate key change can explain a mismatch, but it still needs to be verified.
  • Reject the key if you cannot verify it through a trusted path.

Where the definition stops

A public key hash identifies the key data that was hashed. It does not identify a person, a server name, or an organization, and it does not confirm that a key is trustworthy. Those claims depend on how the reference value was obtained and on the trust process around it.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

cryptography basicskey verificationOpenPGPpublic key fingerprintpublic key hashSSH

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.