# By: Matthew Ng. AND, XOR, OR, Complement, Circular Left shift, and Addition Modulo Circular Left Shift is done with s positions (0 ≤ s ≤ 31) – Denoted.

## Presentation on theme: "By: Matthew Ng. AND, XOR, OR, Complement, Circular Left shift, and Addition Modulo Circular Left Shift is done with s positions (0 ≤ s ≤ 31) – Denoted."— Presentation transcript:

By: Matthew Ng

AND, XOR, OR, Complement, Circular Left shift, and Addition Modulo Circular Left Shift is done with s positions (0 ≤ s ≤ 31) – Denoted by ROTL s Addition Modulo is 2 32

This is pads the input. The binary representation of |x| is l and it is at most 64 bits If |l| < 64 bits then it is padded from the left with zeros to make 64 bits. In the construction of y – one is appended to x and then concatenated with enough zeros so the length is congruent to 448 modulo 512. A concatenation 64 bits that contain binary representation of the original length of x. Divide the string by 512 and create a concatenation of n blocks each of them being 512 bits. y = M1 || M2 || … || Mn

SHA-1-pad (x) : D = (447 - |x|) Mod 512 L = binary of |x| where |l| = 64 y = x || 1 || 0 d || 1 |x| ≤ 2 64 - 1

ABCDE are 32-bit words in the state F is a non-linear function that varies <<< n is a left bit rotation by n places (n varies for each operation) W t is the expanded message word of round t K t is the round constant of round t Boxes addition modulo 2 32

The function is based on what round it is on. If the round is between 0 and 19 F(B,C,D) : (B ∧ C) ∨ ((~B) ∧ D) If the round is between 20 and 39 F(B,C,D): (B XOR C XOR D) If the round is between 40 to 59 F(B,C,D): (B ∧ C) ∨ (B ∧ D) ∨ (C ∧ D) If the round is between 60 to 79 F(B,C,D): (B XOR C XOR D)

The keys also depend on what the round is When the round is between 0 to 19 K t = 5A827999 When the round is between 20 to 39 K t = 6ED9EBA1 When the round is between 40 to 59 K t = 8F1BBCDC When the round is between 60 to 79 K t = CA62C1D6

y = SHA-1-Pad(x) //y = M1 || M2 ||.. || Mn //Initialize Variables H0 = 67452301 H1 = EFCDAB89 H2 = 98BADCFE H3 = 10325476 H4 = CSD2E1F0 For i = 1 to n Mi = W0 || W1 || … || W15 //Wi is a word For t = 16 to 79 W t = ROTL 1 (W t-3 XOR W t-8 XOR W t-14 XOR W t-16 )

A = H0, B = H1, C = H2, D = H3, E = H4 For t = 0 to 79 temp = ROTL 5 (A) + F t (B,C,D) + E + W i + K t E = D, D = C, C = ROTL 30 (B), B = A, A = temp H0 = H0 + A H1 = H1 + B H2 = H2 + C H3 = H3 + D H4 = H4 + E Return (H0 || H1 || H2 || H3 || H4)

Stinson Textbook

Download ppt "By: Matthew Ng. AND, XOR, OR, Complement, Circular Left shift, and Addition Modulo Circular Left Shift is done with s positions (0 ≤ s ≤ 31) – Denoted."

Similar presentations