13 computer security hashing
play

13 - Computer Security Hashing 1 Solution : hash - PowerPoint PPT Presentation

13 - Computer Security Hashing 1 Solution : hash function 0 1 n - h x 0 1 - h x is the hash/digest of x Context Goal - Represent large/sensitive message by a smaller one - Numerous


  1. ΥΣ13 - Computer Security Hashing Κώστας Χατζηκοκολάκης 1

  2. Solution : hash function 0 1 n - h x 0 1 - h x is the hash/digest of x Context • Goal - Represent large/sensitive message by a smaller one - Numerous applications 2

  3. Context • Goal - Represent large/sensitive message by a smaller one - Numerous applications • Solution : hash function - h ( x ) : { 0 , 1 } ∗ → { 0 , 1 } n - h ( x ) is the hash/digest of x 2

  4. - h x x : hard Even to fjnd a single bit of x ! No collisions - Do x x exist such that h x h x ? YES - But the should be hard to fjnd! Properties • One-way - x → h ( x ) : easy 3

  5. YES - But the should be hard to fjnd! Properties • One-way - x → h ( x ) : easy - h ( x ) → x : hard · Even to fjnd a single bit of x ! • No collisions - Do x ̸ = x ′ exist such that h ( x ) = h ( x ′ ) ? 3

  6. Properties • One-way - x → h ( x ) : easy - h ( x ) → x : hard · Even to fjnd a single bit of x ! • No collisions - Do x ̸ = x ′ exist such that h ( x ) = h ( x ′ ) ? YES - But the should be hard to fjnd! 3

  7. Just 23! 364 363 365 22 pb 1 0 507 365 365 365 Approximation x - e 1 x ( x 0) m 2 - pb 1 e 2 365 Collision-resistance Birthday paradox • How many people do we need so that any 2 have the same birthday with pb 50%? 4

  8. Approximation x - e 1 x ( x 0) m 2 - pb 1 e 2 365 Collision-resistance Birthday paradox • How many people do we need so that any 2 have the same birthday with pb 50%? • Just 23! • pb = 1 − 364 365 · 363 365 · . . . · 365 − 22 ≈ 0 . 507 365 4

  9. Collision-resistance Birthday paradox • How many people do we need so that any 2 have the same birthday with pb 50%? • Just 23! • pb = 1 − 364 365 · 363 365 · . . . · 365 − 22 ≈ 0 . 507 365 • Approximation - e − x ≈ 1 − x ( x ≈ 0) m 2 - pb ≈ 1 − e − 2 · 365 4

  10. 50 bit hash 10 15 total values (huge) - T - m : number of messages we hash - How many for a 50% collision? - 40M (milliseconds to generate!) Collision-resistance Birthday paradox • m people, T possible values each - pb ≈ 1 − e − m 2 / 2 T - m ≈ √ − 2 T ln( 1 − pb ) 5

  11. - 40M (milliseconds to generate!) Collision-resistance Birthday paradox • m people, T possible values each - pb ≈ 1 − e − m 2 / 2 T - m ≈ √ − 2 T ln( 1 − pb ) • 50 bit hash - T ≈ 10 15 total values (huge) - m : number of messages we hash - How many for a 50% collision? 5

  12. Collision-resistance Birthday paradox • m people, T possible values each - pb ≈ 1 − e − m 2 / 2 T - m ≈ √ − 2 T ln( 1 − pb ) • 50 bit hash - T ≈ 10 15 total values (huge) - m : number of messages we hash - How many for a 50% collision? - 40M (milliseconds to generate!) 5

  13. - Example: password authentication Protect against data breach Only need to test whether input is correct! Solution - Store h x - Better: generate random r (salt), store r h x r why? Which properties of h does this rely on? - One-wayness: should not learn the password - Collision-resistance: should not login with difgerent password One-way encryption • Goal - Store x in an encrypted form - We don’t need to decrypt, only to test equality of encrypted messages 6

  14. Solution - Store h x - Better: generate random r (salt), store r h x r why? Which properties of h does this rely on? - One-wayness: should not learn the password - Collision-resistance: should not login with difgerent password One-way encryption • Goal - Store x in an encrypted form - We don’t need to decrypt, only to test equality of encrypted messages - Example: password authentication · Protect against data breach · Only need to test whether input is correct! 6

  15. - Better: generate random r (salt), store r h x r why? Which properties of h does this rely on? - One-wayness: should not learn the password - Collision-resistance: should not login with difgerent password One-way encryption • Goal - Store x in an encrypted form - We don’t need to decrypt, only to test equality of encrypted messages - Example: password authentication · Protect against data breach · Only need to test whether input is correct! • Solution - Store h ( x ) 6

  16. Which properties of h does this rely on? - One-wayness: should not learn the password - Collision-resistance: should not login with difgerent password One-way encryption • Goal - Store x in an encrypted form - We don’t need to decrypt, only to test equality of encrypted messages - Example: password authentication · Protect against data breach · Only need to test whether input is correct! • Solution - Store h ( x ) - Better: generate random r (salt), store r , h ( x , r ) why? 6

  17. - One-wayness: should not learn the password - Collision-resistance: should not login with difgerent password One-way encryption • Goal - Store x in an encrypted form - We don’t need to decrypt, only to test equality of encrypted messages - Example: password authentication · Protect against data breach · Only need to test whether input is correct! • Solution - Store h ( x ) - Better: generate random r (salt), store r , h ( x , r ) why? • Which properties of h does this rely on? 6

  18. One-way encryption • Goal - Store x in an encrypted form - We don’t need to decrypt, only to test equality of encrypted messages - Example: password authentication · Protect against data breach · Only need to test whether input is correct! • Solution - Store h ( x ) - Better: generate random r (salt), store r , h ( x , r ) why? • Which properties of h does this rely on? - One-wayness: should not learn the password - Collision-resistance: should not login with difgerent password 6

  19. Assume 365 outputs. How many x s to generate for 50% success pb? 253! huh? but we said 23… Difgerent problem: pb that someone has the same birthday as you! n 364 pb 1 365 (only 6% for n 23) One-way encryption Can we break it? • Preimage attack : fjnd x ′ such that h ( x ′ ) matches the given h ( x ) 7

  20. 253! huh? but we said 23… Difgerent problem: pb that someone has the same birthday as you! n 364 pb 1 365 (only 6% for n 23) One-way encryption Can we break it? • Preimage attack : fjnd x ′ such that h ( x ′ ) matches the given h ( x ) • Assume 365 outputs. How many x ′ s to generate for 50% success pb? 7

  21. Difgerent problem: pb that someone has the same birthday as you! n 364 pb 1 365 (only 6% for n 23) One-way encryption Can we break it? • Preimage attack : fjnd x ′ such that h ( x ′ ) matches the given h ( x ) • Assume 365 outputs. How many x ′ s to generate for 50% success pb? • 253! huh? but we said 23… 7

  22. One-way encryption Can we break it? • Preimage attack : fjnd x ′ such that h ( x ′ ) matches the given h ( x ) • Assume 365 outputs. How many x ′ s to generate for 50% success pb? • 253! huh? but we said 23… • Difgerent problem: pb that someone has the same birthday as you! n • pb = 1 − 364 365 (only 6% for n = 23) 7

  23. Can be used to show approval of x - Eg: x is a contract signed by Alice - But it is expensive for large x Solution: provide sign h x Alice Alice needs to know x to construct h x ! - Does this show approval of x ? Yes if collision-free - One-wayness can be useful if we want to reveal x in the future! Signatures • Assume: sign ( x , Alice ) is a message that can only be constructed by Alice - We will see how to do this using asymmetric encryption! 8

  24. - Does this show approval of x ? Yes if collision-free - One-wayness can be useful if we want to reveal x in the future! Signatures • Assume: sign ( x , Alice ) is a message that can only be constructed by Alice - We will see how to do this using asymmetric encryption! • Can be used to show approval of x - Eg: x is a contract signed by Alice - But it is expensive for large x • Solution: provide sign ( h ( x ) , Alice ) • Alice needs to know x to construct h ( x ) ! 8

  25. Yes if collision-free - One-wayness can be useful if we want to reveal x in the future! Signatures • Assume: sign ( x , Alice ) is a message that can only be constructed by Alice - We will see how to do this using asymmetric encryption! • Can be used to show approval of x - Eg: x is a contract signed by Alice - But it is expensive for large x • Solution: provide sign ( h ( x ) , Alice ) • Alice needs to know x to construct h ( x ) ! - Does this show approval of x ? 8

  26. - One-wayness can be useful if we want to reveal x in the future! Signatures • Assume: sign ( x , Alice ) is a message that can only be constructed by Alice - We will see how to do this using asymmetric encryption! • Can be used to show approval of x - Eg: x is a contract signed by Alice - But it is expensive for large x • Solution: provide sign ( h ( x ) , Alice ) • Alice needs to know x to construct h ( x ) ! - Does this show approval of x ? Yes if collision-free 8

  27. Signatures • Assume: sign ( x , Alice ) is a message that can only be constructed by Alice - We will see how to do this using asymmetric encryption! • Can be used to show approval of x - Eg: x is a contract signed by Alice - But it is expensive for large x • Solution: provide sign ( h ( x ) , Alice ) • Alice needs to know x to construct h ( x ) ! - Does this show approval of x ? Yes if collision-free - One-wayness can be useful if we want to reveal x in the future! 8

Recommend


More recommend