Slide 1 Vitaly Shmatikov CS 378 Hash Functions. slide 2 We’ve Already Seen Hashes In… Every lecture so far! uIntegrity checking in SSL uAs one of applications.

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.
CS 6262 Spring 02 - Lecture #7 (Tuesday, 1/29/2002) Introduction to Cryptography.
Digital Signatures and Hash Functions. Digital Signatures.
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 :
First Edition by William Stallings and Lawrie Brown Lecture slides by Lawrie Brown and edited by Archana Chidanandan Cryptographic Tools.
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.
CSE331: Introduction to Networks and Security Lecture 21 Fall 2002.
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
Kemal AkkayaWireless & Network Security 1 Department of Computer Science Southern Illinois University Carbondale CS 591 – Wireless & Network Security Lecture.
Henric Johnson1 Chapter3 Public-Key Cryptography and Message Authentication Henric Johnson Blekinge Institute of Technology, Sweden
Secure Hashing and DSS Sultan Almuhammadi ICS 454 Principles of Cryptography.
Overview of Cryptography What is Cryptography?
Hash Functions Nathanael Paul Oct. 9, Hash Functions: Introduction Cryptographic hash functions –Input – any length –Output – fixed length –H(x)
CS526Topic 5: Hash Functions and Message Authentication 1 Computer Security CS 526 Topic 5 Cryptography: Cryptographic Hash Functions And Message Authentication.
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)
Chapter 8.  Cryptography is the science of keeping information secure in terms of confidentiality and integrity.  Cryptography is also referred to as.
Vitaly Shmatikov CS 361S Cryptographic Hash Functions.
Cryptography and Network Security Chapter 11 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
1 Public-Key Cryptography and Message Authentication Ola Flygt Växjö University, Sweden
© Neeraj Suri EU-NSF ICT March 2006 DEWSNet Dependable Embedded Wired/Wireless Networks MUET Jamshoro Computer Security: Principles and Practice Slides.
Lecture slides prepared for “Computer Security: Principles and Practice”, 2/e, by William Stallings and Lawrie Brown, Chapter 21 “Public-Key Cryptography.
Acknowledgements: William Stallings.William Stallings All rights Reserved Session 4 Public Key Cryptography (Part 2) Network Security Essentials Application.
HASH Functions.
Message Authentication  message authentication is concerned with: protecting the integrity of a message protecting the integrity of a message validating.
Slide 1 Vitaly Shmatikov CS 378 Cryptographic 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.
IS 302: Information Security and Trust Week 5: Integrity 2012.
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.
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.
Chapter 21 Public-Key Cryptography and Message Authentication.
Computer Security: Principles and Practice First Edition by William Stallings and Lawrie Brown Lecture slides by Lawrie Brown Chapter 2 – Cryptographic.
CSCI 172/283 Fall 2010 Hash Functions, HMACs, and Digital Signatures.
Hash and Mac Algorithms. Contents Hash Functions Secure Hash Algorithm HMAC.
CSCE 815 Network Security Lecture 8 SHA Operation and Kerberos.
Slide 1 EJ Jung Hash Functions. Integrity checks.
Cryptographic Hash Functions and Protocol Analysis
Lecture 2: Introduction to Cryptography
Week 4 - Friday.  What did we talk about last time?  Snow day  But you should have read about  Key management.
Cryptography 1 Crypto Cryptography 2 Crypto  Cryptology  The art and science of making and breaking “secret codes”  Cryptography  making “secret.
Authentication. Goal: Bob wants Alice to “prove” her identity to him Protocol ap1.0: Alice says “I am Alice” Failure scenario?? “I am Alice”
Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy
Giuseppe Bianchi Message Authentication: hash functions and hash-based constructions.
Hash Functions Ramki Thurimella. 2 What is a hash function? Also known as message digest or fingerprint Compression: A function that maps arbitrarily.
Lecture 4.1: Hash Functions, and Message Authentication Codes CS 436/636/736 Spring 2014 Nitesh Saxena.
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.
Information Security and Management 11. Cryptographic Hash Functions Chih-Hung Wang Fall
IT 221: Introduction to Information Security Principles Lecture 5: Message Authentications, Hash Functions and Hash/Mac Algorithms For Educational Purposes.
CS480 Cryptography and Information Security Huiping Guo Department of Computer Science California State University, Los Angeles 13.Message Authentication.
Cryptography Hyunsung Kim, PhD University of Malawi, Chancellor College Kyungil University February, 2016.
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.
“The quick brown fox jumps over the lazy dog”
Cryptographic Hash Function
ICS 454 Principles of Cryptography
ICS 454 Principles of Cryptography
Presentation transcript:

slide 1 Vitaly Shmatikov CS 378 Hash Functions

slide 2 We’ve Already Seen Hashes In… Every lecture so far! uIntegrity checking in SSL uAs one of applications for block ciphers uPassword protection in UNIX uChallenge-response uCookie authenticators … and many other applications

slide 3 Motivation: Integrity goodFile Software manufacturer wants to ensure that the executable file is received by users without modification. Sends out the file to users and publishes its hash in NY Times. The goal is integrity, not secrecy Idea: given file and hash(goodFile), very hard to find badFile such that hash(goodFile)=hash(badFile) BigFirm™User VIRUS badFile The Times hash(goodFile)

slide 4 Integrity vs. Secrecy uIntegrity: attacker cannot modify or tamper with message uEncryption per se does not guarantee integrity Intuition: attacker may able to modify message under encryption without learning what it is –One-time pad: perfect secrecy, but can easily change unknown M under encryption, to M  M’ for any M’ –Online auction: halve competitor’s bid without learning its value This is recognized by industry standards (e.g., PKCS) –“RSA encryption is intended primarily to provide confidentiality… It is not intended to provide integrity” (from RSA Labs Bulletin) Some encryption schemes provide secrecy AND integrity

slide 5 Motivation: Authentication msg, hash(KEY,msg) Alice wants to make sure that nobody modifies message in transit Ensures both integrity and authentication (why?) Idea: given msg, very hard to compute hash(KEY,msg) without KEY; very easy with KEY Alice Bob KEY

slide 6 Hash Functions: Main Idea bit strings of any length n-bit bit strings..... x’ x’’ x y’ y hash function H uH is a lossy compression function Collisions: h(x)=h(x’) for some inputs x, x’ Result of hashing should “look random” (make this precise later) –Intuition: ½ of digest bits are “1”; any bit in digest is “1” half the time uCryptographic hash function needs a few properties… message “digest” message

slide 7 One-Way uIntuition: hash should be hard to invert “Preimage resistance”: given random y  {0,1} n, hard to find any x such that h(x)=y uHow hard? Brute-force: try every possible x, see if h(x)=y SHA-1 (common hash function) has 160-bit output –Suppose have hardware that’ll do 2 30 trials a pop –Assuming 2 34 trials per second, can do 2 89 trials per year –Will take 2 71 years to invert SHA-1 on a random image

slide 8 Collision Resistance uShould be hard to find x, x’ such that h(x)=h(x’) Brute-force collision search is only O(2 n/2 ), not 2 n uBirthday paradox Consider t values x i and corresponding y i =h(x i ) For each pair x i,x j, there is 1/2 n probability of collision There is a total of choose(2,t)=t(t-1)/2  O(t 2 ) pairs If t is close to 2 n/2, then number of pairs is close to 2 n, for each pair probability of collision is 1/2 n, thus probability of collision for some pair is close to 1

slide 9 One-Way  Collision Resistance uOne-wayness does not imply collision resistance Suppose g is one-way Define h(x) as g(x’) where x’ is x except the last bit –h is one-way (to invert h, must invert g) –Collisions for h are easy to find: for any x, h(x0)=h(x1) uCollision resistance does not imply one-wayness Suppose g is collision-resistant Define h(x) to be 0x if x is n-bit long, 1g(x) otherwise –Collisions for h are hard to find: if y starts with 0, then there are no collisions, if y starts with 1, then must find collisions in g –h is not one way: the first bit of randomly chosen y is 0 with probability ½ (easy to invert!) /

slide 10 Weak Collision Resistance uGiven randomly chosen x, hard to find x’ such that h(x)=h(x’) Attacker must find collision for a specific x. By contrast, to break collision resistance, enough to find any collision. Brute-force attack requires O(2 n ) time uWeak collision resistance does not imply collision resistance (why?)

slide 11 Which Property Do We Need? uUNIX passwords stored as hash(password) One-wayness: hard to recover password Weak collision resistance: hard to find another password that’ll hash to the same value uIntegrity of software distribution Weak collision resistance uAuction bidding Alice wants to bid B, sends H(B), later reveals B One-wayness: rival bidders should not recover B Collision resistance: Alice should not be able to change her mind to bid B’ such that H(B)=H(B’)

slide 12 Common Hash Functions uMD5 128-bit output Designed by Ron Rivest, used very widely Collision-resistance broken (summer of 2004) uRIPEMD bit variant of MD-5 uSHA-1 (Secure Hash Algorithm) 160-bit output US government (NIST) standard as of –Also the hash algorithm for Digital Signature Standard (DSS)

slide 13 Basic Structure of SHA-1 Against padding attacks Split message into 512-bit blocks Compression function Applied to each 512-bit block and current 160-bit buffer This is the heart of SHA bit buffer (5 registers) initialized with magic values

slide 14 Reminder: Block Ciphers Block of plaintext SSSS SSSS SSSS Key repeat for several rounds Block of ciphertext For hashing, there is no KEY. Use message as key and replace plaintext with a fixed string. (for example, Unix password hash is DES applied to NULL with password as the key)

slide 15 SHA-1 Compression Function Current message block Current buffer (five 32-bit registers A,B,C,D,E) Buffer contains final hash value Very similar to block cipher, with message itself used as the key for each round Four rounds, 20 steps in each Let’s look at each step in more detail… Fifth round adds the original buffer to the result of 4 rounds

slide 16 AEBCDAEBCD + + ftft 5 bitwise left-rotate WtWt KtKt One Step of SHA-1 (80 steps total) Special constant added (same value in each 20-step round, 4 different constants altogether) Logic function for steps (B  C)  (  B  D) B  C  D (B  C)  (B  D)  (C  D) B  C  D Current message block mixed in For steps 0..15, W =message block For steps , W t =W t-16  W t-14  W t-8  W t Multi-level shifting of message blocks 30 bitwise left-rotate

slide 17 How Strong Is SHA-1? uEvery bit of output depends on every bit of input Very important property for collision-resistance uBrute-force inversion requires ops, birthday attack on collision resistance requires 2 80 ops uSome very recent potential weaknesses Collisions in SHA-0 and 36-step SHA-1 announced at CRYPTO 2004 –Actual SHA-1 uses 80 steps

slide 18 Authentication Without Encryption Integrity and authentication: only someone who knows KEY can compute MAC for a given message Alice Bob KEY message MAC (message authentication code) message, MAC(KEY,message) = ? Recomputes MAC and verifies whether it is equal to the MAC attached to the message

slide 19 HMAC uConstruct MAC by applying a cryptographic hash function to message and key Could also use encryption instead of hashing, but… Hashing is faster than encryption in software Library code for hash functions widely available Can easily replace one hash function with another There used to be US export restrictions on encryption uInvented by Bellare, Canetti, and Krawczyk (1996) HMAC strength established by cryptographic analysis uMandatory for IP security, also used in SSL/TLS

slide 20 Structure of HMAC Embedded hash function (strength of HMAC relies on strength of this hash function) “Black box”: can use this HMAC construction with any hash function (why is this important?) Block size of embedded hash function Secret key padded to block size magic value (flips half of key bits) another magic value (flips different key bits) hash(key,hash(key,message)) “Amplify” key material (get two keys out of one) Very common problem: given a small secret, how to derive a lot of new keys?

slide 21 Reading Assignment uRead Stallings 3.1 and 3.2