You are on page 1of 19

SECURE HASH ALGORITHM -224

BY
YESHWANTH KUMAR.B

EC (104223)
ADVANCED COMMUNICATION SYSTEMS
M. TECH

CONTENTS
o
o
o
o
o

History of SHA
Algorithm
WORKING EXAMPLE
Applications
Comparison between SHAs

History of SHA

o National Institute of Standards and Technology (NIST)


o 1993
o The hash function SHA-0 was issued as a federal standard
by NIST
o 1995
o SHA-1 published as the successor to SHA-0
o 2002
o SHA-2 variants
o SHA-256, SHA-384, and SHA-512 published
o 2004
o SHA-224 published
o 2005
o Attack on SHA-1 announced

BLOCK DIAGRAM OF SHA-2


AA B

C D E

wt

F G H
Ch

kt

M
a
0

A B C D E F

Hash Functions:
Map messages of variable length to fixed length outputs

Algorithm consist

3 stages

Message Padding and Parsing

Message Expansion
Message Compression

Message padding and parsing


423
01100001 01100010 01100011 1 00.00
a

+ 1

Given data

+ 0000

448 mod 512 bits

64 bits

Given data

0000

+ Len(x)

Given data

0000

Len(x)

512 bits

00011000
l = 24

Given data
Given data

64

512 bits

Message Expansion
.

M(i)
512 bits

M1(i)

M(n)
512 bits

M2(i)

..

M15(i)

32 bit

Messages processed in blocks of 512 bits = 16 32-bit blocks


16 32-bit Mt(i)blocks expanded to 64 32-bit Wtblocks
M(i)t

0 t 15

{256 }1(W t-1) + W t-7+ {256 }0(W t-15) + W t-16

16 t 63

Wt =

0{256}(x)
1{256}( x)

= ROTR7(x) ROTR18(x) SHR3(x)


= ROTR17(x) ROTR19(x) SHR10(x)

Message Compression (Hashing)


8 32-bit working variables:

A, B, C, D, E, F, G, H

Initialized to pre-defined values H0(0) H7(0)


ch(x,y,z)
= ( xy ) ( -xz )
Maj (x,y,z )= (xy) (xz) (yz)
{256}0 (x ) =ROTR2(x) ROTR13(x) ROTR22(x)
{256}1 (x ) = ROTR6(x) ROTR11(x) ROTR25(x)

H=G
G=F
F=E
E = D + T1
D=C
C:= B
B=A
A:= T1 + T2
T1= H + {256 }1 (E) + Ch(E, F, G) +K{256 }t + W t
T2= H + {256 }0 (A) + Maj(A, B, C)
for 0 t 63

64 iterations of
compression function

Kt
o sixty-four constant 32-bit words.
o first thirty-two bits of the fractional parts of cube roots of the first sixty
four prime numbers.

k[0..63] :=
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, x76f988da,
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2

ROUND FUNCTION
A_H
B

A
0
T1+T2

Maj (A,B,C)

Ch(E,F,G)

Wt+Kt

T1

T1= H + {256 }1 (E) + Ch(E, F, G) +K{256 }t + W t


T2= H + {256 }0 (A) + Maj(A, B, C)
A=T1+T2
A= {256 }0 (A) + Maj(A, B, C) + H + {256 }1 (E) + Ch(E, F, G) +K{256 }t + W t

Add this chunk's hash to result so far:


h0 := h0 + a
h1 := h1 + b
h2 := h2 + c
h3 := h3 + d
h4 := h4 + e
h5 := h5 + f
h6 := h6 + g
Produce the final hash value (big-endian):
digest = hash = h0 append h1 append h2 append h3 append h4
append h5 append h6 .

SECURE HASH ALGORITHM WORKING EXAMPLE


Message Digest Length = 224
One Block Message Sample

Input Message: "abc


Initial hash value:
H[0] = C1059ED8
H[1] = 367CD507
H[2] = 3070DD17
H[3] = F70E5939
H[4] = FFC00B31
H[5] = 68581511
H[6] = 64F98FA7
H[7] = BEFA4FA4

Block Contents:
W[0] = 61626380
W[1] = 00000000
W[2] = 00000000
W[3] = 00000000
W[4] = 00000000
W[5] = 00000000
W[6] = 00000000
W[7] = 00000000
W[8] = 00000000
W[9] = 00000000
W[10] = 00000000
W[11] = 00000000
W[12] = 00000000
W[13] = 00000000
W[14] = 00000000
W[15] = 00000018

ITERATION HASH FUNCTION


A

t= 0: 0E96B2DA C1059ED8 367CD507 3070DD17 0434225E


t=1
t=2 t=63: 6203DE4A FD89031B 55D1C760 C693FC7A 2AEDB1B3

FFC00B31

68581511

64F98FA7

55489EE6 7E730E00

13DFB889

GENERATING MESSAGE DIGEST


H[0] = C1059ED8 + 6203DE4A = 23097D22
H[1] = 367CD507 + FD89031B = 3405D822
H[2] = 3070DD17 + 55D1C760 = 8642A477
H[3] = F70E5939 + C693FC7A = BDA255B3
H[4] = FFC00B31 + 2AEDB1B3 = 2AADBCE4
H[5] = 68581511 + 55489EE6 = BDA0B3F7
H[6] = 64F98FA7 + 7E730E00 = E36C9DA7
H[7] = BEFA4FA4 + 13DFB889 = D2DA082D

Message Digest
23097D22

3405D822

8642A477

2AADBCE4 BDA0B3F7 E36C9DA7

BDA255B3

Applications
oMessage Integrity/Authentication
oPassword Protection (UNIX)
oDigital Signature (DSS)
oInternet Protocol Security (IPSec)
oTransport Layer Security (TLS)
oRandom Number Generation Algorithms
oMessage Integrity/Authentication

Comparison between SHAs


Output size
(bits)

Internal state
size (bits)

SHA-0

160

160

512

264 1

32

SHA-1

160

160

512

264 1

SHA-256/224

256/224

256

512

SHA-512/384

512/384

512

1024

Algorithm

Block size
(bits)

Max message
size (bits)

Word size
(bits)

Rounds

Operations

Collision

80

+,and,or,xor,rotl

Yes

32

80

+,and,or,xor,rotl

2^63
attack

264 1

32

64

+,and,or,xor,shr,ro
tr

None yet

2128 1

64

80

+,and,or,xor,shr,ro
tr

None yet

References
o NIST, Federal Information Processing Standards Publication 180-2,
Secure Hash Standards (SHS), August 2001.
o NIST Special Publication (SP) 800-57, Part 1, Recommendation for
Key Management: General, August 2005.
o NIST Special Publication (SP) 800-107, Recommendation for
Applications Using Approved Hash Algorithms, (Draft) July 2008.

You might also like