Cryptographic Hash Functions Part I

Slides:



Advertisements
Similar presentations
Lecture 5: Cryptographic Hashes
Advertisements

Hash Function. What are hash functions? Just a method of compressing strings – E.g., H : {0,1}*  {0,1} 160 – Input is called “message”, output is “digest”
ECE454/CS594 Computer and Network Security Dr. Jinyuan (Stella) Sun Dept. of Electrical Engineering and Computer Science University of Tennessee Fall 2011.
Session 5 Hash functions and digital signatures. Contents Hash functions – Definition – Requirements – Construction – Security – Applications 2/44.
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.
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.
Secure Hashing and DSS Sultan Almuhammadi ICS 454 Principles of Cryptography.
Hash Functions Nathanael Paul Oct. 9, Hash Functions: Introduction Cryptographic hash functions –Input – any length –Output – fixed length –H(x)
1 Message Authentication and Hash Functions Authentication Requirements Authentication Functions Message Authentication Codes Hash Functions Security of.
Cryptography and Network Security Chapter 11 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Acknowledgements: William Stallings.William Stallings All rights Reserved Session 4 Public Key Cryptography (Part 2) Network Security Essentials Application.
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.
Dan Johnson. What is a hashing function? Fingerprint for a given piece of data Typically generated by a mathematical algorithm Produces a fixed length.
Message Authentication Code July Message Authentication Problem  Message Authentication is concerned with:  protecting the integrity of a message.
Lecture 4.1: Hash Functions, and Message Authentication Codes CS 436/636/736 Spring 2015 Nitesh Saxena.
Theory of Computation II Topic presented by: Alberto Aguilar Gonzalez.
CIT 380: Securing Computer SystemsSlide #1 CIT 380: Securing Computer Systems Modern Cryptography.
Week 4 - Friday.  What did we talk about last time?  Snow day  But you should have read about  Key management.
Intro to Cryptography Lesson Introduction
Hash Functions Ramki Thurimella. 2 What is a hash function? Also known as message digest or fingerprint Compression: A function that maps arbitrarily.
CS426Fall 2010/Lecture 51 Computer Security CS 426 Lecture 5 Cryptography: Cryptographic Hash Function.
Hashes Lesson Introduction ●The birthday paradox and length of hash ●Secure hash function ●HMAC.
IT 221: Introduction to Information Security Principles Lecture 5: Message Authentications, Hash Functions and Hash/Mac Algorithms For Educational Purposes.
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.
Data Integrity / Data Authentication. Definition Authentication (Signature) algorithm - A Verification algorithm - V Authentication key – k Verification.
Cryptographic Hash Function. A hash function H accepts a variable-length block of data as input and produces a fixed-size hash value h = H(M). The principal.
@Yuan Xue 285: Network Security CS 285 Network Security Hash Algorithm Yuan Xue Fall 2012.
Message Integrity and Message Authentication
Security of Message Digests
Cryptographic hash functions
Cryptographic Hash Functions
Cryptographic Hash Function
Message Authentication and Hash Functions
Modern symmetric-key Encryption
A way to detect a collision…
Digital signatures.
Cryptographic Hash Functions
Topic 14: Random Oracle Model, Hashing Applications
Digital Signature Schemes and the Random Oracle Model
Cryptographic Hash Functions Part I
Cryptography Lecture 13.
B504/I538: Introduction to Cryptography
Cryptographic Hash Functions
ICS 454 Principles of Cryptography
Cryptography Lecture 19.
Digital Signature Schemes and the Random Oracle Model
Cryptographic Hash Functions
Message Authentication and Hash Functions
Chapter 11 – Message Authentication and Hash Functions
Introduction to Symmetric-key and Public-key Cryptography
Data Integrity: Applications of Cryptographic Hash Functions
ICS 454 Principles of Cryptography
Lecture 4.1: Hash Functions: Introduction
The Birthday Paradox June 2012.
Cryptography Lecture 5.
Chapter -7 CRYPTOGRAPHIC HASH FUNCTIONS
Cryptography Lecture 14.
Introduction to Cryptography (1)
Lecture 4.1: Hash Functions, and Message Authentication Codes
Cryptography Lecture 14.
Hashing Hash are the auxiliary values that are used in cryptography.
Cryptography Lecture 13.
Cryptography Lecture 13.
Cryptography Lecture 15.
Cryptography Lecture 18.
Lecture 4: Hash Functions
Hash Function Requirements
CRYPTOGRAPHY & NETWORK SECURITY
Blockchains Lecture 4.
Presentation transcript:

Cryptographic Hash Functions Part I 2MMC10 Cryptology Andreas Hülsing

How are hash functions used? integrity protection cryptographic checksum (e.g. software downloads) for file system integrity (Bit-torrent, git) password hashing dedicated algorithms like scrypt / argon2 use hash functions as building block MAC – message authentication code Digital signature (“public key MAC”) Password-based key derivation Pseudo-random number generation (PRG) …

What is a hash function? - Applied answer Input: bit string x of arbitrary length length may be 0 in practice a very large bound on the length is imposed, such as 264 (≈ 2.1 million TB) input often called the message Output: bit string h(x) of fixed length n e.g. n = 128, 160, 224, 256, 384, 512 compression output often called hash value, message digest, fingerprint h(x) is efficiently computable given x no secret information, no secret key

What is a hash function? - Formal answer Efficient keyed function h: 0,1 𝑛 × 0,1 𝑙(𝑛) → 0,1 𝑛 We write h k,x = ℎ 𝑘 (𝑥) Key 𝑘 in this case is public information. Think of function description

Security properties: Collision resistance Collision resistance (CR): For any PPT adversary A, the following probability is negligible in n: 𝑃𝑟[𝑘 ← 𝑅 0,1 𝑛 , 𝑥 1 , 𝑥 2 ←𝐴 𝑘 : ℎ 𝑘 𝑥 1 = ℎ 𝑘 𝑥 2 ∧ 𝑥 1 ≠ 𝑥 2 ]

Security properties: Preimage resistance / One-wayness Preimage resistance (PRE): For any PPT adversary A, the following probability is negligible in n: 𝑃𝑟[𝑘 ← 𝑅 0,1 𝑛 ,𝑥 ← 𝑅 0,1 𝑙 𝑛 ,𝑦← ℎ 𝑘 𝑥 , 𝑥 ′ ←𝐴 𝑘,𝑦 : ℎ 𝑘 𝑥′ =𝑦]

Formal security properties: Second-preimage resistance Second-preimage resistance: For any PPT adversary A, the following probability is negligible in n: 𝑃𝑟[𝑘 ← 𝑅 0,1 𝑛 ,𝑥 ← 𝑅 0,1 𝑙 𝑛 ,𝑥′←𝐴 𝑘,𝑥 : ℎ 𝑘 𝑥 = ℎ 𝑘 𝑥′ ∧ 𝑥≠𝑥′ ]

Relations between hash function security properties

Easy start: CR -> SPR Theorem (informal): If h is collision resistant then it is second preimage resistant. Proof: By contradiction: Assume A breaks SPR of h then we can build an oracle machine MA that breaks CR. Given key k, MA first samples random 𝑥← 0,1 𝑙(𝑛) MA runs 𝑥′←𝐴 𝑘,𝑥 and outputs 𝑥,𝑥′ MA runs in approx. same time as A and has same success probability. -> Tight reduction

SPR -> PRE ? Theorem (informal): If h is second-preimage resistant then it is also preimage resistant. Proof: By contradiction: Assume A breaks PRE of h then we can build an oracle machine MA that breaks SPR. Given key k, x, MA runs 𝑥′←𝐴 𝑘, ℎ 𝑘 (𝑥) and outputs 𝑥,𝑥′ MA runs in same time as A and has same success probability. Do you find the mistake?

SPR -> PRE ? Theorem (informal): If h is second-preimage resistant then it is also preimage resistant. Counter example: the identity function id : 0,1 𝑛 → 0,1 𝑛 is SPR but not PRE.

We are not guaranteed that 𝒙≠ 𝒙 ′ ! SPR -> PRE ? Theorem (informal): If h is second-preimage resistant then it is also preimage resistant. Proof: By contradiction: Assume A breaks PRE of h then we can build an oracle machine MA that breaks SPR. Given key k, x, MA runs 𝑥′←𝐴 𝑘, ℎ 𝑘 (𝑥) and outputs 𝑥,𝑥′ MA runs in same time as A and has same success probability. Do you find the mistake? We are not guaranteed that 𝒙≠ 𝒙 ′ !

SPR -> PRE ? Theorem (informal, corrected): If ℎ is second-preimage resistant, 𝑙 𝑛 ≥𝑛+1, and ℎ 𝑘 is regular for every k, then it is also preimage resistant. Proof: By contradiction: Assume A breaks PRE of ℎ then we can build an oracle machine MA that breaks SPR. Given key k, x, MA runs 𝑥′←𝐴 𝑘, ℎ 𝑘 (𝑥) and outputs 𝑥,𝑥′ MA runs in same time as A and has at least half the success probability. Same corrections have to be applied for CR -> PRE

Collision-Resistance 2nd-Preimage-Resistance Summary: Relations stronger / easier to break Collision-Resistance Assumption / Attacks 2nd-Preimage-Resistance One-way weaker / harder to break

generic (brute force) attacks assume: hash function behaves like random function preimages and second preimages can be found by random guessing search search space: ≈ n bits, ≈ 2n hash function calls collisions can be found by birthdaying search space: ≈ ½n bits, ≈ 2½n hash function calls this is a big difference MD5 is a 128 bit hash function (second) preimage random search: ≈ 2128 ≈ 3x1038 MD5 calls collision birthday search: only ≈ 264 ≈ 2x1019 MD5 calls

birthday paradox birthday paradox given a set of t (≥ 10) elements take a sample of size k (drawn with repetition) in order to get a probability ≥ ½ on a collision (i.e. an element drawn at least twice) k has to be > 1.2 𝑡 consequence if 𝐹 : 𝐴 → 𝐵 is a surjective random function and |𝐴| ≫ |𝐵| then one can expect a collision after about |𝐵| random function calls

meaningful birthdaying random birthdaying do exhaustive search on n/2 bits messages will be ‘random’ messages will not be ‘meaningful’ Yuval (1979) start with two meaningful messages m1, m2 for which you want to find a collision identify n/2 independent positions where the messages can be changed at bit level without changing the meaning e.g. tab  space, space  newline, etc. do random search on those positions

implementing birthdaying naïve store 2n/2 possible messages for m1 and 2n/2 possible messages for m2 and check all 2n pairs less naïve store 2n/2 possible messages for m1 and for each possible m2 check whether its hash is in the list smart: Pollard-ρ with Floyd’s cycle finding algorithm computational complexity still O(2n/2) but only constant small storage required

Pollard-ρ and Floyd cycle finding iterate the hash function: a0, a1 = h(a0), a2 = h(a1), a3 = h(a2), … this is ultimately periodic: there are minimal t, p such that at+p = at theory of random functions: both t, p are of size 2n/2 Floyd’s cycle finding algorithm Floyd: start with (a1,a2) and compute (a2,a4), (a3,a6), (a4,a8), …, (aq,a2q) until a2q = aq; this happens for some q < t + p