47
Ragesh Jaiswal IIT Delhi Hash Functions

Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one

Ragesh Jaiswal

IIT Delhi

Hash Functions

Page 2: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 3: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one

Hash Functions: Collision

D

2n x1

x2

Pigeonhole Principle: h(x1) = h(x2), x1 ≠ x2

h

Page 4: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one

Hash Functions: Applications

1. Password Authentication:

Bob Server

Bob, <pass>

Pass/fail

• Problem: If Eve hacks into the server or if the communication channel is not secure, then Eve knows

the password of Bob.

S stores Bob’s password

Page 5: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one

Hash Functions: Applications

1. Password Authentication:

Bob Server

Bob, h(<pass>)

Pass/fail

• Eve can only get access to h(<pass>).

S stores h(Bob’s password)

Page 6: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one

Hash Functions: Applications

1. Comparing files by hashing:

Server B

Yes/No

• Problem: Files are usually very large and we would like to save communication costs/delays.

S has FB

Server A

S has FA

FA

Page 7: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one

Hash Functions: Applications

1. Comparing files by hashing:

Server B

S has FB

Server A

S has FA

h(FA)

h(FA) == h(FB)

Page 8: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one

Collision Resistance

Password Authentication: If Eve is able to find a string S (perhaps

different from <pass>) such that

h(S) = h(<pass>)

then the scheme breaks.

Comparing files: If there is a different file FS such that

h(FS) = h(FB)

the servers may agree incorrectly.

Collision Resistance: It is computationally infeasible to find a pair

(x1, x2) such that x1 ≠ x2 and

h(x1) = h(x2)

If a hash function h is collision resistant, then the above two

problems are avoided.

Page 9: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one

Collision Resistance: Discussion

Are there functions that are collision resistant?

Fortunately, there are functions for which no one has been able to find a

collision!

Example: SHA-1: {0,1}D {0,1}160

Is the world drastically going to change if someone finds one or few

collision for SHA-1?

Not really. Suppose the collision has some very specific structure, then

we may avoid such structures in the strings on which the hash function is

applied.

On the other hand, if no one finds a collision then that is a very strong

notion of security and we may sleep peacefully without worrying about

maintaining complicated structures in the strings.

We are once again going for a very strong definition of security for our

new primitive similar to Block Ciphers and Symmetric Encryption.

Page 10: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 11: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 12: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 13: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 14: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 15: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 16: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 17: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 18: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one

CR-Secure hash functions So what might a CR-secure hash function look like?

All we know is that there are these block ciphers (AES,DES) that are pseudorandom permutations..

Let us try the following keyless hash function.

Page 19: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one

• Let us try this:

CR-Secure hash functions

Page 20: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one

SHA-1: What does it look like?

SHF-1: {0,1}128 x D {0,1}160

SHA-1: SHF-1K,

where (K = 0x5A827999|| 0x6ED9EBA1|| 0x8F1BBCDC|| 0xCA62C1D6)

SHF-1 and SHA-1 uses a compression function shf1 along with

MD transform (Merkle-Damgard).

Page 21: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 22: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one

SHA-1: shf-1

shf-1K: {0,1}512 x {0,1}160 {0,1}160

Page 23: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one

Merkle Damgard (MD) Transform

Page 24: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 25: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 26: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 27: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 28: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 29: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one

How does Ah work?

Page 30: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one

Birthday Attack

Attack on the compression function

Page 31: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 32: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 33: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 34: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 35: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 36: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 37: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 38: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 39: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 40: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 41: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 42: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 43: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one

Other Attacks

Attacks that may take advantage of the specific construction of the

compression function

Page 44: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 45: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 46: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one
Page 47: Hash Functions - ERNETsiy107537/sil765/PDF/2-Hash-Functions.pdf · we may avoid such structures in the strings on which the hash function is applied. On the other hand, if no one

End

Thanks to Prof. Mihir Bellare for sharing his slides. Most of the slides

in this lecture have been borrowed from him.