Skip to content
All apps

SHA-256 in slow motion (8-bit model)

About this app

The SHA-256 compression function as a living circuit diagram: registers a to h, Ch, Maj, Σ0, Σ1 and the adders with live values on every wire, playable step by step, every operation with its bitwise calculation. The app computes a teaching model with 8-bit words and 32 rounds following exactly the rules of the original (padding, message schedule, constants from prime roots); the real SHA-256 is shown alongside. The avalanche view shows how one changed letter flips half of all bits round by round.

How SHA-256 works

SHA-256 is a cryptographic hash function whose procedure is public. The message is padded and split into blocks. Each block yields a message schedule W, and then the same round runs again and again on eight registers a to h. The round uses only rotation, XOR, AND, NOT and addition modulo the word size, combined in the functions Ch (choose), Maj (majority), Σ0 and Σ1. After all rounds the registers are added to the previous chaining value. Initial values and round constants come from the fractional parts of roots of the first primes, so nobody could pick them to suit themselves.

What the app shows

The app computes a teaching model with 8-bit words, 32 rounds and 16-byte blocks, giving 64-bit output, following the rules of the original. Real SHA-256 does the same with 32-bit words, 64 rounds and 64-byte blocks; its result is shown alongside for comparison. The circuit shows live values on every wire, round by round and sub-step by sub-step. Clicking a box shows the bitwise calculation. Panels show the message and padding, the schedule W and the register history.

Watch the avalanche effect

Enter a second text B that differs from A in one letter or a single bit. The avalanche view shows how the difference spreads through the registers round by round until about half of all bits differ. Similar texts therefore do not give similar hashes. The teaching model is explicitly not secure, because with 64 bits collisions can be found by trial.

Frequently asked questions

How does SHA-256 work in simple terms?
SHA-256 pads the message to a fixed block length, builds a schedule of words from each block and mixes them into eight registers over 64 rounds. Each round uses rotations, XOR, AND and additions. The result is a 256-bit hash that changes drastically with the smallest change to the input.
What is the avalanche effect in hash functions?
The avalanche effect means that a tiny change to the input, such as a single bit, changes about half of the output bits on average. Similar hashes therefore reveal nothing about similar inputs.
Why can SHA-256 not be reversed?
Addition modulo the word size drops the carry, AND loses bits, and inputs of any length are squeezed into a fixed size. At the end the registers are also added to the old chaining value. Reversing is practically impossible; one can only guess and compare.
Does the app compute real SHA-256?
The circuit computes a scaled-down teaching model with 8-bit words and 32 rounds following the original rules. Real SHA-256 is computed as well and shown next to it.

Subject: Cryptography

More from Cryptography

A VisuApp by heyprof: interactive, free in your browser, no sign-up. What is a VisuApp? · All apps