P2L8: Hashes Flashcards

1
Q

What are characteristics of a Hash Function?

A
  • One-Way Property: Computationally infeasible for you to get the same value given two different inputs
  • Can make a hash of data regardless of size
  • Fixed length output: 128 - 512 bits
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the pigeonhole principle?

A

If the number of pigeons (N) exceeds the number of holes (M) then one hole must have more than one pigeon

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the birthday paradox?

A
  • How many people do you need to have in a room for two of them to have a 50% chance of having the same birthday?
  • Using the pigeonhole principle we can conclude that if there are 365 unique birthdays we’d need 366 people for a 100% chance
  • 1 - (k)_n / (k^n) if k = 365 then n = 19 (the square root of k)
    • Which is actually just n (n - 1) / (2^k) so it’s just the square root of k
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

In hashing, since there can be more data but it always hashes to a fixed hash output there will always be more pigeonholes than pigeons? (T/F)

A

False, there will always be more pigeons than pigeonholes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The hash function should be mathematically impossible to get duplicate hashes with different inputs (T/F)

A

False. It should just be computationally infeasible

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What should you do to ensure a low likelihood of a collision?

A

The longer the length the less likely there will be a collision

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What length does a hash value need to be to be considered secure nowadays?

A

At least 128 bits

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

If the length of the hash is 128 bits then how many messages does an attacker need to search in order to find two that share the same hash?

A
  • Formula = 2^(L/2) where L is the length of the hash so…

* 2^(128/2) = 2^64

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Who invented the SHA algorithms?

A

What is the hash length of the SHA-1 algorithm?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the hash length of the SHA2 algorithm?

A

256, 384 or 512 bit hashes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Why can’t SHA-1 be used for Message Authentication (MAC)?

A

Because it doesn’t rely on a secret

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is HMAC?

A
  • It is a SHA-1 algorithm with a secret key built into it
  • Chosen as the mandatory-to-implement MAC for IP security
  • Used in TLS network protocol
How well did you know this?
1
Not at all
2
3
4
5
Perfectly