Cryptography at work
Integrity versus authenticity
Integrity asks whether the bytes match a digest you trust; authenticity asks whether they came from who you think — a bare hash gives the first, a keyed hash or signature the second.
Integrity means the bytes match a digest; authenticity means they came from who you think. A
[[cryptographic-hash|hash]] published beside a file gives only integrity: an attacker who can swap the file rewrites
the checksum too, and sha256sum -c prints OK. Authenticity needs a key the attacker lacks: a signed sums file
(SHA256SUMS.gpg) checked with a public key fetched over another channel, or a [[message-authentication-code|keyed
hash]] between parties sharing a secret.
Read next
- Cryptographic hash A one-way function that turns any data into a short fixed-size fingerprint, so the same bytes always give the same digest and no one can find two inputs that share one.
- Message authentication code A keyed hash: a tag computed from a message and a secret key, so only a holder of the key can produce or check it.