1 Chapter 5 Hashes and Message Digests Instructor: 孫宏民 Room: EECS 6402, Tel:03-5742968, Fax : 886-3-572-3694.

Slides:



Advertisements
Similar presentations
Hashes and Message Digests
Advertisements

Lecture 5: Cryptographic Hashes
Lecture 7 Overview. Advanced Encryption Standard 10, 12, 14 rounds for 128, 192, 256 bit keys – Regular Rounds (9, 11, 13) – Final Round is different.
ECE454/CS594 Computer and Network Security Dr. Jinyuan (Stella) Sun Dept. of Electrical Engineering and Computer Science University of Tennessee Fall 2011.
Cryptographic Hash Functions Rocky K. C. Chang, February
Digital Signatures and Hash Functions. Digital Signatures.
Outline Project 1 Hash functions and its application on security Modern cryptographic hash functions and message digest –MD5 –SHA.
 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.
Chapter 4 Modes of Operation Instructor: 孫宏民 Room: EECS 6402, Tel: , Fax :
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.
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.
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
Secure Hashing and DSS Sultan Almuhammadi ICS 454 Principles of Cryptography.
Csci5233 Computer Security & Integrity 1 Cryptography: Basics (2)
CS470, A.SelcukHash Functions1 Cryptographic Hash Functions CS 470 Introduction to Applied Cryptography Instructor: Ali Aydin Selcuk.
Hash Functions Nathanael Paul Oct. 9, Hash Functions: Introduction Cryptographic hash functions –Input – any length –Output – fixed length –H(x)
Cryptography and Network Security Chapter 11 Fourth Edition by William Stallings Lecture slides by Lawrie Brown/Mod. & S. Kondakci.
Hashing (Message Digest) Hello There.
Cryptography1 CPSC 3730 Cryptography Chapter 11, 12 Message Authentication and Hash Functions.
1 Message Authentication and Hash Functions Authentication Requirements Authentication Functions Message Authentication Codes Hash Functions Security of.
Chapter 8.  Cryptography is the science of keeping information secure in terms of confidentiality and integrity.  Cryptography is also referred to as.
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.
Acknowledgements: William Stallings.William Stallings All rights Reserved Session 4 Public Key Cryptography (Part 2) Network Security Essentials Application.
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.
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.
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)
Fall 2002CS 395: Computer Security1 Chapter 11: Message Authentication and Hash Functions.
Theory of Computation II Topic presented by: Alberto Aguilar Gonzalez.
11.1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 11 Message Integrity and Message Authentication.
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
Confidentiality Confidentiality is maintained so long as private keys are secure. Authenticity is possible via public-key encryption by encrypting messages.
1 Network Security Lecture 5 Hashes and Message Digests Waleed Ejaz
11.1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 11 Message Integrity and Message Authentication.
Chapter 2 Advanced Cryptography (Part C)
Cryptographic Hash Functions and Protocol Analysis
Lecture 2: Introduction to Cryptography
CIT 380: Securing Computer SystemsSlide #1 CIT 380: Securing Computer Systems Modern Cryptography.
Understanding Cryptography – A Textbook for Students and Practitioners by Christof Paar and Jan Pelzl Chapter 11 – Hash Functions.
Chapter 11 Message Authentication and Hash Functions.
Cryptography and Network Security Chapter 12 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Authentication. Goal: Bob wants Alice to “prove” her identity to him Protocol ap1.0: Alice says “I am Alice” Failure scenario?? “I am Alice”
Cryptography and Network Security (CS435) Part Nine (Message Authentication)
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.
Cryptographic Hash Functions
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.
11.1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 11 Message Integrity and Message Authentication.
IT 221: Introduction to Information Security Principles Lecture 5: Message Authentications, Hash Functions and Hash/Mac Algorithms For Educational Purposes.
Message Authentication Codes CSCI 5857: Encoding and Encryption.
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.
Message Integrity and Message Authentication
Hash Function Requirements
Cipher-Based MAC Network Security.
Presentation transcript:

1 Chapter 5 Hashes and Message Digests Instructor: 孫宏民 Room: EECS 6402, Tel: , Fax :

2 Introduction A hash (also known as a message digest) is a one-way function. It is considered a one-way because it’s not practical to figure out what input corresponds to a given output. We will use the term hash and message digest interchangeably. The NIST message digest function is called SHA-1, which stands for secure hash algorithm, whereas the MD in the MD2,MD4,MD5 algorithm stands for message digest.

3 There certainly will be many message that yield the same message digest, because a message can be of arbitrary length and the message digest will be fixed length, for instance 128bits. By trying lots of messages, one would eventually find two that mapped to the same message digest. The problem is that “lots” is so many that it is essentially impossible.

4 Assume a good 128-bit message digest function, it would take trying approximately 2 64 message before finding two that had the same digest. (see the birthday problem) An example use of a message digest is to fingerprint a program or document to detect modification of it.

5 The Birthday Problem If there are 23 or more people in a room, the odds are better than 50% that two of them will have the same birthday. Let’s assume n inputs and k possible outputs, and an unpredictable mapping from input to output. With n inputs, there are n(n-1)/2 pairs of inputs. For each pair there’s a probability of 1/k of both input s producing the same output value, so need about k/2 pairs in order for the probability 50%.

6 So n(n-1)>k that means if n is greater than, there‘s good chance of finding a matching pair.

7 How many bits does the output of a message digest function have to be in order to prevent someone from being able to find two message with the same message digest. –If the message digest has m bits, then it would take only about 2 m/2 message, chosen at random, before one would find two with the same value. –That is why message digest function have outputs of at least 128 bits, because it is no considered feasible to search 2 64 message given the current state of the art.

8 Nifty Thing to Do with a Hash The significant difference between a secret key algorithm and a message digest algorithm is that a secret key algorithm is designed to be reversible and a message digest algorithm is designed to be impossible to reverse. In this section we’ll use MD as a “generic” message digest algorithm.

9 Authentication

10 Computing a MAC with a Hash The obvious thought is that MD(m) is a MAC for message m. But it isn’t. anyone can compute MD(m). We concatenate a shared secret K AB with the message m, and use MD(K AB |m) as the MAC. Some proposals with no known weaknesses are: –Put the secret at the end of the message instead of at the beginning. –Use only half the bits of the message digest as the MAC

11 –Concatenate the secret to both the front and the back of the message. We call any hash combining the secret key and the data a keyed hash.

12 Encryption with a Message Digest Generating a one-time pad –Just as OFB generates a pseudorandom bit stream which then encrypts a message by simply being ⊕ed with the message, we can use a message digest algorithm to generate a pseudorandom bit stream.

13 K AB MD M1M1 ⊕ C1C1 K AB MD ⊕ K AB MD M2M2 C2C2 ⊕ M3M3 C3C3 Alice and Bob share a secure key K AB

14 It is not secure to use the same bit stream twice, so, as with OFB, Alice starts with an IV. The first block is than MD(K AB |IV).

15 Mixing in the Plaintext –Similar to CFB. K AB MD M1M1 ⊕ C1C1 K AB MD ⊕ K AB MD M2M2 C2C2 ⊕ M3M3 C3C3 IV

16 Using Secret Key for a Hash What we want to generate is a function with the properties of a hash algorithm. It should not require a secret. It should be publishable. It should be noninvertible. Unix password hash ……… password bits ASCII 56bits key DES Plaintext:0Hashed password

17 Hashing large messages

18 There is a serious problem with this, which is that the typical message block length b is 64 bits, which is too short to use as a message digest. If we want to find a message with a particular message digest, a technique similar to the one in sector could find a message with a particular 64-bit message digest in about 2 33 iteration.

19

20 MD2 MD2 takes a message equal to an arbitrary number of octets and produces a 128-bit message digest. The basic idea behind MD2is as follows: –The input message to MD2 is an arbitrary length. –The message is padded to be multiple of 16 octets. –A 16-octets quantity, which MD2 calls checksum, is appended to the end. –Final pass: the message is processed, 16 octets at a time, each time producing an intermediate result for message digest.

21 MD2 Padding

22 MD2 Checksum Computation

23

24 MD2 Final Pass

25 MD4 The message to be fed into the message digest computation must be a multiple of 512 bits (sixteen 32-bit words)

26 Overview of MD4 Message Digest Computation

27 Each stage stars with a 16-word message block and a 4-word message digest value. message called : message digest : The message digest initialized to : Equivalent to the octet string

28 The following operations we are able to use:

29 MD4 Message Digest Pass 1 A function F(x,y,z) is defined as (x ⋀ y) ⋁(∼x⋀z). This function is sometimes known as the selection function A separate setp is done for each of the 16 words of the message. For each I from 0 through 15.

30

31 MD4 Message Digest Pass 2

32

33 MD4 Message Digest Pass 3

34

35 MD5 The major differences are: –MD4 make three passes over each 16-octet chunk of the message. MD5 makes four passes over each 16- octet chunk. –The functions are slightly, as are the number of its in the shifts. –MD4 has one constant which is used for each message word in pass 2, and a different constant in pass 3. no constant is used in pass 1. MD5 using bit constant.

36

37 MD5 Message Padding

38 Overview of MD5 Message Digest Computation

39 Each stage stars with a 16-word message block and a 4-word message digest value. message called : message digest : The message digest initialized to : Equivalent to the octet string

40 MD5 Message Digest Pass 1 A function F(x,y,z) is defined as (x ⋀ y) ⋁(∼x⋀z). This function is sometimes known as the selection function A separate setp is done for each of the 16 words of the message. For each I from 0 through 15.

41

42 MD5 Message Digest Pass 2

43

44 MD5 Message Digest Pass 3

45

46 MD5 Message Digest Pass 4

47

48 SHA-1 SHA-1 (secure hash algorithm) was proposed by NIST as a message digest function, and takes a message of length at most 2 64 bits and produces a 160-bit output. Message padding –SHA-1 pads messages in the same manner as MD4 and MD5, except that SHA-1 is not defined for a message is longer than 2 64 bits.

49 SHA-1 message padding

50 Overview of SHA-1 Message Digest Computation

51 The 160-bit message digest consists of five 32- bit words. Let’s call them A,B,C,D, and E. The message digest is initialize as

52 SHA-1 Operation on a 512-bit Block

53

54

55 HMAC HMAC result from an effect to find a MAC algorithm that could be proven to be secure if the underlying message digest’s compression function was secure. They defined secure as having two properties: –Collision resistance –An attacker doesn’t know the key K cannot compute the proper digest(K,x) for data x, even if the attacker can see the value of digest(K,y), for arbitrary numbers of inputs y, with y no equal to x.

56