1 Hash Functions. 2 A hash function h takes as input a message of arbitrary length and produces as output a message digest of fixed length. 010 0 00111.

Slides:



Advertisements
Similar presentations
ONE WAY FUNCTIONS SECURITY PROTOCOLS CLASS PRESENTATION.
Advertisements

ECE454/CS594 Computer and Network Security Dr. Jinyuan (Stella) Sun Dept. of Electrical Engineering and Computer Science University of Tennessee Fall 2011.
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.
MD Collision Sought Marian Ščerbák University of Pavol Jozef Šafárik Košice.
 Stream ciphers o Encrypt chars/bits one at a time o Assume XOR w the key, need long key to be secure  Keystream generators (pseudo-random key) o Synchronous.
Session 5 Hash functions and digital signatures. Contents Hash functions – Definition – Requirements – Construction – Security – Applications 2/44.
PIITMadhumita Chatterjee Security 1 Hashes and Message Digests.
1 Chapter 5 Hashes and Message Digests Instructor: 孫宏民 Room: EECS 6402, Tel: , Fax :
Announcements: 1. HW7 due next Tuesday. 2. Inauguration today! Questions? This week: Discrete Logs, Diffie-Hellman, ElGamal Discrete Logs, Diffie-Hellman,
Hash functions a hash function produces a fingerprint of some file/message/data h = H(M)  condenses a variable-length message M  to a fixed-sized fingerprint.
Announcements:Questions? This week: Discrete Logs, Diffie-Hellman, ElGamal Discrete Logs, Diffie-Hellman, ElGamal Hash Functions and SHA-1 Hash Functions.
Hashes and Message Digest Hash is also called message digest One-way function: d=h(m) but no h’(d)=m –Cannot find the message given a digest Cannot find.
Announcements: 1. Class cancelled tomorrow 2. HW7 due date moved to Thursday. Questions? This week: Birthday attacks, Digital signatures Birthday attacks,
Cryptography and Network Security Hash Algorithms.
Chapter 4  Hash Functions 1 Overview  Cryptographic hash functions are functions that: o Map an arbitrary-length (but finite) input to a fixed-size output.
Information Security and Management 11
Foundations of Network and Computer Security J J ohn Black Lecture #8 Sep 15 th 2005 CSCI 6268/TLEN 5831, Fall 2005.
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.
1 Pertemuan 09 Hash and Message Digest Matakuliah: H0242 / Keamanan Jaringan Tahun: 2006 Versi: 1.
1 Chapter 4 Cryptographic Hash Functions. 2 Outline 4.1 Hash Functions and Data Integrity 4.2 Security of Hash Functions 4.3 Iterated Hash Functions 4.4.
MD4 1 MD4. MD4 2 MD4  Message Digest 4  Invented by Rivest, ca 1990  Weaknesses found by 1992 o Rivest proposed improved version (MD5), 1992  Dobbertin.
Cryptography1 CPSC 3730 Cryptography Chapter 11, 12 Message Authentication and Hash Functions.
Cryptography and Network Security Chapter 11 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
1 Cryptography and Network Security (Various Hash Algorithms) Fourth Edition by William Stallings Lecture slides by Lawrie Brown (Changed by Somesh Jha)
Digital Signatures (DSs) The digital signatures cannot be separated from the message and attached to another The signature is not only tied to signer but.
Cryptography and Network Security Chapter 11 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Lecture 15 Lecture’s outline Public algorithms (usually) that are each other’s inverse.
Lecture slides prepared for “Computer Security: Principles and Practice”, 2/e, by William Stallings and Lawrie Brown, Chapter 21 “Public-Key Cryptography.
Digital Signatures Good properties of hand-written signatures: 1. Signature is authentic. 2. Signature is unforgeable. 3. Signature is not reusable (it.
Digital Signatures: Mathematics Zdeněk Říha. Data authentication Data integrity + data origin Digital signature Asymmetric cryptography public and private.
HASH Functions.
Hash Functions A hash function H accepts a variable-length block of data M as input and produces a fixed-size hash value h = H(M) Principal object is.
CSCE 715: Network Systems Security Chin-Tser Huang University of South Carolina.
1 Hashes and Message Digests. 2 Hash Also known as –Message digest –One-way function Function: input message -> output One-way: d=h(m), but not h’(d)
Hashing Algorithms: Basic Concepts and SHA-2 CSCI 5857: Encoding and Encryption.
Chapter 21 Public-Key Cryptography and Message Authentication.
Theory of Computation II Topic presented by: Alberto Aguilar Gonzalez.
CSCI 172/283 Fall 2010 Hash Functions, HMACs, and Digital Signatures.
Cryptographic Hash Functions
Lecture 8 Overview. Secure Hash Algorithm (SHA) SHA SHA SHA – SHA-224, SHA-256, SHA-384, SHA-512 SHA-1 A message composed of b bits.
Chapter 18: One-Way Hash Functions Based on Schneier.
Cryptographic Hash Functions and Protocol Analysis
Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy
Hash Functions Ramki Thurimella. 2 What is a hash function? Also known as message digest or fingerprint Compression: A function that maps arbitrarily.
Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 2.3 Hash Functions.
Computer Science and Engineering Computer System Security CSE 5339/7339 Lecture 11 September 23, 2004.
CS426Fall 2010/Lecture 51 Computer Security CS 426 Lecture 5 Cryptography: Cryptographic Hash Function.
Computer Science and Engineering Computer System Security CSE 5339/7339 Lecture 10 September 21, 2004.
CSCE 715: Network Systems Security Chin-Tser Huang University of South Carolina.
Hashes Lesson Introduction ●The birthday paradox and length of hash ●Secure hash function ●HMAC.
Information Security and Management 11. Cryptographic Hash Functions Chih-Hung Wang Fall
1 4.1 Hash Functions and Data Integrity A cryptographic hash function can provide assurance of data integrity. ex: Bob can verify if y = h K (x) h is a.
Lecture 9 Overview. RSA Invented by Cocks (GCHQ), independently, by Rivest, Shamir and Adleman (MIT) Two keys e and d used for Encryption and Decryption.
1 Message Authentication using Message Digests and the MD5 Algorithm Message authentication is important where undetected manipulation of messages can.
CS480 Cryptography and Information Security Huiping Guo Department of Computer Science California State University, Los Angeles 13.Message Authentication.
Data Integrity / Data Authentication. Definition Authentication (Signature) algorithm - A Verification algorithm - V Authentication key – k Verification.
Chapter 12 – Hash Algorithms
CHAPTER 4 TJADEN plus Chapters 13 & 14 Crytography Decrypted Hashing Functions, Message Digests, Message Authentication Codes (MACs) Dr. Suzanne Buchele.
DTTF/NB479: Dszquphsbqiz Day 26
Secured Hash Algorithm(SHA)
A way to detect a collision…
Cryptography Lecture 13.
ICS 454 Principles of Cryptography
Cryptographic Hash Functions
ICS 454 Principles of Cryptography
DTTF/NB479: Dszquphsbqiz Day 27
Presentation transcript:

1 Hash Functions

2 A hash function h takes as input a message of arbitrary length and produces as output a message digest of fixed length … … … Long Message Hash Function 160-Bit Message Digest

3 Hash Functions Certain properties should be satisfied: 1. Given a message m, the message digest h(m) can be calculated very quickly. 2. Given a y, it is computationally infeasible to find an m’ with h(m’)=y (in other words, h is a one-way, or preimage resistant, function). 3. It is computationally infeasible to find messages m 1 and m 2 with h(m 1 ) = h(m 2 ) (in this case, the function h is said to be strongly collision-free, or collision resistant).

4 Hash Functions Remarks: A hash function h is weakly collision-free (or second preimage resistant): For given x, it is computational infeasible to find x’ ≠ x with h(x’) = h(x) A hash h is strongly collision-free => h is weakly collision-free => h is one-way.

5 Hash Functions (Example) Discrete log hash function Let p and q=(p-1)/2 be primes. Let α, β be two primitive roots for p. Then, there is a such that α a ≡ β (mod p). The hash h maps integers mod q 2 to integers mod p. Let m = x 0 +x 1 q with 0≤x 0, x 1 ≤q-1. Define h(m) = α x 0 β x 1 (mod p)

6 Hash Functions The following shows that the function h is probably strongly collision-free. (Proposition) If we know messages m ≠ m’ with h(m)=h(m’), then we can determine the discrete logarithm a=log α β. (The discrete log problem is assumed hard.) m = x 0 +x 1 q, m' = x’ 0 +x’ 1 q h(m) = h(m’)  α x 0 β x 1 ≡ α x’ 0 β x’ 1 (mod p) α a(x 1 -x’ 1 )-(x’ 0 -x 0 ) ≡ 1 (mod p) a(x 1 -x’ 1 ) ≡ x’ 0 -x 0 (mod p-1)

7 Hash Functions Let d = gcd(x 1 -x’ 1, p-1). There are exactly d solutions for a. But the only factors of p-1 are 1, 2, q, p-1. Since 0≤x 1, x’ 1 ≤q-1, it follows that -(q-1)≤x 1 -x’ 1 ≤q-1. Therefore if x 1 -x’ 1 is not zero, then d is not q or p-1, so d=1 or 2. Therefore there are at most two possibilities for a. On the other hand, if if x 1 -x’ 1 is zero then m=m’, contrary to our assumption. #

8 Simple Hash Simple hash Discrete log hash is too slow. Start with a message m of arbitrary length L. We may break it into n-bit blocks. We shall denote these n-bit blocks as m=[m 1, m 2, m 3, …, m k ], and the last block m k is padded with zeros to ensure that it has n bits. h(m) = m 1  m 2  m 3  …  m k But it is easy to find two messages that hash to the same value. (so it is not collision resistant)

9 The Secure Hash Algorithm MD4 proposed by Rivest in 1990 MD5 modified in 1992 SHA proposed as a standard by NIST in 1993, and was adopted as FIPS 180 SHA-1 minor variation, published in 1995 as FIPS FIPS 180-2, adopted in 2002, includes SHA1, SHA-256, SHA-384, and SHA-512 A collision for SHA was found by Joux in 2004 Collisions for MD5 and several other popular hash functions were presented in 2004, 2005, by Wang, Feng, Lai and Yu.

10 The Secure Hash Algorithm SHA-1(Secure Hash Algorithm) iterated hash function 160-bit message digest word-oriented (32 bit) operation on bitstrings Padding scheme extends the input x by at most one extra 512-bit block The compression function maps bits to 160 bits Make each input affect as many output bits as possible

11 The Secure Hash Algorithm SHA-1-PAD(x) comment: |x|  d  (447-|x|) mod 512 l  the binary representation of |x|, where |l| = 64 y  x || 1 || 0 d || l (|y| is multiple of 512)

12 The Secure Hash Algorithm Operations used in SHA-1 X  Ybitwise “ and ” of X and Y X  Ybitwise “ or ” of X and Y X  Ybitwise “ xor ” of X and Y  Xbitwise complement of X X + Yinteger addition modulo 2 32 ROTL s (X)circular left shift of X by s position (0  s  31) In textbook, X ← s, instead.

13 The Secure Hash Algorithm f t (B,C,D) = (B  C)  ((  B)  D) if 0  t  19 B  C  D if 20  t  39 (B  C)  (B  D)  (C  D) if 40  t  59 B  C  D if 60  t  79

14 The Secure Hash Algorithm K t = 5A if 0  t  19 6ED9EBA1 if 20  t  39 8F1BBCDC if 40  t  59 CA62C1D6 if 60  t  79

15 The Secure Hash Algorithm Algorithm SHA-1(x) extern SHA-1-PAD global K 0, …,K 79 y  SHA-1-PAD(x) denote y = M 1 || M 2 ||..|| M n, where each M i is a 512 block H 0  , H 1  EFCDAB89, H 2  98BADCFE, H 3  , H 4  C3D2E1F0

16 The Secure Hash Algorithm for i  1 to n denote M i = W 0 || W 1 ||..|| W 15, where each W i is a word for t  16 to 79 do W t  ROTL 1 (W t-3  W t-8  W t-14  W t-16 ) A  H 0,,B  H 1, C  H 2, D  H 3, E  H 4 for t  0 to 79 temp  ROTL 5 (A) + f t (B,C,D) + E +W t + K t E  D, D  C, C  ROTL 30 (B), B  A, A  temp H 0  H 0 + A, H 1  H 1 + B, H 2  H 2 + C, H 3  H 3 + D, H 4  H 4 + E Return (H 0 || H 1 || H 2 || H 3 || H 4 )

17 Birthday Attacks Birthday paradox In a group of 23 randomly chosen people, at least two will share a birthday with probability at least 50%. If there are 30, the probability is around 70%. Finding two people with the same birthday is the same thing as finding a collision for this particular hash function.

18 Birthday Attacks The probability that all 23 people have different birthdays is Therefore, the probability of at least two having the same birthday is =0.507 More generally, suppose we have N objects, where N is large. There are r people, and each chooses an object. Then

19 Birthday Attacks Choosing r 2 /2N = ln2, we find that if r≈1.177, then the probability is 50% that at least two people choose the same object. If there are N possibilities and we have a list of length, then there is a good chance of a match. If we want to increase the chance of a match, we can make a list of length of a constant times.

20 Birthday Attacks (Example) We have 40 license plates, each ending in a 3-digit number. What is the probability that two of the license plates end in the same 3 digits? (Solution) N=1000, r=40 1. Approximation: 2. The exact answer:

21 Birthday Attacks What is the probability that none of these 40 license plates ends in the same 3 digits as yours? The reason the birthday paradox works is that we are not just looking for matches between one fixed plate and the other plates. We are looking for matches between any two plates in the set, so there are more opportunities for matches.

22 Birthday Attacks The birthday attack can be used to find collisions for hash functions if the output of the hash function is not sufficiently large. Suppose h is an n-bit hash function. Then there are N = 2 n possible outputs. We have the situation of list of length r≈ “people” with N possible “birthdays,” so there is a good chance of having two values with the same hash value. If the hash function outputs 128-bit values, then the lists have length around 2 64 ≈10 19, which is too large, both in time and in memory.

23 Birthday Attacks Suppose there are N objects and there are two groups of r people. Each person from each group selects an object. What is the probability that someone from the first group choose the same object as someone from the second group? Eg. If we take N=365 and r=30, then

24 Birthday Attacks A birthday attack on discrete logarithm We want to solve α x ≡ β (mod p). Make two lists, both of length around 1 st list: α k (mod p) for random k. 2 nd list: βα -h (mod p) for random h. There is a good chance that there is a match α k ≡ βα -h (mod p), hence x=k+h. Compared with BSGS: BSGS algorithm is deterministic while the birthday attack algorithm is probabilistic.