PIITMadhumita Chatterjee Security 1 Hashes and Message Digests.

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.
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.
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.
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
Secure Hashing and DSS Sultan Almuhammadi ICS 454 Principles of Cryptography.
Cryptography and Network Security Chapter 11 Fourth Edition by William Stallings.
1 Pertemuan 09 Hash and Message Digest Matakuliah: H0242 / Keamanan Jaringan Tahun: 2006 Versi: 1.
CSCE 790: Computer Network Security Chin-Tser Huang University of South Carolina.
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
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.
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.
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.
Cryptography and Network Security Chapter 11 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
HASH Functions.
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.
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
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.
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.
Hash and MAC Functions CS427 – Computer Security
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
1 Network Security Lecture 5 Hashes and Message Digests Waleed Ejaz
Cryptographic Hash Functions
Chapter 4 Message Authentication MSc. NGUYEN CAO DAT Dr. TRAN VAN HOAI 1.
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.
Hash Algorithms see similarities in the evolution of hash functions & block ciphers –increasing power of brute-force attacks –leading to evolution in algorithms.
Cryptographic Hash Functions and Protocol Analysis
Chapter 11 Message Authentication and Hash Functions.
Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy
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.
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
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.
CS480 Cryptography and Information Security Huiping Guo Department of Computer Science California State University, Los Angeles 13.Message Authentication.
Information and Network Security Dr. Hadi AL Saadi Message Authentication and Hash Functions.
Chapter 12 – Hash Algorithms
ICS 454 Principles of Cryptography
ICS 454 Principles of Cryptography
Presentation transcript:

PIITMadhumita Chatterjee Security 1 Hashes and Message Digests

PIITMadhumita Chatterjee Security 2 Hashes 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 m 1, m 2, where d 1 =d 2

A hash function condenses arbitrary message to fixed size h = H(M) hash used to detect changes to message can be used in various ways with message most often to create a digital signature PIITMadhumita Chatterjee Security 3

Cryptographic hash must provide the following Compression – for any size of input x, y =h(x) must be small. Output must be fixed size Efficiency- given x, it must be easy to compute h(x). One-way: Given any valye y, it is computationally infeasible to find a valye x s.t h(x) = y PIITMadhumita Chatterjee Security 4

Hash functions and Digital Signature PIITMadhumita Chatterjee Security 5

Requirements for Hash Functions 1.can be applied to any size message M 2.produces a fixed-length output h 3.is easy to compute h=H(M) for any message M PIITMadhumita Chatterjee Security 6

Properties of Hash functions 1.given h is infeasible to find x s.t. H(x)=h one-way property 2.given x is infeasible to find y s.t. H(y)=H(x) weak collision resistance 3.is infeasible to find any x,y s.t. H(y)=H(x) strong collision resistance PIITMadhumita Chatterjee Security 7

PIITMadhumita Chatterjee Security 8 Hashes…… Arbitrary-length message to fixed- length digest Randomness –any bit in the outputs ‘1’ half the time –each output: 50% ‘1’ bits

Simple Hash Functions based on XOR of message blocks -divide the message into equal size blocks -perform XOR operation block by block -final output is the hash not very secure need a stronger cryptographic function PIITMadhumita Chatterjee Security 9

Block Ciphers as Hash Functions can use block ciphers as hash functions –using H 0 =0 and zero-pad of final block –compute: H i = E M i [H i-1 ] –and use final block as the hash value –similar to CBC but without a key resulting hash is too small (64-bit) –Vulnerable to attacks PIITMadhumita Chatterjee Security 10

PIITMadhumita Chatterjee Security 11 Birthday Problem Compute probability of different birthdays Random sample of n people (birthdays) taken from k (365) days k n samples with replacement (k) n =k(k-1)…(k-n+1) sample without replacement Probability of no repetition: –p = (k) n /k n  1 - n(n-1)/2k

PIITMadhumita Chatterjee Security 12

PIITMadhumita Chatterjee Security 13 How Many Bits for Hash? m bits, takes 2 m/2 to find two with the same hash 64 bits, takes 2 32 messages to search (doable) Need at least 128 bits

PIITMadhumita Chatterjee Security 14 Using Hash for Authentication Alice to Bob: challenge r A Bob to Alice: MD(K AB |r A ) Bob to Alice: r B Alice to Bob: MD(K AB |r B ) Only need to compare MD results

PIITMadhumita Chatterjee Security 15 Using Hash to Encrypt One-time pad: –compute bit streams using MD, K, and IV b 1 =MD(K AB |IV), b i =MD(K AB |b i-1 ), … –  with message blocks Or mixing in the plaintext –similar to cipher feedback mode (CFB) b 1 =MD(K AB |IV), c 1 = p 1  b 1 b 2 =MD(K AB | c 1 ), c 2 = p 2  b 2

PIITMadhumita Chatterjee Security 16 Using Secret Key for a Hash Unix password algorithm: –Compute hash of user password, store the hash (not the password), and compare the hash of user-input password. First 8 bytes of password used to form a secret key. Encrypt 0 with a DES-like algorithm (why not use a “system” key to encrypt the password?).

PIITMadhumita Chatterjee Security 17 –Salt: 12-bit random number formed from time and process ID. Determine bits to duplicate in the mangler when expanding from 32 to 48 bits. Salt stored with hashed result.

PIITMadhumita Chatterjee Security 18 MD2 128-bit message digest: –Arbitrary number of bytes of message –First pad to multiple of 16 bytes –Append MD2 checksum (16 bytes) to the end The checksum is almost a MD, but not cryptographically secure by itself. –Process whole message

PIITMadhumita Chatterjee Security 19 MD2 Checksum One byte at a time, k  16 steps m nk : byte nk of message c n =  (m nk  c n-1 )  c n  : 0  41, 1  46, … –Substitution on (value of the byte)

PIITMadhumita Chatterjee Security 20 MD2 Final Pass Operate on 16-byte chunks 48-byte quantity q: –(current digest|chunk|digest  chunk) 18 passes of massaging over q, and one byte at a time: –c n =  (c n-1 )  c n for n = 0, … 47; c -1 = 0 for pass 0; c -1 = (c 47 + pass #) mod 256 After pass 17, use first 16 bytes as new digest –16  8 = 128

PIITMadhumita Chatterjee Security 21 MD5: Message Digest Version 5 input Message Output 128 bits Digest

PIITMadhumita Chatterjee Security 22 MD5 Box Initial 128-bit vector 512-bit message chunks (16 words) 128-bit result F: (x  y)  (~x  z) G:(x  z)  (y  ~ z) H:x  y  z I: y  (x  ~z) +: binary sum x  y: x left rotate y bits

PIITMadhumita Chatterjee Security 23 MD5: Padding input Message Output 128 bits Digest Padding 512 bit block Initial Value Final Output MD5 Transformation block by block

PIITMadhumita Chatterjee Security 24 Padding Twist Given original message M, add padding bits “10 * ” such that resulting length is 64 bits less than a multiple of 512 bits. Append (original length in bits mod 2 64 ), represented in 64 bits to the padded message Final message is chopped 512 bits a block

PIITMadhumita Chatterjee Security 25 MD5 Process As many stages as the number of 512-bit blocks in the final padded message Digest: 4 32-bit words: MD=A|B|C|D Every message block contains bit words: m 0 |m 1 |m 2 …|m 15 –Digest MD 0 initialized to: A= ,B=89abcdef,C=fedcba98, D= –Every stage consists of 4 passes over the message block, each modifying MD

PIITMadhumita Chatterjee Security 26 MD5 Blocks MD5 512: B 1 512: B 2 512: B 3 512: B 4 Result

PIITMadhumita Chatterjee Security 27 Processing of Block m i - 4 Passes ABCD=f F (ABCD,m i,T[1..16]) ABCD=f G (ABCD,m i,T[17..32]) ABCD=f H (ABCD,m i,T[33..48]) ABCD=f I (ABCD,m i,T[49..64]) mimi ++++ A B CD MD i MD i+1

PIITMadhumita Chatterjee Security 28 Different Passes... Different functions and constants are used Different set of m i is used Different set of shift amount is used

PIITMadhumita Chatterjee Security 29 Functions and Random Numbers F(x,y,z) == (x  y)  (~x  z) –selection function G(x,y,z) == (x  z)  (y  ~ z) H(x,y,z) == x  y  z I(x,y,z) == y  (x  ~z) T i = int(2 32 * abs(sin(i))), 0<i<65

PIITMadhumita Chatterjee Security 30 Secure Hash Algorithm Developed by NIST, specified in the Secure Hash Standard (SHS, FIPS Pub 180), 1993 SHA is specified as the hash algorithm in the Digital Signature Standard (DSS), NIST

PIITMadhumita Chatterjee Security 31 General Logic Input message must be < 2 64 bits –not really a problem Message is processed in 512-bit blocks sequentially Message digest is 160 bits SHA design is similar to MD5, but a lot stronger

PIITMadhumita Chatterjee Security 32 Basic Steps Step1: Padding Step2: Appending length as 64 bit unsigned Step3: Initialize MD buffer 5 32-bit words A|B|C|D|E A = B = efcdab89 C = 98badcfe D = E = c3d2e1f0

PIITMadhumita Chatterjee Security 33 Basic Steps... Step 4: the 80-step processing of 512-bit blocks – 4 rounds, 20 steps each. Each step t (0 <= t <= 79): –Input: W t – a 32-bit word from the message K t – a constant. ABCDE: current MD. –Output: ABCDE: new MD.

PIITMadhumita Chatterjee Security 34 Basic Steps... Only 4 per-round distinctive additive constants 0 <=t<= 19 K t = 5A <=t<=39 K t = 6ED9EBA1 40<=t<=59 K t = 8F1BBCDC 60<=t<=79 K t = CA62C1D6

PIITMadhumita Chatterjee Security 35 Basic Steps - The Heart Of The Matter AEBCD AEBCD ftftftft CLS30 CLS5 WtWtWtWt KtKtKtKt

PIITMadhumita Chatterjee Security 36 Basic Logic Functions Only 3 different functions RoundFunction f t (B,C,D) 0 <=t<= 19(B  C)  (~B  D) 20<=t<=39 B  C  D 40<=t<=59 (B  C)  (B  D)  (C  D) 60<=t<=79 B  C  D

PIITMadhumita Chatterjee Security 37 Twist With W t ’s Additional mixing used with input message 512-bit block W 0 |W 1 |…|W 15 = m 0 |m 1 |m 2 …|m 15 For 15 < t <80: W t = W t-16  W t-14  W t-8  W t-3 XOR is a very efficient operation, but with multilevel shifting, it should produce very extensive and random mixing!

PIITMadhumita Chatterjee Security 38 SHA Versus MD5 SHA is a stronger algorithm: –Brute-force birthday attacks requires on the order of 2 80 operations vs for MD5 SHA’s 80 steps and 160 bits hash (vs. 128) requires a little more computation