Week 4 Part 1 Flashcards
What part of the CIA triad do encryption, hash functions AND MACS ensure?
- Confidentiality: Maintained through Encryption.
- Integrity: Ensured by Hash Functions.
- Authenticity: maintained by MACS
How do hash functions ensure integrity?
Alice can verify the integrity of Bob’s message by comparing her computed hash of the message with the hash provided by Bob. If they match, the message has not been altered.
Explain a one-way function and a collision-resistant function and give examples.
- One- way function (OWF)
A function (f) is one-way if:
- Easy to compute
- Given x, easy to compute y= f(x) i.e.f an input is given you can find the output
- Hard to invert:
- Given y, it is hard to find x s.t. y= f(x)
example: Product of large primes, e.g. 2048-bit, is a OWF, factorisation
- Collision- Resistant Function (CRF)
A function (f) is CRF if:
- Collision Difficulty:
- It is computationally hard to find any two distinct inputs x1 and x2 that produce the same output, where f(x1)=f(x2).
example: The identity function f (x) = x is a CRF.
What are the requirements of a hash function?
- Preimage-Resistance (One-Wayness):
- It’s computationally infeasible to reverse-engineer the original input from its hash output.
- Second Preimage Resistance (Weak-Collision Resistance):
- Given an input, it’s difficult to find another input with the same hash output.
- Collision-Resistance (Strong Collision-Resistance):
- It is hard to find two distinct values x′,x such that H(x′) = H(x)
- the adversary chooses the collision
- find any two values that collides
- if you satisfy this, you definitely satisfy weak-collision resistance
- It is hard to find two distinct values x′,x such that H(x′) = H(x)
How many times do we need to hash a function to find a collision?
f the output of H is n-bit long, we can always find collisions after hashing at most 2^(n) + 1 distinct messages
What are some applications of hash functions?
- Instead of storing passwords in the clear, one stores H(password)
- Ensuring Software Integrity (that it has not been changed or tampered with
- Timestamping (proving you have discovered a secret earlier without disclosing it)
- Many cryptographic applications:
- Message authentication
- One-time passwords
- Digital signatures
- Commitment schemes
- Proof of work (Bitcoin)
What are some existing hash function and their bits and max message size? and are they secure?
- MD5 (128-bit) (max message size 2^64 bits) (Not secure, Broken!)
- SHA-1 (160-bit) (max message size 2^64 bits)(Not secure, Broken!)
- SHA - 2 (224, 256, 384. 512) (Max message size is 2^64, 2^64, 2^128, and 2^128 bits, respectively)
- SHA-3 (512 bit) (unlimited message size)
What can we use to reduce the complexity of finding hash collisions? what would the complexity reduce to?
The Birthday Paradox can be exploited to reduce the complexity of finding hash collisions
- If the fingerprint is n-bit long, brute force attack requires O(2^n) hashes whereas a birthday attack requires O(2^ n/2)
How can you perform a birthday attack on a hash function?
Birthday Attack on Hash Functions
- Choose 2 ^n/2 random messages m1,…..,m 2^n/2
- Obtain the fingerprint of all of those messages
- If there is a collision, stop, otherwise go to Step 1
Are hash functions deterministic?
yes same input produces the same output
Briefly explain the Merkle Damgard construction.
The Merkle-Damgård construction is a framework for building hash functions that process a message in fixed-size blocks, applying a compression function sequentially to produce a final hash value.
What are some attacks on hash functions and how to perform them?
- Dictionary attack
- You make a dictionary, you hash many words from the dictionary and then you search in the password column and then compare
- need to store a lot of data
- Compute and store hashes of a list of popular password choices and do a table lookup
- Matches if any means all such users used the password in question
- Rainbow Table Attack
- Rainbow tables trade space for time in attacking hashed passwords
- Involve computing large chains of password hashes
- Hash and reduce approach
What is the difference between a dictionary attack and rainbow table attack?
A dictionary attack relies on a list of common words and phrases to guess a password, while a rainbow table attack uses precomputed tables of password-hash pairs to quickly find a match. Both methods aim to discover passwords, but the rainbow table attack is more efficient when dealing with hashed passwords, while a dictionary attack is more general and may work against simpler, common passwords.
How do we protect against dictionary and rainbow table attacks?
Add a salt to the password before hashing, store salt andH(password||salt)
When using hash functions for integrity of software release (download) which property is the most important?
Weak-collision resistance