Skip to content

Estimates only. Not tax, legal, or investment advice.

Learn › Cryptography and Digital Cash (High school and up)

Hash Functions: Digital Fingerprints

10 minute lesson · then a 4-question quiz

Add this lesson to a curriculum for a student, a group or a team.

What a hash does

A cryptographic hash function takes any input, from a single word to a whole movie, and produces a short, fixed-length output called a hash or digest. Bitcoin uses SHA-256, which always produces 256 bits. The same input always gives the same hash. Change one character, and the hash changes completely and unpredictably.

The key properties

A good hash is quick to compute, but you cannot work backward from the hash to the input except by guessing. It is also extremely unlikely that two different inputs will give the same hash, a property called collision resistance. These properties make a hash work like a fingerprint: you can check that a file is unchanged without holding a copy to compare, and you can commit to data without revealing it.

Hashes are used to store passwords safely, verify software downloads, and build tamper-evident records.

Chaining blocks

Bitcoin groups transactions into blocks. Each block includes the hash of the block before it. If anyone changed an old transaction, that block's hash would change, which would break the link in the next block, and so on up the chain. The change would be obvious to everyone. That is what makes the record hard to alter. Hashes are also the basis of mining, the process you will learn in a later lesson.

Key ideas

  • A hash is a fixed-size fingerprint of any data.
  • A tiny change creates a completely different hash.
  • You cannot work backward from a hash except by guessing.
  • Chaining hashes makes a record tamper-evident.

Try it with the free tools: The CFO Dad book

Quiz

Get 75% or better to finish this lesson. You can try as many times as you like.

1. What happens to a hash if one letter of the input changes?
2. How long is a SHA-256 hash?
3. Why does chaining hashes make a record hard to alter?
4. Can you easily recover the input from a hash?

Educational only. Not tax, legal, or investment advice. Numbers and rules change, so check current sources.