0% found this document useful (0 votes)
4 views6 pages

SHA TOY Example

The document outlines a toy SHA round using 8-bit registers, detailing the computation of various functions including Ch, Maj, Σ1, and Σ0. It provides step-by-step calculations for T1 and T2, followed by the updates to the registers after one round. The final state of the registers is presented at the end of the document.

Uploaded by

Agrim Gusain
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views6 pages

SHA TOY Example

The document outlines a toy SHA round using 8-bit registers, detailing the computation of various functions including Ch, Maj, Σ1, and Σ0. It provides step-by-step calculations for T1 and T2, followed by the updates to the registers after one round. The final state of the registers is presented at the end of the document.

Uploaded by

Agrim Gusain
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Toy SHA Round Using 8-bit Registers

Given Values
a = 10110110
b = 11001001
c = 01101100
d = 00111011
e = 10010110
f = 01111010
g = 11000101
h = 00110111

Message word W = 10111000


Round constant K = 00101101

Step 1: Compute Ch(e,f,g)


Formula:
Ch(e,f,g) = (e AND f) XOR (NOT e AND g)

1. Compute e AND f

e=10010110
f=01111010
----------------------
e∧f = 0 0 0 1 0 0 1 0

Result = 00010010

2. Compute NOT e (invert every bit)

e = 10010110
NOT e = 01101001

3. Compute (NOT e) AND g

NOT e = 0 1 1 0 1 0 0 1
g =11000101
-----------------------
Result = 0 1 0 0 0 0 0 1

Result = 01000001

4. XOR the two results

00010010
01000001
--------
01010011

Final Ch(e,f,g) = 01010011

Step 2: Compute Maj(a,b,c)


Formula:
Maj(a,b,c) = (a AND b) XOR (a AND c) XOR (b AND c)

1. Compute a AND b

a=10110110
b=11001001
------------------
10000000

Result = 10000000

2. Compute a AND c

a=10110110
c=01101100
------------------
00100100

Result = 00100100

3. Compute b AND c
b=11001001
c=01101100
------------------
01001000

Result = 01001000

4. XOR the results

10000000
00100100
--------
10100100

10100100
01001000
--------
11101100

Final Maj(a,b,c) = 11101100

Step 3: Compute Σ1(e)


Toy formula:
Σ1(e) = ROTR¹(e) XOR ROTR⁴(e) XOR ROTR⁶(e)

e = 10010110

ROTR¹(e) = 01001011
ROTR⁴(e) = 01101001
ROTR⁶(e) = 01011010

XOR:
01001011
01101001
--------
00100010
00100010
01011010
--------
01111000

Σ1(e) = 01111000

Step 4: Compute Σ0(a)


Toy formula:
Σ0(a) = ROTR²(a) XOR ROTR³(a) XOR ROTR⁵(a)

ROTR²(a) = 10101101
ROTR³(a) = 11010110
ROTR⁵(a) = 10110101

XOR:
10101101
11010110
--------
01111011

01111011
10110101
--------
11001110

Σ0(a) = 11001110

Step 5: Compute T1
T1 = h + Σ1(e) + Ch(e,f,g) + K + W

h = 00110111 = 55
Σ1(e) = 01111000 = 120
Ch = 01010011 = 83
K = 00101101 = 45
W = 10111000 = 184

Total = 487
Since 8-bit arithmetic is used:
T1 = 487 mod 256 = 231
T1 = 11100111

Step 6: Compute T2
T2 = Σ0(a) + Maj(a,b,c)

Σ0(a) = 11001110 = 206


Maj = 11101100 = 236

Total = 442
T2 = 442 mod 256 = 186
T2 = 10111010

Step 7: Update Registers


a' = T1 + T2 = 231 + 186 = 417 → mod256 = 161 → 10100001
e' = d + T1 = 59 + 231 = 290 → mod256 = 34 → 00100010

b' = a = 10110110
c' = b = 11001001
d' = c = 01101100
f' = e = 10010110
g' = f = 01111010
h' = g = 11000101

Final Registers After One Round


a' = 10100001
b' = 10110110
c' = 11001001
d' = 01101100
e' = 00100010
f' = 10010110
g' = 01111010
h' = 11000101

You might also like