What is the fingerprint on a download page?
A string such as `a3f5…9e2c` on a firmware download page is a digest computed from the file. It helps compare data for consistency; it does not encrypt the file or contain a secret key.
The ten plates explain digests, resistance properties, the birthday bound, block processing, and SHA-1's retirement, then place SHA inside signatures, HMAC, Merkle trees, Secure Boot, OTP, PUF, and KDF designs with their different keys, roots of trust, and verification rules.
That long hexadecimal string is a digest
The hexadecimal string beside a firmware download is a digest: a fixed-length value computed from the file. It does not conceal the original data or serve as a secret key. SHA stands for Secure Hash Algorithm.
SHA-256 always returns 256 bits, or 32 bytes. Written in hexadecimal, that is 64 characters. The abbreviated value in the plate is useful for a picture, but a real integrity check must compare the complete digest. [1]
After downloading firmware, compute its digest and compare the complete value with the publisher’s reference. That reference must also be trusted. An attacker controlling the download page can replace both the file and its digest; the altered pair can still match. A digital signature can add origin and integrity checks under assumptions such as a trusted public key.
Different input lengths, one output length
A one-character message and a multi-gigabyte file both produce a 256-bit result under SHA-256. Because the input space is much larger than the output space, different inputs must sometimes produce the same digest; security depends on making those collisions infeasible to find.
Changing `Hello` to `hello` should radically change the digest. This avalanche behavior prevents an attacker from steering toward a target by making small input changes and watching for small output changes.
The same input under the same SHA algorithm always gives the same output. Raw SHA has no built-in salt or secret key. That is one reason raw SHA-256 is a poor password-storage function: it is deterministic and intentionally fast.
The three resistance properties answer different attacks
Preimage resistance asks whether an attacker, given only a target digest h, can find any message m such that H(m)=h. For an ideal n-bit hash, generic brute force is on the order of 2^n operations. [2]
Second-preimage resistance starts with a particular known message. The attacker must find a different message with the same digest. Collision resistance gives the attacker more freedom: choose any two different messages that collide.
Because the attacker may choose both inputs, a generic collision search reaches the birthday bound at roughly 2^(n/2). SHA-256 therefore has an ideal collision strength of about 128 bits even though its preimage strength is about 256 bits. [2]
The birthday paradox explains the square-root bound
In a room of 23 people, there are 253 pairs. The birthday problem counts every possible pair in the room, not matches against one predetermined birthday. The many pairings make a match appear surprisingly early.
Replace 365 birthdays with 2^n possible hash outputs. An attacker collecting many candidate messages gets many pairwise comparisons, so a collision becomes likely after about 2^(n/2) random-looking outputs.
A 128-bit digest provides about 64 bits of ideal collision resistance. SHA-1's 160-bit output has an ideal 80-bit birthday bound, and SHA-256 targets about 128 bits. Actual algorithms need separate analysis: matching output lengths alone do not establish matching collision strength.
Merkle–Damgård turns a long message into a digest
SHA-1 and the SHA-2 family use an iterative structure. SHA-256 pads the message, includes its original length, splits the result into 512-bit blocks, and updates a 256-bit internal state block by block.
The relay-race picture captures the chaining rule: every compression step receives both the next message block and the state from the previous step. A change near the beginning therefore propagates through all later states.
This construction also creates a usage trap. Plain `SHA-256(secret || message)` can be vulnerable to length extension. SHA-384 and SHA-512/256 do not expose the full SHA-512-family internal state, so the standard attack used against SHA-256 does not transfer directly; SHA-3 uses a different sponge construction. These distinctions do not replace sound protocol design: message authentication should still use HMAC or another standardized authenticated construction. [1][5]
Hash algorithms have life cycles
MD2, MD4, and MD5 are Ronald Rivest's message-digest family. MD5 became ubiquitous, but practical collision attacks eventually made it unacceptable for applications that rely on collision resistance, including digital signatures. [6]
SHA-1 appeared during the same period but is not part of Rivest's MD family. It came from the U.S. standards process, has a 160-bit output, and shares the broad iterative design style of its era.
Systems need crypto agility: formats should identify their algorithms, software should remain updatable, and hardware trust chains should support migration to stronger hashes and signatures. Saving a small amount of area by freezing one algorithm forever can become an expensive system failure later.
SHAttered made a full SHA-1 collision real
In 2017, Google Research and CWI Amsterdam published two different PDF files with the same SHA-1 digest. SHAttered was a practical public collision for the full SHA-1 function. [4]
SHAttered did not recover messages from arbitrary SHA-1 digests. It broke collision resistance by producing two different files with the same digest. That result is devastating for workflows that treat the digest as a unique representative before signing or validating a document.
New security designs should not use SHA-1. NIST is transitioning away from SHA-1 for all cryptographic protection by the end of 2030. Legacy parsing may remain necessary, but reading old SHA-1 material is different from creating new trust with it. [3]
Five applications use hashes under different trust rules
File integrity compares a freshly computed digest with a trusted reference. Digital signatures hash a message before a private-key operation, but the signature scheme, key, certificate, and verification policy provide the authentication.
Password databases need a dedicated password hashing or key-stretching function such as Argon2id. A salt is necessary, but raw `SHA-256(password || salt)` is still too fast against large-scale guessing. [7]
HMAC combines a secret key and a hash in a standardized inner-and-outer construction. Merkle trees combine many leaf hashes into one root and support compact inclusion proofs. In both cases, SHA supplies one cryptographic building block; keys, proofs, and protocol rules provide the rest of the security. [5][8]
Hardware trust needs more than one hash comparison
A Secure Boot chain verifies each stage before transferring control. SHA compresses the candidate image into a digest; a trusted public key and digital-signature verification decide whether an authorized publisher signed it. [9]
OTP or eFuse and a PUF play complementary roles. OTP or eFuse may hold a root public-key hash, lifecycle state, anti-rollback version, debug policy, or other fixed configuration. A PUF can help reconstruct device-bound root material, which a KDF can separate into purpose-specific keys.
A PUF does not replace OTP, and it does not necessarily protect the OTP contents directly. Whether a PUF-derived key protects Secure Storage or other secret state depends on the product architecture.
Engineer extension: implementation boundaries for OTP, PUF, and SHA engines
Even when OTP or eFuse cannot be rewritten freely, sense margins, read paths, error correction, access control, side channels, and fault injection remain part of the security boundary. A production PUF flow also needs enrollment, helper data, error correction, environmental margin, and key lifecycle control.
A hardware SHA engine still faces PPA tradeoffs. An iterative design reuses round logic to save area at higher latency; unrolled or pipelined designs raise throughput while increasing area and switching power. Supporting SHA-256, SHA-384, SHA-512, HMAC, and KDF functions also affects datapath width, schedule storage, key paths, and side-channel boundaries.
Part 1 summary
SHA is hashing, not encryption. Its output length is fixed by the selected algorithm, and the three resistance properties describe different attacker goals. For an ideal n-bit output, collision search reaches a generic bound near 2^(n/2).
SHA-1's collision resistance has failed. Modern systems should choose an appropriate SHA-2, SHA-3, or other approved construction, while keeping room for future algorithm replacement.
Hashes support integrity checks, signatures, HMAC, KDFs, Merkle trees, and hardware roots of trust. The surrounding system still has to manage keys, salts, signatures, version rules, failure paths, and update mechanisms correctly.
Part 2 will examine the SHA-256 and SHA-512 rounds, message schedules, and hardware architectures, then compare the SHA-2 design with SHA-3's Keccak sponge.
References
- NIST FIPS 180-4: Secure Hash Standard: The standard specification for SHA-1 and the SHA-2 family, including padding, block processing, and digest lengths.
- NIST SP 800-107 Rev. 1: Guidance on preimage, second-preimage, and collision strength and on hash use in signatures, HMAC, and KDFs.
- NIST: Transitioning Away from SHA-1 for All Applications: The official transition plan to remove SHA-1 from cryptographic protection by the end of 2030.
- SHAttered: The 2017 Google Research and CWI Amsterdam project that published the first practical public collision for full SHA-1.
- RFC 2104: HMAC: The standardized inner-and-outer keyed-hash construction for message authentication.
- RFC 6151: Updated Security Considerations for MD5: Explains why MD5 is unacceptable where collision resistance is required and distinguishes MD5 from HMAC-MD5 use.
- RFC 9106: Argon2: An implementer-oriented specification for a memory-hard password hashing function.
- RFC 9162: Certificate Transparency Version 2.0: A concrete specification of Merkle trees, inclusion proofs, and consistency proofs.
- NIST SP 800-193: Platform Firmware Resiliency Guidelines: Guidance for authenticated firmware updates, roots of trust, detection, protection, and recovery.
WORK IT BY HAND
Work it by hand: cook "abc" into a SHA-256 digest
SHA-256 is like cooking a pot of soup. H is the stock, and everyone starts with the same stock. W is the ingredients, which is your message. K is the seasoning: different in each round, but public and fixed. You stir for 64 rounds, add the stock back, and ladle out 256 bits. That is the digest.
Once the soup is cooked, you cannot separate the ingredients again. That is what “one-way” means for a hash function. Below, we compute the FIPS 180-4 example "abc" step by step.

1Start with the result: change one letter
Feed Hello and hello into SHA-256. The inputs differ only in the case of the first letter.
| Input | SHA-256 |
|---|---|
| Hello | 185f8db3 2271fe25 f561a6fc 938b2e26 4306ec30 4eda5180 07d17648 26381969 |
| hello | 2cf24dba 5fb0a30e 26e83b2a c5b9e29e 1b161e5c 1fa7425e 73043362 938b9824 |
The two digests show no visible relation. Both are 256 bits long (64 hex characters). A digest is not ciphertext: there is no key anywhere in the process, and nothing to “decrypt”.
2Padding: fill "abc" up to 512 bits
SHA-256 eats one 512-bit block at a time. "abc" has only 3 bytes, so it must be padded first:
- ASCII: a = 61, b = 62, c = 63. That is 24 bits.
- Append one “1” bit, then “0” bits. That 1 plus the next seven 0s form one byte: 1000 0000 = 80.
- Keep adding 0 bits up to bit 448.
- The last 64 bits hold the original length: 24 = 0x18.
| W0 | W1 | W2 | W3 | W4 | W5 | W6 | W7 |
|---|---|---|---|---|---|---|---|
| 61626380 | 00000000 | 00000000 | 00000000 | 00000000 | 00000000 | 00000000 | 00000000 |
| W8 | W9 | W10 | W11 | W12 | W13 | W14 | W15 |
| 00000000 | 00000000 | 00000000 | 00000000 | 00000000 | 00000000 | 00000000 | 00000018 |
One block is 16 32-bit words, W0–W15. The length is written into the block, so a message with one extra zero byte pads differently.
3Initial values H and constants K: the stock and the seasoning
H0–H7 are the 8 words of stock. K0–K63 are 64 portions of seasoning. These numbers are not arbitrary. H comes from the square roots of the first 8 primes. K comes from the cube roots of the first 64 primes. In both cases, keep only the fractional part and multiply by 2³².
| H0 | H1 | H2 | H3 | H4 | H5 | H6 | H7 |
|---|---|---|---|---|---|---|---|
| √2 | √3 | √5 | √7 | √11 | √13 | √17 | √19 |
| 6a09e667 | bb67ae85 | 3c6ef372 | a54ff53a | 510e527f | 9b05688c | 1f83d9ab | 5be0cd19 |
Check K1 yourself (the second prime is 3):
- ∛3 = 1.44224957…
- Keep the fraction:0.44224957…
- × 2³² ≈ 1,899,447,441
- Convert to hex:K1 = 0x71374491
H0 works the same way: √2 = 1.41421356…; the fractional part × 2³², rounded down, is 6a09e667.
Anyone can check these constants with a calculator, so the designers had no room to hide a special number. These are called nothing-up-my-sleeve numbers.
4Message schedule: 16 words become 64
Each of the 64 rounds needs one word Wt, but the block gives only 16. The other 48 come from a formula (all additions are mod 2³²):
Wt = σ1(Wt−2) + Wt−7 + σ0(Wt−15) + Wt−16
σ0(x) = ROTR⁷(x) ⊕ ROTR¹⁸(x) ⊕ SHR³(x)
σ1(x) = ROTR¹⁷(x) ⊕ ROTR¹⁹(x) ⊕ SHR¹⁰(x)
ROTR is a rotate right: bits that fall off the right come back on the left. SHR is a plain shift right: bits that fall off are lost, and 0s come in on the left. So σ means “turn the word by a few amounts, then XOR the copies together”.
W16 = σ1(W14) + W9 + σ0(W1) + W0
= σ1(0) + 0 + σ0(0) + 61626380
= 61626380
W14, W9 and W1 are all 0, and σ(0) is also 0, so W16 happens to equal W0. Later words are not so convenient.
It works like a window 16 words wide that slides right by one each time. After 48 slides, 16 words have become 64, and every message bit has been carried into many later words.
5One round of stirring: 8 words on a conveyor belt
The 8 working registers a–h start equal to H0–H7. Each round, b, c and d take the old a, b and c; f, g and h take the old e, f and g; the old h falls off the end. Only the new a and the new e need real computation.
Four small tools do the work:
- Ch(e, f, g): e acts as a switch. Where a bit of e is 1, take that bit from f; where it is 0, take it from g. Example: e = 1010, f = 1100, g = 0011 → 1001.
- Maj(a, b, c): a three-way majority vote. For each bit, a, b and c each cast one vote, and the majority wins. Example: a = 1100, b = 1010, c = 0110 → 1110.
- Σ1(e): rotate e right by 6, 11 and 25 bits, and XOR the three copies.
- Σ0(a): rotate a right by 2, 13 and 22 bits, and XOR the three copies.
With the real numbers of round 1 (W0 = 61626380, K0 = 428a2f98):
| h | 5be0cd19 |
| + Σ1(e) | 3587272b |
| + Ch(e, f, g) | 1f85c98c |
| + K0 | 428a2f98 |
| + W0 | 61626380 |
| = T1 | 54da50e8 |
| Σ0(a) | ce20b47e |
| + Maj(a, b, c) | 3a6fe667 |
| = T2 | 08909ae5 |
new e = d + T1 = a54ff53a + 54da50e8 = fa2a4622
new a = T1 + T2 = 54da50e8 + 08909ae5 = 5d6aebcd
Every “+” here is addition mod 2³²: a carry beyond 32 bits is dropped. For example, ce20b47e + 3a6fe667 is really 1 08909ae5; drop the leading 1 to get 08909ae5.
| a | b | c | d | e | f | g | h | |
|---|---|---|---|---|---|---|---|---|
| Before | 6a09e667 | bb67ae85 | 3c6ef372 | a54ff53a | 510e527f | 9b05688c | 1f83d9ab | 5be0cd19 |
| After | 5d6aebcd | 6a09e667 | bb67ae85 | 3c6ef372 | fa2a4622 | 510e527f | 9b05688c | 1f83d9ab |
Only a and e are newly computed each round; the other 6 words shift one place right. But together the new a and e use all 8 words, plus W and K. After a few rounds, every word depends on the message.
6Avalanche: what one bit changes
Change "abc" to "abb". c = 63 and b = 62 differ in just 1 bit. At the end of each round, compare a–h on both sides, 256 bits in total, and count how many bits differ:
| Input | SHA-256 |
|---|---|
| abc | ba7816bf 8f01cfea 414140de 5dae2223 b00361a3 96177a9c b410ff61 f20015ad |
| abb | 715edf8b a8729420 cd4d1ce8 5ed61954 a9f531f8 c548df72 8c407eff e839296d |
After round 1, only 3 bits differ. By round 8, 129 differ, about half, and the count then hovers around half. In the final digests, 124 of 256 bits differ. The state is well mixed after about 6–8 rounds; the remaining rounds are a safety margin.
7Add the stock back and ladle out the digest
After 64 rounds, add a–h back into H0–H7 word by word (mod 2³²). The 8 words joined together are the digest. The 64 rounds of stirring alone could be run backwards by anyone who knows each W. Adding the stock back mixes the start and the end into the output, so that direct reversal no longer works.
SHA-256("abc") =
ba7816bf 8f01cfea 414140de 5dae2223 b00361a3 96177a9c b410ff61 f20015ad
This matches the FIPS 180-4 example exactly. A digest only proves that the content is the same. To prove who sent it, you need an HMAC (a secret key both sides share) or a digital signature (the signer’s private key plus a trusted public key). See the digital signature lesson
MY ACADEMY · RTL LAB
Operate SHA-256: follow blocks and round registers
Start with abc at round 0 and inspect W, K, T1, T2 and a–h. Load the 56-byte example to see why padding creates two blocks and how the previous block updates H.
The teaching schedule has LOAD, 64 ROUND updates and ACCUMULATE. LOAD and ACCUMULATE are separate steps. Actual RTL latency depends on its FSM, schedule and interface.
Evidence scope: a browser functional teaching model. Independent comparison uses browser Web Crypto. No RTL simulation, synthesis, formal proof or side-channel testing is performed.
Before operation
After operation
Inspect blocks, schedule and round keys
Output handshake: valid / ready
At OUTPUT, the output remains stable. Set ready, then sample an edge to record acceptance. Changing ready alone does not accept data. This handshake is a separately defined teaching interface.
Transfer exercise: may RTL clear output_valid or overwrite the result before downstream is ready? State the hold rule in plain language: unless reset cancels the transaction, valid and data remain stable until a handshake. SVA syntax is an optional next exercise.
Learning guide
Cryptography
Open the course outline → · Progress counts published lessons only
Prerequisites
- Binary data and basic security terminology
What I learned
- Distinguish hashing from encryption
- Compare preimage, second-preimage, and collision resistance
- Place SHA correctly inside HMAC, signatures, and Secure Boot