Fingerprints and signatures
In one sentence
A hash is a short fingerprint of any data; a digital signature made with a private key proves the data is unchanged and was signed by whoever holds that key.
The situation
A supplier emails a PDF with new bank details for their invoices. The logo is right, the tone is right, the contact name is right. Your accounts team is about to update the payment record.
How could anyone know that this document really came from the supplier, and that nobody changed a single digit on the way?
What is going on
Fingerprints: hashes
A hash function turns any data, a word or a whole film, into a short fixed-size value called a hash. People also call it a fingerprint. SHA-256, the most common one today, always produces 256 bits, usually shown as 64 hexadecimal characters.
Three properties make hashes useful:
- Same input, same hash. Anyone can recompute it and compare.
- Any change gives a completely different hash. Change one comma in a 50-page contract and the hash looks unrelated to the old one.
- One way. You cannot work back from the hash to the data, and finding two different inputs with the same hash must be infeasible. Older hashes such as MD5 and SHA-1 lost that last property, which is why they are retired for signatures.
A hash uses no key, so it is not encryption, and there is nothing to “decrypt”. It also proves nothing about who sent the data: anyone who changes the document can simply compute a new hash for it.
Signatures: proof with a private key
A digital signature adds the “who”. It builds on the key pair from lesson 2:
- The document is hashed. Most signature algorithms do this as their first step.
- A signature algorithm, such as ECDSA, combines that hash with the signer’s private key to produce the signature.
- Anyone with the matching public key runs the verification algorithm on the document and the signature.
Verification passes only if the document is unchanged and the signature was made with the private key that matches that public key. Change one byte and it fails.
What a signature proves, and what it does not
A valid signature proves two things: the data has not changed since it was signed, and it was signed with one particular private key. It does not prove who owns that key. If a fraudster sends you their own public key labelled with your supplier’s name, their signatures will verify perfectly. Lesson 4 closes that gap with certificates.
For the invoice email in the situation, that means a signature would only help if you already had the supplier’s genuine public key. Until then, the safe check is a call to a phone number you already knew, not one in the email.
Try it
A certificate is itself a signed document. Find its signature algorithm (a hash plus a signature method, for example ECDSA with SHA-256) and the signature value at the end, then find the certificate’s fingerprint: one short hash that identifies the whole certificate.
Check
You change one comma in a 50-page contract and compute its SHA-256 hash again. What happens to the hash?
RightNot quite The answer is C: It becomes completely different
- What happened
- The new hash looks completely unrelated to the old one.
- Why
- Hash functions are designed so that any change to the input, however small, changes the output unpredictably. That is what makes a hash a reliable fingerprint.
- The rule
- Same data gives the same hash; any change gives a different hash.
Show answer
Answer C It becomes completely different
- What happened
- The new hash looks completely unrelated to the old one.
- Why
- Hash functions are designed so that any change to the input, however small, changes the output unpredictably. That is what makes a hash a reliable fingerprint.
- The rule
- Same data gives the same hash; any change gives a different hash.
A document carries a valid digital signature. What does that prove?
RightNot quite The answer is A: That it was signed with the private key matching the public key you used, and has not changed since
- What happened
- It proves integrity (nothing changed) and that the matching private key made the signature.
- Why
- A signature hides nothing and says nothing about honesty. It ties the document to a key, and only to that key.
- The rule
- A signature proves which key signed and that the data is unchanged; who owns the key is a separate question.
Show answer
Answer A That it was signed with the private key matching the public key you used, and has not changed since
- What happened
- It proves integrity (nothing changed) and that the matching private key made the signature.
- Why
- A signature hides nothing and says nothing about honesty. It ties the document to a key, and only to that key.
- The rule
- A signature proves which key signed and that the data is unchanged; who owns the key is a separate question.
A colleague says: 'Signing just means encrypting the document with your private key.' What is the best correction?
RightNot quite The answer is B: Signing runs a signature algorithm with the private key that produces proof, not secrecy; anyone with the public key can verify, and the document stays readable
- What happened
- Signing and encrypting are different operations with different goals.
- Why
- The 'encrypt with the private key' picture comes from a shortcut sometimes used to explain RSA, where both operations use the same maths. Even there the padding and the purpose differ, algorithms such as ECDSA encrypt nothing at all, and the picture suggests the document is hidden, which it is not.
- The rule
- Sign with the private key, verify with the public key. A signature is not encryption.
Show answer
Answer B Signing runs a signature algorithm with the private key that produces proof, not secrecy; anyone with the public key can verify, and the document stays readable
- What happened
- Signing and encrypting are different operations with different goals.
- Why
- The 'encrypt with the private key' picture comes from a shortcut sometimes used to explain RSA, where both operations use the same maths. Even there the padding and the purpose differ, algorithms such as ECDSA encrypt nothing at all, and the picture suggests the document is hidden, which it is not.
- The rule
- Sign with the private key, verify with the public key. A signature is not encryption.
Takeaways
- A hash is a fixed-size fingerprint: any change gives a new hash, and with no key involved it is not encryption.
- Sign with the private key, verify with the public key. A valid signature means “made with that key and unchanged since”.
- A signature proves which key signed, not who owns the key. That is the next lesson.
Go further
- Handbook: Hashes and fingerprints
- Handbook: Digital signatures
- Next lesson: Whose key is it?
Early edition. Checked against the standards; an independent expert review is in progress. Found a mistake? Tell us.