FIPS PUB 180-4 SHA-256 Mathematical Compression Architecture
SHA-256 operates on 512-bit message blocks across 64 compression rounds using eight 32-bit state registers ($a, b, c, d, e, f, g, h$).
1. Six Bitwise Logical Compression Functions
Ch(e,f,g) = (e ∧ f) ⊕ (¬e ∧ g)
Maj(a,b,c) = (a ∧ b) ⊕ (a ∧ c) ⊕ (b ∧ c)
2. Round State Update Equations
T_1 = h + Σ_1(e) + Ch(e,f,g) + K_t + W_t, T_2 = Σ_0(a) + Maj(a,b,c)
Step-by-Step SHA-256 Digest Computation Breakdown
Step 1: Message Padding & Length Append
Append bit 1 (0x80), pad with zeros, and append 64-bit big-endian length integer (L ≡ 448 mod 512).
Step 2: 64 Rounds of Non-Linear Word Expansion
W[t] = σ₁(W[t-2]) + W[t-7] + σ₀(W[t-15]) + W[t-16]
Step 3: Final 256-Bit Concatenated Hash Hex
Output=64-Character Hex Digest (256 bits)
SHA Hash Function Family Comparison
| Algorithm | Output Bits | Block Size | Collision Security | Primary Applications |
|---|---|---|---|---|
| SHA-256 | 256 bits (64 hex) | 512 bits | 128 bits | Bitcoin PoW, TLS 1.3, JWT RS256 |
| SHA-512 | 512 bits (128 hex) | 1024 bits | 256 bits | High-assurance defense, Ed25519 signing |
| SHA-3 (Keccak) | 256 / 512 bits | 1088 / 576 bits | Sponge construction | Ethereum EVM, modern cryptographic hardware |