Lecture 4.1: Hash Functions, and Message Authentication Codes CS 436/636/736 Spring 2015 Nitesh Saxena.

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.
Lecture 4: Cryptography III; Security CS 336/536: Computer Network Security Fall 2013 Nitesh Saxena.
Digital Signatures and Hash Functions. Digital Signatures.
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.
CMSC 414 Computer and Network Security Lecture 5 Jonathan Katz.
Secure Hashing and DSS Sultan Almuhammadi ICS 454 Principles of Cryptography.
Csci5233 Computer Security & Integrity 1 Cryptography: Basics (2)
Hash Functions Nathanael Paul Oct. 9, Hash Functions: Introduction Cryptographic hash functions –Input – any length –Output – fixed length –H(x)
Lecture 13 Message Signing
Cryptography and Network Security Chapter 11 Fourth Edition by William Stallings Lecture slides by Lawrie Brown/Mod. & S. Kondakci.
CS526Topic 5: Hash Functions and Message Authentication 1 Computer Security CS 526 Topic 5 Cryptography: Cryptographic Hash Functions And Message Authentication.
Hash Functions 1 Hash Functions Hash Functions 2 Cryptographic Hash Function  Crypto hash function h(x) must provide o Compression  output length is.
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)
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.
CMSC 414 Computer and Network Security Lecture 6 Jonathan Katz.
Message Authentication  message authentication is concerned with: protecting the integrity of a message protecting the integrity of a message validating.
Information Security Principles Assistant Professor Dr. Sana’a Wafa Al-Sayegh 1 st Semester ITGD 2202 University of Palestine.
1 Chapter 11: Message Authentication and Hash Functions Fourth Edition by William Stallings Lecture slides by Lawrie Brown (modified by Prof. M. Singhal,
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.
CS526: Information Security Prof. Sam Wagstaff September 16, 2003 Cryptography Basics.
Lecture 3.4: Public Key Cryptography IV CS 436/636/736 Spring 2013 Nitesh Saxena.
EE515/IS523 Think Like an Adversary Lecture 4 Crypto in a Nutshell Yongdae Kim.
Message Authentication Code July Message Authentication Problem  Message Authentication is concerned with:  protecting the integrity of a message.
11.1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 11 Message Integrity and Message Authentication.
1 Network Security Lecture 5 Hashes and Message Digests Waleed Ejaz
Chapter 4 Message Authentication MSc. NGUYEN CAO DAT Dr. TRAN VAN HOAI 1.
A Quick Tour of Cryptographic Primitives Anupam Datta CMU Fall A: Foundations of Security and Privacy.
Lecture 4.2: Hash Functions: Design* CS 436/636/736 Spring 2012 Nitesh Saxena * some slides borrowed from Gene Tsudik.
CIT 380: Securing Computer SystemsSlide #1 CIT 380: Securing Computer Systems Modern Cryptography.
Chapter 11 Message Authentication and Hash Functions.
Cryptography and Network Security Chapter 12 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Class 3 Cryptography Refresher II CIS 755: Advanced Computer Security Spring 2014 Eugene Vasserman
Lecture 4: Cryptography III; Security CS 336/536: Computer Network Security Fall 2014 Nitesh Saxena.
Cryptography and Network Security (CS435) Part Nine (Message Authentication)
Lecture 5.1: Message Authentication Codes, and Key Distribution
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.
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.
IT 221: Introduction to Information Security Principles Lecture 5: Message Authentications, Hash Functions and Hash/Mac Algorithms For Educational Purposes.
CS555Spring 2012/Topic 151 Cryptography CS 555 Topic 15: HMAC, Combining Encryption & Authentication.
Message Authentication Codes CSCI 5857: Encoding and Encryption.
Data Integrity / Data Authentication. Definition Authentication (Signature) algorithm - A Verification algorithm - V Authentication key – k Verification.
Understanding Cryptography by Christof Paar and Jan Pelzl These slides were prepared by Christof Paar and Jan Pelzl Chapter 12.
@Yuan Xue 285: Network Security CS 285 Network Security Hash Algorithm Yuan Xue Fall 2012.
Chapter 12 – Hash Algorithms
Cryptographic Hash Functions
Cryptographic Hash Functions
Cryptography Lecture 13.
Cryptographic Hash Functions
ICS 454 Principles of Cryptography
ICS 454 Principles of Cryptography
Lecture 4.1: Hash Functions: Introduction
Lecture 4.1: Hash Functions, and Message Authentication Codes
Cryptography Lecture 14.
Cryptography Lecture 13.
Cryptography Lecture 13.
Lecture 4: Hash Functions
Presentation transcript:

Lecture 4.1: Hash Functions, and Message Authentication Codes CS 436/636/736 Spring 2015 Nitesh Saxena

Course Administration HW1 solution will be posted We are grading now – Should be done early next week 2

Course Administration Expect HW2 coming out by Monday – Covers mostly Public Key Cryptography – Due in days 10/19/2015 Lecture 4.1: Hash Functions, and MACs 3

Outline of Today’s lecture Hash Functions – Properties – Birthday Paradox – Generic Design Message Authentication Codes – Based on block cipher designs – Based on hash functions 10/19/2015 Lecture 4.1: Hash Functions, and MACs 4

Cryptographic Hash Functions Requirements of cryptographic hash functions: – Can be applied to data of any length. – Output is fixed length, usually very short – Relatively easy to compute h(x), given x – Function is deterministic – Infeasible to get x, given h(x). One-wayness property – Given x, infeasible to find y such that h(x) = h(y). Weak-collision resistance property – Infeasible to find any pair x and y (x ≠ y) such that h(x) = h(y). Strong-collision resistance property or just collision resistance 10/19/2015 Lecture 4.1: Hash Functions, and MACs 5

Some Applications of Hash Functions In general, can be used as a checksum for large amounts of data Password hashing Digital signatures Message authentication codes (will study later) Used also in RSA-OAEP, and many other cryptographic constructions 10/19/2015 Lecture 4.1: Hash Functions, and MACs 6

Hash Output Length How long should be the output (n bits) of a cryptographic hash function? To find collision - randomly select messages and check if hash matches any that we know. Throwing k balls in N = 2 n bins. How large should k be, before probability of landing two balls in the same becomes greater than ½? Birthday paradox - a collision can be found in roughly sqrt(N) = 2 (n/2) trials for an n bit hash – In a group of 23 (~ sqrt(365)) people, at least two of them will have the same birthday (with a probability > ½) Hence n should be at least /19/2015 Lecture 4.1: Hash Functions, and MACs 7

Birthday Paradox Probability that hash values of k random messages are distinct is (that is, no collisions) is: 10/19/2015 Lecture 4.1: Hash Functions, and MACs 8

Generic Hash Function – Merkle- Damgard Construction This design for H() is collision-resistant given that h() is collision resistant Intuitively, this is because there is a avalanche effect – even if the inputs differ in just 1 bit, the outputs will be completely different IV is a known public constant 9 10/19/2015 Lecture 4.1: Hash Functions, and MACs

An Illustrative Example from Wikipedia 10/19/2015 Lecture 4.1: Hash Functions, and MACs 10

Practical Examples SHA-1 – Output 160 bits – B’day attack requires 2 80 calls – Faster attacks 2 69 calls %20the%20Full%20SHA-1.pdf MD5 – Output is 128 bits, so B’day attack requires 2 64 calls only – Faster attacks to find a collision: Better use stronger versions, such as SHA-256 Although, these attacks are still not practical – they only find two random messages that collide 11

Further Reading Stallings Chapter 11 HAC Chapter 9 10/19/2015 Lecture 4.1: Hash Functions, and MACs 12

Message Authentication Codes Provide integrity as well as authentication Send (m, MAC); MAC is created on m using the key shared between two parties Has to be deterministic to enable verification – Unlike encryption schemes We want MAC to be as small and as secure as possible Can not provide non-repudiation – Why not? 13 10/19/2015 Lecture 4.1: Hash Functions, and MACs

MAC – Functions KeyGen – outputs a key MAC – creates a checksum on m using key K Verify – validates whether the checksum on m is computed correctly – Just create MAC and compare 10/19/2015 Lecture 4.1: Hash Functions, and MACs 14

Security Notion for MAC Very similar to the security notion for a digital signature scheme Existential forgery under (adaptively) chosen message attack 15 10/19/2015 Lecture 4.1: Hash Functions, and MACs

Can encryption be used as a MAC? No, not in general Intuitively because encryption achieves properties different from MAC See a counter-example: – One-time pad as a MAC – bad idea! However, you can use 3-DES or AES as a building block for MAC 10/19/2015 Lecture 4.1: Hash Functions, and MACs 16

MAC Based on Block Cipher in the CBC mode – CBC-MAC 17 10/19/2015 Lecture 4.1: Hash Functions, and MACs

CBC-MAC Note that this is deterministic – IV = [0] – Unlike CBC encryption Only the last block of the output is used as a MAC This is secure under CMA attack – For pre-decided fixed-length messages – Intuitively because of the presence of an avalanche effect 10/19/2015 Lecture 4.1: Hash Functions, and MACs 18

HMAC: MAC using Hash Functions Developed as part of IPSEC - RFC Also used in SSL etc. Key based hash but almost as fast as non-key based hash functions. Avoids export restrictions unlike DES based MAC. Provable security Can be used with different hash functions like SHA-1,MD5, etc /19/2015 Lecture 4.1: Hash Functions, and MACs

HMAC Block size b bits. K + - K padded with bits on the left to make b bits. ipad – (ox36) repeated b/8 times. opad – (0x5c) repeated b/8 times. Essentially HHMAC K = H[(K + xor opad) || H[(K + xor ipad) || M]] 20 10/19/2015 Lecture 4.1: Hash Functions, and MACs

Security of HMAC Security related to the collision resistance of the underlying hash function c.html 21 10/19/2015 Lecture 4.1: Hash Functions, and MACs

HMAC – An Efficient Implementation 22 10/19/2015 Lecture 4.1: Hash Functions, and MACs

Further Reading Stallings Chapter 12 (MAC) HAC Chapter 9 (MAC) 23 10/19/2015 Lecture 4.1: Hash Functions, and MACs