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
When was the MDx family used and who proposed it?
Proposed by Ron Rivest and widely used in the 90s
What are the deployed family members in the MDx family?
MD2, MD4 and MD5
What is size of the output in the MDx family and comment on its security
128-bit output
too small bits to be secure, should be 256
Which family members in the MDx family are broken?
ALL –> real collisions have been found
What does SHA stand for?
Secure hash algorithm
What is SHA based on?
MDx family design but has a more complex design and larger output of 160 bits
Has SHA-0 been broken?
yes
Has SHA-1 been broken?
yes
Why was the SHA-2 family developed?
in response to (real and theoretical) attacks onMD5 and SHA-1
What standard is SHA-2 in?
FIPS PUB 180-4 (Aug. 2015).
What is the hash size, block size and security match for SHA-224? Comment on if it is okay to use today
Hash size: 224 bits
Block size: 512 bits
Security match: 2 key 3DES
Hash size is too small so DON’T use
What is the hash size, block size and security match for SHA-512/224? Comment on if it is okay to use today
Hash size: 224 bits
Block size: 1024 bits
Security match: 2 key 3DES
Hash size is too small so DON’T use
What is the hash size, block size and security match for SHA-256? Comment on if it is okay to use today
Hash size: 256 bits
Block size: 512 bits
Security match: AES-128
Okay to use
What is the hash size, block size and security match for SHA-512/256? Comment on if it is okay to use today
Hash size: 256 bits
Block size: 1024 bits
Security match: AES-128
Okay to use
What is the hash size, block size and security match for SHA-384? Comment on if it is okay to use today
Hash size: 384 bits
Block size: 1024 bits
Security match: AES-192
Okay to use
What is the hash size, block size and security match for SHA-512? Comment on if it is okay to use today
Hash size: 512 bits
Block size: 1024 bits
Security match: AES-256
Okay to use