Lecture 11: Hash functions and MACs Flashcards
What are MACs built from?
block ciphers
What type of MAC is widely used in TLS?
HMAC
What mode is widely used in TLS?
Authentication encryption mode GCM
What are hash functions typical building blocks in cryptograph for?
MACs and digital signatures
What does MAC stand for?
Message authentication code
Define a hash function
A hash function H is a PUBLIC function s.t.:
1) H is simple and fast to compute
2) H takes as input a message of ARBITRARY length and outputs a message digest H(m) of FIXED length
What are the three security properties of hash functions?
1) collision resistant
2) second-preimage resistant
3) preimage resistant (one-way)
Define collision resistant
It should be infeasible to find any 2 different values x1, x2 s.t. H(x1) = H(x2)
- -> two different inputs will never give the same output
- -> many possibilities reduced
Define second-preimage resistant. Why is it stronger than collision resistant property?
Given a value x1, it should be infeasible to find a different value x2 s.t. H(x1) = H(x2)
Stronger as put restriction on 1 input
Define preimage resistant (one-way)
Given a value y (output), it should be infeasible to find any input x such that H(x) = y
If an attacker can break second-preimage resistance, what else can they break? Why?
break collision resistance as second preimage resistance is stronger than collision resistant
Comment on the strength of collision resistant, second-preimage resistant and preimage-resistant (one-way).
From least strong to strongest:
1) collision resistant
2) second-preimage resistant
3) preimage resistant (one-way)
Explain the birthday paradox
[need to review YouTube video]
Let a group of 23 randomly chosen people, the probability that at least 2 have the same birthday is over 0.5.
If choosing around √|S| from a set S, then probability of getting 2 values the same is around 0.5
(pigeonhole principle –> if n items are put into m containers, with n > m, then at least one container must contain more than one item)
In terms of the birthday paradox, how many trials are enough to find a collision with probability around 0.5 when a hash function with output size of k bits is used?
Let H be seen as a random function.
Then √(2^k) = 2^(k/2) trials are enough to find a collision with probability around 0.5
How many trials are considered infeasible today for a hash function with output size of k bits?
What is the size of the output that hash functions need to satisfy collision resistance?
output of at least 256 bit to
From block ciphers, how can arbitrary-sized data can be processed?
1) having a function processing fixed-sized data
2) using it repeatedly
What does an iterated hash function do?
splits the input blocks of fixed size and operates on each block sequentially using the same function with fixed-sized inputs.
I.t.o iterated hash functions, what does Merkle-Damgård do?
using a compression function h taking fixed-sized inputs and applied to multiple blocks of the message
compression as reduces output length w.r.t. input
Outline the compression function h and give the diagram
h takes 2 n-bit input strings x1 and x2 and produces an n-bit output string y
diagram: slide 10, set 11
What type of function is Merkle-Damgård?
an iterated hash fuction
Explain Merkle-Damgård construction and give the diagram
1) Break message m into n-bit blocks m1 || m2 || … ||ml
2) Add padding and an encoding of the length of m –> this process may or may not add one block (depends if needed)
3) Input each block into compression function h along with chained output –> use IV to get started
Diagram: slide 11, set 11
What security does using Merkle-Damgård construction provide?
if compression function h is collision-resistant then hash function H is collision-resistant
What are the security weaknesses of Merkle-Damgård construction?
1) length extension attacks: once there is one collision, easy to find more
2) second preimage attacks not as hard as they should be
3) collisions for multiple messages: found without much more difficulty than collisions for 2 messages
What are examples of where Merkle-Damgård construction is used?
MD5, SHA-1, SHA-2 family