Download presentation
Presentation is loading. Please wait.
1
Cryptographic hash functions
2
Definition of hash function
π»β {β 1 ,β¦, β π } β π : 0,1 π β 0,1 β(π) Compression : β π <π πΊππ 1 π picks an index between 1 and m.
3
Collision resistance i πβπππ({ 1} π ) π₯,π₯β² π€πππ if β π π₯ = β π (π₯β²)
4
Second-collision resistant
πβπππ({ 1} π ) π₯ β π
0,1 π π,π₯ π₯β² π€πππ if β π π₯ = β π (π₯β²)
5
Preimage resistance πβπππ({ 1} π ) y β π
0,1 β(π ) π,π¦ π₯ π€πππ if
β π π₯ =π¦
6
Comparison between different security
πβπππ({ 1} π ) πβπππ({ 1} π ) π₯ β π
0,1 π πβπππ({ 1} π ) y β π
0,1 β(π ) π,π₯ π,π¦ π₯,π₯β² π₯β² π₯ π€πππ if β π π₯ = β π (π₯β²) π€πππ if β π π₯ = β π (π₯β²) π€πππ if β π π₯ =π¦ π‘πππππ‘βππππππ πππ πππ ππ π‘ππππ ππππππππ πππ ππ π‘πππ‘ ππππππ πππ πππ ππ π‘πππ‘
7
Birthday attack What is the probability that in a class of 23 people there are at least two people with the same birthday. Answer: more than 50% chance General question: Suppose you sample m values from n values, what is the probability that there exists at least two values that are the same. Answer: if π= π then probability is about one-half
8
Proof of the birthday attack
If you store π output with a given input the probability that a new input gets sent to a previously visited output is 1/ π The probability that π elements all get mapped to fresh output is 1β 1 π π β₯1/π
9
Mac using hash functions
π π» π πππ π
10
HMAC Global constants π£ 1 , π£ 2 Gen Auth(m) π βπΊππ 1 π π β π
0,1 π
π βπΊππ 1 π π β π
0,1 π Auth(m) π€ 1 β(πβ π£ 2 ,π) π€ 2 β π» π π€ 1 π€ 3 β(πβ π£ 1 , π€ 1 ) π‘βπ»( π€ 3 )
11
Random oracle heuristic
Assume that a hash function acts as a random function Allows us to prove security for efficient schemes Unsound but Only for contrived example Never broken for practical schemes
12
Applications of hash functions
Virus fingerprinting Deduplication Password hashing File changes/integrity
13
Virus fingerprinting Hash the virus using the hash function
To lookup a virus, simply look at the output of the function and see if it maps to a known virus False positives imply collision
14
Deduplication Avoid storing the same thing in memory many times
Uses hash function to index values so that we donβt need to copy the same thing many times.
15
File changes / integrity
To keep track of changes, we keep a list of hash for every function The output of the hash function can be much shorter than the size of the files
16
Proper way to hash passwords
NaΓ―ve way to hash passwords ββπ»(ππ€π) Same password hashed to same value Correct way to hash a password π β π
0,1 π ββπ» π,ππ€π (π,β)
17
Bad way to hash passwords (xkcd)
18
Hash tree Goal Client has constant overhead
Server holds clientβs database π₯ 1 ,β¦, π₯ π Client requests π₯ π Server sends π₯β² π How can client verify that π₯β² π = π₯ π with only logarithmic overhead
19
Hash tree πΏππ π π = π»ππ β(πΉππ π π ) Non-leaf node
πΏππ π π = π»ππ β(πΉππ π π ) Non-leaf node Hash(Hash(node.left) || Hash(node.right)) Client only need to store the root To prove that a given file is correct, the server only needs to send the client hashes of nodes that follow the path from the given leaf to the root node.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.