Lecture 9: Hash House Harriers Background just got here last week

Slides:



Advertisements
Similar presentations
David Evans CS588: Security and Privacy University of Virginia Computer Science Lecture 8: Hashing Note: only 3 people.
Advertisements

Digital Signatures Good properties of hand-written signatures: 1. Signature is authentic. 2. Signature is unforgeable. 3. Signature is not reusable (it.
Digital Signatures and Hash Functions. Digital Signatures.
David Evans CS588: Security and Privacy University of Virginia Computer Science Lecture 11: Birthday Paradoxes.
EEC 693/793 Special Topics in Electrical Engineering Secure and Dependable Computing Lecture 6 Wenbing Zhao Department of Electrical and Computer Engineering.
Announcements: 1. HW6 due now 2. HW7 posted Questions? This week: Discrete Logs, Diffie-Hellman, ElGamal Discrete Logs, Diffie-Hellman, ElGamal Hash Functions.
Secure Hashing and DSS Sultan Almuhammadi ICS 454 Principles of Cryptography.
ITIS 3200: Introduction to Information Security and Privacy Dr. Weichao Wang.
Csci5233 Computer Security & Integrity 1 Cryptography: Basics (2)
Fall 2010/Lecture 311 CS 426 (Fall 2010) Public Key Encryption and Digital Signatures.
CS5204 – Fall Cryptographic Security Presenter: Hamid Al-Hamadi October 13, 2009.
Lecture 15 Lecture’s outline Public algorithms (usually) that are each other’s inverse.
Week 5 - Monday.  What did we talk about last time?  Cryptographic hash functions.
Digital Signatures Good properties of hand-written signatures: 1. Signature is authentic. 2. Signature is unforgeable. 3. Signature is not reusable (it.
Lecture 19 Page 1 CS 111 Online Symmetric Cryptosystems C = E(K,P) P = D(K,C) E() and D() are not necessarily the same operations.
David Evans CS150: Computer Science University of Virginia Computer Science Class 31: Cookie Monsters and Semi-Secure.
David Evans CS200: Computer Science University of Virginia Computer Science Class 36: Public-Key Cryptography If you want.
CS526: Information Security Prof. Sam Wagstaff September 16, 2003 Cryptography Basics.
4 th lecture.  Message to be encrypted: HELLO  Key: XMCKL H E L L O message 7 (H) 4 (E) 11 (L) 11 (L) 14 (O) message + 23 (X) 12 (M) 2 (C) 10 (K) 11.
CSCI 172/283 Fall 2010 Hash Functions, HMACs, and Digital Signatures.
Cryptographic Hash Functions and Protocol Analysis
Cryptography 1 Crypto Cryptography 2 Crypto  Cryptology  The art and science of making and breaking “secret codes”  Cryptography  making “secret.
15-499Page :Algorithms and Applications Cryptography I – Introduction – Terminology – Some primitives – Some protocols.
Hashes Lesson Introduction ●The birthday paradox and length of hash ●Secure hash function ●HMAC.
Cryptographic Security Aveek Chakraborty CS5204 – Operating Systems1.
David Evans CS588: Security and Privacy University of Virginia Computer Science Lecture 10: Certificates and Hashes.
@Yuan Xue 285: Network Security CS 285 Network Security Hash Algorithm Yuan Xue Fall 2012.
Network security Cryptographic Principles
Lecture 4: Metacircles Eval Apply David Evans
Basics of Cryptography
Attacks on Public Key Encryption Algorithms
Lecture 6: Lambda Calculus
Public-Key Cryptography and Message Authentication
DTTF/NB479: Dszquphsbqiz Day 26
Public Key Encryption and Digital Signatures
Network Security.
Public-key Cryptography
Lambda Calculus Revisited
Basic Network Encryption
Introduction to security goals and usage of cryptographic algorithms
A way to detect a collision…
Presented by: Dr. Munam Ali Shah
Topic 14: Random Oracle Model, Hashing Applications
ICS 454 Principles of Cryptography
Asymmetric Cryptography
Public Key Cryptography Diffie-Hellman, Discrete Log, RSA
Cryptography: Basics (2)
Lecture 14: Blocking and Catching Photons Background
刘振 上海交通大学 计算机科学与工程系 电信群楼3-509
ICS 454 Principles of Cryptography
Lecture 8: Security of RSA THE MAGIC WORDS ARE SQUEAMISH OSSIFRAGE.
Encryption INST 346, Section 0201 April 3, 2018.
CS2911 Week 9, Class 1 Today Discussion on RSA Video Eavesdropping
Lecture 10: The Return of Paco Background just got here last week
Key Management Network Systems Security
DTTF/NB479: Dszquphsbqiz Day 27
Lecture 10: Using Object-Oriented Languages
Lecture 19: Proof-Carrying Code Background just got here last week
Lecture 10: Fixed Points ad Infinitum M.C. Escher, Moebius Ants
Lecture 4.1: Hash Functions, and Message Authentication Codes
Chapter 3 - Public-Key Cryptography & Authentication
Basic Network Encryption
Lecture 5: DES Use and Analysis Background just got here last week
Lecture 15: Crazy Eddie and the Fixed Points Background
Hashing Hash are the auxiliary values that are used in cryptography.
Public Key Encryption Systems
Class 36: Public-Key Cryptography
刘振 上海交通大学 计算机科学与工程系 电信群楼3-509
CRYPTOGRAPHY & NETWORK SECURITY
Review of Cryptography: Symmetric and Asymmetric Crypto Advanced Network Security Peter Reiher August, 2014.
Presentation transcript:

David Evans http://www.cs.virginia.edu/~evans Lecture 9: Hash House Harriers Background just got here last week finished degree at MIT week before Philosophy of advising students don’t come to grad school to implement someone else’s idea can get paid more to do that in industry learn to be a researcher important part of that is deciding what problems and ideas are worth spending time on grad students should have their own project looking for students who can come up with their own ideas for research will take good students interested in things I’m interested in – systems, programming languages & compilers, security rest of talk – give you a flavor of the kinds of things I am interested in meant to give you ideas (hopefully even inspiration!) but not meant to suggest what you should work on CS551: Security and Privacy University of Virginia Computer Science David Evans http://www.cs.virginia.edu/~evans

University of Virginia CS 551 Menu “Quiz” Results Hashing 21 November 2018 University of Virginia CS 551

University of Virginia CS 551 Quiz Results Six people got everything right Most common mistake: e * d  1 mod n should be: e * d  (mod (p – 1)(q – 1)) Why is e * d  1 mod n a bad guess? Little correlation between how well you said you understood RSA and correctness of answers 21 November 2018 University of Virginia CS 551

Selected Quiz Comments “Wondering if we just have to understand the algorithms or do we have to memorize them.” “On both of the problem sets, I’ve felt like its the first time I’ve seen the material applied this way.” “I feel like we’ve hit the surface of many topics, but haven’t spent enough time to get really in depth in many of the topics.” 21 November 2018 University of Virginia CS 551

Selected Quiz Comments “Need TA’s” Siddarth Dalai Office hours on Tuesdays 3:30-4:30 and Fridays 2:00-3:00 in the CS department library or 113g. My office hours: Mondays 1:30-2:30, Wednesdays after class. 21 November 2018 University of Virginia CS 551

University of Virginia CS 551 Using RSA to Encrypt Use 1024-bit modulus (RSA recommends at least 768 bits) Encrypt 1M file Why does no one use RSA like this? About 100-1000 times slower than DES Can speed up encryption by choosing e that is an easy number to multiply by (e.g., 3 or 216 + 1) 21 November 2018 University of Virginia CS 551

University of Virginia CS 551 Alternatives Use RSA to establish a shared secret key for symmetric cipher (DES, RC6, ...) Lose external authentication, non-repudiation properties of public-key cryptosystems Sign (encrypt with private key) a hash of the message A short block that is associated with the message 21 November 2018 University of Virginia CS 551

Hashing H (char s[]) = (s[0] – ‘a’) mod 10 “dog” “neanderthal” “horse” 1 2 3 4 5 6 7 8 9 “dog” “neanderthal” “horse” H (char s[]) = (s[0] – ‘a’) mod 10 21 November 2018 University of Virginia CS 551

Regular Hash Functions Many-to-one: maps a large number of values to a small number of buckets Even distribution: for typical data sets, buckets are similarly full Efficient: H(x) is easy to compute. How well does H (char s[]) = (s[0] – ‘a’) mod 10 satisfy these properties? 21 November 2018 University of Virginia CS 551

Cryptographic Hash Functions One-way: for given h, it is hard to find x such that H(x) = h. Collision resistance: Weak collision resistance: given x, it is hard to find y  x such that H(y) = H(x). Strong collision resistance: it is hard to find any x and y  x such that H(y) = H(x). 21 November 2018 University of Virginia CS 551

University of Virginia CS 551 Using Hashes Alice wants to send Bob and “I owe you” message. Bob should be able to show the message to a judge to compel Alice to pay up. Bob should not be able to make his own “I owe you” from Alice, or change the contents of the one she sent him. 21 November 2018 University of Virginia CS 551

IOU Protocol (Attempt 1) H(M) Bob Alice M H(M) Hmmm...Bob can just make up M and H(M)! Judge 21 November 2018 University of Virginia CS 551

IOU Protocol (Attempt 2) EKA[H(M)] Bob Alice secret key KA M EKA[H(M)] Can Bob cheat? Use Diffie-Hellman to establish shared secret KA Can Alice cheat? Yes, send Bob: M, junk. Judge will think Bob cheated! Judge knows KA 21 November 2018 University of Virginia CS 551

IOU Protocol (Attempt 3) EKRA[H(M)] Bob Alice knows KUA {KUA, KRA} M EKRA[H(M)] Bob can verify H(M) by decrypting, but cannot forge M, EKRA[H(M)] pair without knowing KRA. Judge knows KUA 21 November 2018 University of Virginia CS 551

Weak Collision Resistance Suppose we use: H (char s[]) = (s[0] – ‘a’) mod 10 Alice sends Bob: “I, Alice, owe Bob $2.”, EKRA[H (M)] Bob sends Judge: “I, Alice, owe Bob $2000000000000000.”, EKRA[H (M)] Judge validates EKUA [ EKRA[H (M)]] = H(“I, Alice, owe Bob $2000000000000000.”) and makes Alice pay. 21 November 2018 University of Virginia CS 551

Weak Collision Resistance Given x, it should be hard to find y  x such that H(y) = H(x). Similar to a block cipher except no need for secret key: Changing any bit of x should change most of H(x). The mapping between x and H(x) should be confusing (complex and non-linear). 21 November 2018 University of Virginia CS 551

University of Virginia CS 551 A Better Hash Function? H(x) = DES (x, 0) Weak collision resistance? Given x, it should be hard to find y  x such that H(y) = H(x). Yes – DES is one-to-one. (These is no such y.) A good hash function? No, its output is as big as the message! 21 November 2018 University of Virginia CS 551

University of Virginia CS 551 What we need: Produce small number of bits (say 64) that depend on the whole message in a confusing, non-linear way. Have we seen anything like this? 21 November 2018 University of Virginia CS 551

University of Virginia CS 551 Cipher Block Chaining Pn P1 P2  IV   ... DES DES DES K K K Cn C1 C2 Use last ciphertext block as hash. Depends on all plaintext blocks. 21 November 2018 University of Virginia CS 551

Actual Hashing Algorithms Based on cipher block chaining No need for secret key or IV (just use 0) Don’t use DES Performance Better to use bigger blocks MD5 [Rivest92] – 512 bit blocks, produces 128-bit hash SHA [NIST95] – 512 bit blocks, 160-bit hash 21 November 2018 University of Virginia CS 551

University of Virginia CS 551 Why big hashes? 3DES is (probably) secure with 64-bit blocks, why do secure hash functions need at least 128 bit digests? 64 bits is fine for weak collision resistance, but we need strong collision resistance too. 21 November 2018 University of Virginia CS 551

Strong Collision Resistance It is hard to find any x and y  x such that H(y) = H(x). Difference from weak: Attacker gets to choose both x and y, not just y. Scenario: Suppose Bob gets to write IOU message, send it to Alice, and she signs it. 21 November 2018 University of Virginia CS 551

University of Virginia CS 551 IOU Request Protocol x EKRA[H(x)] Bob Alice knows KUA {KUA, KRA} y EKRA[H(x)] Bob picks x and y such that H(x) = H(y). Judge knows KUA 21 November 2018 University of Virginia CS 551

University of Virginia CS 551 Finding x and y Bob generates 210 different agreeable (to Alice) xi messages: I, { Alice | Alice Hacker | Alice P. Hacker | Ms. A. Hacker }, { owe | agree to pay } Bob { the sum of | the amount of } { $2 | $2.00 | 2 dollars | two dollars } { by | before } { January 1st | 1 Jan | 1/1 | 1-1 } { 2001 | 2001 AD}. 21 November 2018 University of Virginia CS 551

University of Virginia CS 551 Finding x and y Bob generates 210 different agreeable (to Bob) yi messages: I, { Alice | Alice Hacker | Alice P. Hacker | Ms. A. Hacker }, { owe | agree to pay } Bob { the sum of | the amount of } { $2 quadrillion | $2000000000000000 | 2 quadrillion dollars | two quadrillion dollars } { by | before } { January 1st | 1 Jan | 1/1 | 1-1 } { 2001 | 2001 AD}. 21 November 2018 University of Virginia CS 551

Bob the Quadrillionaire!? For each message xi and yi, Bob computes hxi = H(xi) and hyi = H(yi). If hxi = hyj for some i and j, Bob sends Alice xi, gets EKRA[H(x)] back. Bob sends the judge yj and EKRA[H(x)]. 21 November 2018 University of Virginia CS 551

University of Virginia CS 551 Chances of Success Hash function generate 64-bit digest (n = 264) Hash function is good (randomly distributed and diffuse) Chance a randomly chosen message maps to a given hash value: 1 in n = 2-64 By hashing m good messages, chance that a randomly chosen message maps to one of the m different hash values: m * 2-64 By hashing m good messages and m bad messages: m * m * 2-64 21 November 2018 University of Virginia CS 551

Is Bob a Quadrillionaire? m = 210 210 * 210 * 2-64 = 2-44 (doesn’t look good...) Try m = 232 232 * 232 * 2-64 = 20 = 1 (yippee!) Flaw: some of the messages might hash to the same value, might need more than 232 to find match. 21 November 2018 University of Virginia CS 551

Dealing with duplicates For a particular yi: p(H(yi) = H(x)) = 1/n p(H(yi)  H(x)) = 1 - 1/n Probability that none of m different yi’s match = p(H(yi)  H(x))m = (1 - 1/n)m Probability that there is at least one match = 1 - (1 - 1/n)m 21 November 2018 University of Virginia CS 551

University of Virginia CS 551 Binomial Theorem (1 – a)k = 1 – ka + (k(k – 1) / 2!) a2 – (k(k – 1)(k – 2) / 3!) a3 ... For small a: (1 – a)k  1 – ka Probability that there is at least one match = 1 - (1 - 1/n)m  1 – (1 – m/n) = m/n For m = 232 and n = 264: 232/264  2-32 21 November 2018 University of Virginia CS 551

University of Virginia CS 551 Birthday “Paradox” What is the probability that a group of k people have 2 with the same birthday? 21 November 2018 University of Virginia CS 551

University of Virginia CS 551 Birthday Paradox Ways to assign k different birthdays without duplicates: N = 365 * 364 * ... * (365 – k + 1) = 365! / (365 – k)! Ways to assign k different birthdays with possible duplicates: D = 365 * 365 * ... * 365 = 365k 21 November 2018 University of Virginia CS 551

University of Virginia CS 551 Birthday “Paradox” Assuming real birthdays assigned randomly: N/D = probability there are no duplicates 1 - N/D = probability there is a duplicates = 1 – 365! / ((365 – k!)(365)k ) For k = 48: > 95% 21 November 2018 University of Virginia CS 551

Generalizing Birthdays (n – k)!nk P(n, k) = 1 – Given k random selections from n possible values, P(n, k) gives the probability that there is at least 1 duplicate. P(n, k) > 1 – e-k*(k-1)/2n Derived using (1 – x)  e-x. (see book) 21 November 2018 University of Virginia CS 551

Applying Birthdays P(n, k) > 1 – e-k*(k-1)/2n For n = 365, k = 48: P(365, 48) > 1 – e-48*(47)/2*365 P(365, 48) > .954 For n = 264, k = 232: P (264, 232) > .39 For n = 264, k = 233: P (264, 233) > .86 For n = 264, k = 234: P (264, 234) > .9996 For n = 2128, k = 240: P (2128, 240) > 10-15 21 November 2018 University of Virginia CS 551

University of Virginia CS 551 Conclusion If you’re Alice, don’t sign a hash for an IOU from Bob, unless the hash is at least 128 bits. 21 November 2018 University of Virginia CS 551

Charge $$$$ Full Project Proposals due Oct 4 Next time: Guest lecture Paco Hope, chainmailinc.com chainmailinc.com $$$$ KUA CA = EKRchainmail[Time1, IDA, KUA] Alice 21 November 2018 University of Virginia CS 551