SHA - 256 Algorithm
SHA - 256 Algorithm
Ch(E, F, G) = (E ∧ F) ⊕ (¬E ∧ G)
Ma(A, B, C) = (A ∧ B) ⊕ (A ∧ C) ⊕ (B ∧ C)
∑0 (A) = (A rightrotate 2) ⊕ (A rightrotate 13) ⊕ (A rightrotate 22)
∑1 (E) = (E rightrotate 6) ⊕ (E rightrotate 11) ⊕ (E rightrotate 25)
1. Compute (w0 + k0) mod 232 (Called R1)
2. Compute (Ch(E, F, G) + H + R1) mod 232 (Called R2)
3. Compute (∑1 (E) + R2) mod 232 (Called R3)
4. Compute (D + R3) mod 232 (Called R4) and (R2 + Ma(A, B, C)) mod 232 (Called R5)
5. Compute (R5 + ∑0 (A)) mod 232 (Called R6)
6. Transmute a, b, c, d, e, f, g, h as: h = g, g = f, f = e, e = R4, d = c, c = b, b = a, a = R6
This process is repeated 64 times. At the end of the 64th process, 8 variables a to h will combine with h-
to h7, respectively, to calculate modular addition.
h0 = (h0 + a) mod 232
h1 = (h1 + b) mod 232
h2 = (h2 + c) mod 232
h3 = (h3 + d) mod 232
h4 = (h4 + e) mod 232
h5 = (h5 + f) mod 232
h6 = (h6 + g) mod 232
h7 = (h7 + h) mod 232
Then h0 to h7 will be converted to hexadecimal. The hash value will be h0h1h2h3h4h5h6h7 (Combine
8 string created from converted h0-h7)