Mission tie-in: SHA-1 exams often start with "how many padding zeros?" — master the 512-bit block layout before worrying about all 80 compression rounds.
What SHA-1 does
Takes any message → fixed 160-bit hash. One-way: you cannot recover the message. Tiny input change → completely different hash (avalanche effect).
Message M
→
Pad to 512-bit blocks
→
80 rounds / block
→
160-bit digest
Padding rule
Append a single 1 bit
Append k zero bits where (original_length + 1 + k) ≡ 448 (mod 512)
Append original message length as a 64-bit big-endian integer
12 chars × 8 bits = 96 bits original length. Use the calculator below to verify padding for any bit length.
Step
Bits so far
Calculation
Original message
96
12 × 8
+ append "1"
97
+ zeros
448
See calculator → 351 zeros
+ 64-bit length
512
96 + 1 + 351 + 64 = 512 ✓
Visual: one 512-bit block
Message (96)
1
··· 351 zeros ···
len=96
After padding — compression (overview)
Each 512-bit block is split into sixteen 32-bit words W₀…W₁₅. Words W₁₆…W₇₉ are expanded from earlier words. Five registers (A,B,C,D,E) update through 80 rounds using nonlinear functions and constants.
Your professor's SHA-1 example doc shows the round-by-round format — match that layout on exams.
Padding drill
A message is 96 bits long. How many zero bits are appended after the "1" bit?
Concept drill
Can you decrypt a SHA-1 hash to recover the original message?
Stuck? Ask: "How many padding zeros for a 200-bit message?" or "Walk me through W₁₆ expansion."