SHA-256 CIRCUIT
Each of the 64 rounds of SHA-256 is an exactly invertible map of its eight 32-bit registers, once the round constant
Kt and the schedule word Wt are known. This panel shows one round built from
reversible gates only: 1,778 CNOT and 562 Toffoli gates on 353 wires, in 1,131 layers. It is the gate level of the
SHA-256 Round Trip, drawn in full.
READING THE CIRCUIT
- Each horizontal line is one wire: bit 31 to bit 0 of the registers a to h, the scratch register
s, the adder's carry, and Kt and Wt. A wire is bright where its bit is 1
and dim where it is 0.
- A CNOT flips its target (⊕) when its control (●) is 1. A Toffoli has two controls and flips its target when
both are 1. A filled target is a gate that flipped its bit in this round.
- Every gate has a column of its own. Gates in one layer act on different wires and could run at once; a shaded
band marks a layer of 32 such gates.
- The seven steps add Σ₁(e), Ch(e, f, g), Kt and Wt
into h, h into d, and Σ₀(a) and Maj(a, b, c) into h. A
function is computed into s (teal), added with a ripple-carry adder (white), and uncomputed (amber), so
s and the carry start and end at 0. After the last gate the wires are renamed: h becomes
a′, and a to g become b′ to h′.
- The panels on the left and right show the registers at the edges of the view: the input and output when the
whole round is in view, and the state after a given layer when you zoom in.
CONTROLS
- MESSAGE and the ROUND fader pick round t, numbered 0 to 63 as in the paper.
Wt comes from the first 512-bit block of the padded message, and the input state
St is the initial hash value after rounds 0 to t − 1.
- Turn the mouse wheel over the circuit to zoom, and drag it to pan. Double-click zooms in. More detail appears
as you zoom in: gate symbols, flipped targets, bit numbers and bits, and finally the bit on every wire.
- Hover over a gate to see what it does in this round. Keys on the circuit: arrows pan, + and − zoom, 0 shows
the whole round. Keys on the fader: arrows, Page Up, Page Down, Home and End.
REFERENCES
- T. Samshuijzen, The Reversible Rounds of SHA-256, 2026.
- S. A. Cuccaro, T. G. Draper, S. A. Kutin and D. P. Moulton, “A new quantum ripple-carry addition circuit”, 2004,
arXiv:quant-ph/0410184. Its MAJ and UMA blocks, without the carry-out.
- NIST, Secure Hash Standard (SHS), FIPS PUB 180-4, 2015, doi:10.6028/NIST.FIPS.180-4.