Hash Functions Flashcards
Lecture 7 (9 cards)
What are the properties for cryptographically secure Hash Functions?
- Preimage resistance i.e. one-way
- Second preimage resistance
- Collision resistance
What is preimage resistance?
Given a hash of a message, it must be infeasible to calculate the message prior to the hash.
What is second preimage resistance?
Given two different messages, it should be infeasible to have their hashed messages be exactly the same.
What is collision resistance?
Make it impossible to find any message pair such that their hashed messages are equal.
How do you make sure collisions are avoided in hash functions?
- Use a strong hash algorithm
- Increase the output length
- Use salted hashing
- Increase hashing space
What is a Birthday Attack?
The output of a hash must be long enough, else you will find a collision after approximately 2^(n/2) attempts. This then means that your bit length needs to be double the size of the desired security margin.
How does Merkle-Damgard work?
- Pads the input to ensure that the input is a multiple of the block size
- Initialise a hash state
- Divide the input into blocks
- Iterate the compression function for all message blocks
- Output final hash
How does the compression function work in-depth for SHA-256?
Compression function mixes 512 bit blocks of message into the current state to produce a new state.
It then expands the message into 64 32-bit words. Each round then performs permutation and mixing
What do all SHA functions have in common?
All SHA functions define constant values that represent H0.