Here’s a clear, step-by-step explanation of how to generate a SHA-256 hash, using one simple example.
✅ Example Input
Let’s take this text as input:
Hello
---
✅ Step 1: Convert Input to Binary (UTF-8)
Each character is converted to its ASCII binary value:
Character ASCII Binary (8-bit)
H 72 01001000
e 101 01100101
l 108 01101100
l 108 01101100
o 111 01101111
Final binary message:
0100100001100101011011000110110001101111
✅ Step 2: Padding the Message
SHA-256 requires the message length ≡ 448 mod 512
1. Append 1 at the end
2. Add 0s until length = 448 bits
3. Append 64-bit original length
Original length = 40 bits
Final 512-bit block is formed.
✅ Step 3: Initialize Hash Values (H₀ – H₇)
SHA-256 uses fixed initial values:
H0 = 6a09e667
H1 = bb67ae85
H2 = 3c6ef372
H3 = a54ff53a
H4 = 510e527f
H5 = 9b05688c
H6 = 1f83d9ab
H7 = 5be0cd19
✅ Step 4: Message Scheduling (W₀ – W₆₃)
First 16 words → from padded message
Remaining 48 words → computed using:
Wt = σ1(Wt-2) + Wt-7 + σ0(Wt-15) + Wt-16
✅ Step 5: Compression (64 Rounds)
Each round uses:
T1 = h + Σ1(e) + Ch(e,f,g) + Kt + Wt
T2 = Σ0(a) + Maj(a,b,c)
Registers update after each round.
---
✅ Step 6: Final Hash Computation
After 64 rounds, final values:
H0 = H0 + a
H1 = H1 + b
---
H7 = H7 + h
✅ ✅ Final SHA-256 Hash Output for "Hello"
185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969
✅ This is the exact SHA-256 hash of the word "Hello"
---
✅ ✅ Easy Way to Generate SHA-256 in Practice
🔹 Using Python
import hashlib
text = "Hello"
hash_object = hashlib.sha256([Link]())
print(hash_object.hexdigest()
---
🔹 Using Online Tool
You can use any SHA-256 generator online and input:
Hello
---
✅ Key Properties of SHA-256
Deterministic → Same input = same output
One-way function
256-bit output (64 hex characters)
Widely used in Blockchain, Digital Signatures, Securit