0% found this document useful (0 votes)
79 views17 pages

Lecture#08: Cryptographic Hash Functions-SHA-I

The document discusses cryptographic hash functions and specifically focuses on Secure Hash Algorithm 1 (SHA-1). It defines what a hash function is, how it condenses messages into fixed-size outputs, and compares hashing to encryption. It then explains how SHA-1 works by breaking messages into blocks, initializing chaining variables, and performing multiple rounds of compression functions to generate the hash output.

Uploaded by

Ushba Saleem
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)
79 views17 pages

Lecture#08: Cryptographic Hash Functions-SHA-I

The document discusses cryptographic hash functions and specifically focuses on Secure Hash Algorithm 1 (SHA-1). It defines what a hash function is, how it condenses messages into fixed-size outputs, and compares hashing to encryption. It then explains how SHA-1 works by breaking messages into blocks, initializing chaining variables, and performing multiple rounds of compression functions to generate the hash output.

Uploaded by

Ushba Saleem
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
You are on page 1/ 17

CLO 2

Lecture#08
Cryptographic Hash Functions- SHA-I
Course: Cryptography & Network Security (CE-408)
Course Teacher: Ms. Rukaiya

Contact Info:

Room No: BS-02, CED / AS-09, ORIC

Email: rukaiya@ssuet.edu.pk

1
Hash Function
• The hash value represents
concisely the longer message
 may called the message digest
• A message digest is as a ``digital
fingerprint'' of the original
document

condenses arbitrary message to fixed size


h = H(M)

2
Chewing Function

 Hashing function as “chewing” or “digest” function

3
Hashing V.S. Encryption
Hello, world. k NhbXBsZSBzZW50ZW5jZS
A sample sentence to E B0byBzaG93IEVuY3J5cHR
show encryption. pb24KsZSBzZ

Hello, world. k
NhbXBsZSBzZW50ZW5jZS
A sample sentence to D
B0byBzaG93IEVuY3J5cHR
show encryption. pb24KsZSBzZ

 Encryption is two way, and requires a key to encrypt/decrypt

This is a clear text that


can easily read without 52f21cf7c7034a20
using the key. The
h 17a21e17e061a863
sentence is longer than
the text above.

 Hashing is one-way. There is no 'de-hashing’


Integrity

• to create a one-way password file


 store hash of password not actual password

• for intrusion detection and virus detection


 keep & check hash of files on system
Password Verification

Store Hashing Password Verification an input password against the stored hash

Iam#4VKU Iam#4VKU
Password
store

h h

661dce0da2bcb2d8 661dce0da2bcb2d8 661dce0da2bcb2d8


2884e0162acf8194 2884e0162acf8194 2884e0162acf8194

Hash Matching
Exactly?
Password Yes No
store Deny
Grant
Secure Hash Algorithm
• SHA originally designed by NIST & NSA in 1993
• was revised in 1995 as SHA-1
• US standard for use with DSA signature scheme
 standard is FIPS 180-1 1995, also Internet
RFC3174
 nb. the algorithm is SHA, the standard is SHS
• based on design of MD5 with key differences
• produces 160-bit hash values
• recent 2005 results on security of SHA-1 have
raised concerns on its use in future applications
How SHA Works?
• Digest Length=160 bit

• I/P Text=512 bit

• Sub Block size=32bit

• 512/32=16 total Sub blocks

• No. Of Rounds=4

• Iteration per round=20

• Chaining Variable = 5*32=160

• K[t] constant= Where t=0 to 79

• O/P-> four 32 bit blocks


SHA-1 Compression Function

ABCDE=(F[t]+E+S5(A)+W[t]+K[t]),>>>Shift right by 1 bit for next iteration


SHA-I
• Example

For the given message ‘A Test’, find its message digest

Step #01: Break the message into characters

ATest
Note: spaces are counted as characters

Step#02: Convert the characters into ASCII codes

A - T e s t

65 32 84 101 115 116

Step #03: Convert the numbers into binary (x 8bits)

65 32 84 101 115 116

01000001 00100000 01010100 01100101 01110011 01110100


SHA-I
• Example
Step #03: Appending bits to make it multiple of 512
• Check length <448 means 448 mod 512

448 – 48 =400
• Add ‘1’ at the end of message leading with 399 zeros
01000001 00100000 01010100 01100101 01110011 01110100 10000000
00000000 00000000 ………..

• Step #04: Appending original message length 64-bit representation


of the original message
• The original message is of length 48 bits, the binary representation of 48
bits is 110000
• To make it 64 bit, add 58 zeros to the beginning of the number
58 zeros 110000
01000001 00100000 01010100 01100101 01110011 01110100 10000000
00000000 00000000 ……….. 58 zeros 110000
SHA-I
1. Initialise CV 5-word (160-bit) buffer (A,B,C,D,E) to
A=01 23 45 67
B=89 AB CD EF
C=FE DC BA 98
D=76 54 32 10
E=C3 D2 E1 F0

K1 = 5A 82 79 99
K 2 = 6E D9 EB A1
K 3 = 8F 1B BC DC
K 4 = CA 62 CI D6
SHA-I
Step #05: Break the message into chunks

• The message is 400 + 48 +64 = 512 bits

• So, we need 16 words of 32 bits

512/32 =16 words

Step #06: Break the message into words (32 bits)

W[0] = 01000001001000000101010001100101

W[1] = 01110011011101001000000000000000

W[2] =

……

W[15] = ---------------

Step #07: Extend it into 80 words because

4 rounds * 20 steps

Find the current word by using

W[16]= W[16-3] XOR W[16-8] XOR W[16-14] XOR W[16-16]


SHA-I
Find the current word by using

W[16]= W[16-3] XOR W[16-8] XOR W[16-14] XOR W[16-16]

W[16] = W[13] xor W[8] xor W[2] xor W[0]

Step #07: Solve it for the round


SHA-1 Compression Function

ABCDE=(F[t]+E+S5(A)+W[t]+K[t]),>>>Shift right by 1 bit for next iteration


SHA-I
Initialise CV 5-word (160-bit) buffer (A,B,C,D,E) to
A=01 23 45 67
B=89 AB CD EF
C=FE DC BA 98
D=76 54 32 10
E=C3 D2 E1 F0
K1 = 5A 82 79 99
K 2 = 6E D9 EB A1
K 3 = 8F 1B BC DC
K 4 = CA 62 CI D6
 Function 𝑓𝑡
 ROUND 1: (b AND c) OR ((NOT b) AND (d)) same as MD5

ROUND 2: b XOR c XOR d

ROUND 3: (b AND c) OR (b AND d) OR (c AND d)

ROUND 4: b XOR c XOR d

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy