What is a hash function? How SHA-256 keeps blockchains honest

By SendPay Business · · 2 min read

What is a hash function? How SHA-256 keeps blockchains honest

A hash function takes any input, from one letter to a whole file, and turns it into a short fixed-length string called a hash. Good hash functions are one of the building blocks of blockchains, passwords and secure payments.

What makes a good hashHow Bitcoin uses SHA-256Other everyday uses

What makes a good hash

  1. Same input, same hash, every time.
  2. Fixed length: SHA-256 always gives 256 bits, written as 64 hexadecimal characters.
  3. One way: you can't work out the input from the hash.
  4. Avalanche effect: change one character and the hash changes completely.
  5. Collision resistant: it is practically impossible to find two inputs with the same hash.

How Bitcoin uses SHA-256

Each Bitcoin block includes the hash of the block before it, chaining them together, so changing an old block would change every later hash and be spotted. Miners hash block headers over and over, changing a number each time, until they find a hash below the network's target. That work is the proof in proof of work.

Other everyday uses

Websites store hashes of passwords rather than the passwords themselves. Software downloads publish hashes so you can check a file hasn't been altered. Transaction IDs on blockchains are hashes of the transaction data.

Hashing is not encryption

Encryption is designed to be reversed by whoever has the key. Hashing is designed never to be reversed. That's why a hash can prove data hasn't changed without revealing the data itself.

Where SendPay fits

SendPay platforms let customers buy, sell and hold crypto, held with regulated partners, alongside GBP, EUR and USD accounts, powered by licensed partners. SendPay doesn't offer trading tools, DeFi or lending.

Build it

Create your own financial platform.

Pick a template, name it, brand it, preview every page before you pay. Your brand, your users, your fees.

Build my platform →

Questions people ask

Can I try SHA-256 myself?

Type any text into the free generator and see its hash.

SHA-256 hash generator →
What is a blockchain?

A shared record of transactions, chained together by hashes.

What is a blockchain? →
What is hash rate?

How many hashes a mining network tries each second.

Hash rate →
What is crypto mining?

How new blocks are added and new coins issued.

Crypto mining →

Read next

This guide is general information, not legal or financial advice. SendPay Business is a technology company, not a bank, and does not take deposits; regulated services on the platforms are provided by licensed partners. PayPal, Patreon and Substack are named as reference points only and are not affiliated with SendPay Business.