45
Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Embed Size (px)

Citation preview

Page 1: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Computer Security

Lecture 6Ch.11

Cryptographic Hash FunctionsPrepared by Dr. Lamiaa Elshenawy

Page 2: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash Functions

• Applications of Cryptographic Hash Functions Message Authentication Digital Signatures Other Applications• Two Simple Hash Functions• Requirements and Security Security Requirements for Cryptographic Hash Functions Brute-Force Attacks Cryptanalysis• Hash Functions Based on Cipher Block Chaining• Secure Hash Algorithm (SHA) SHA-512 Logic SHA-512 Round Function• 11.6 SHA-3

Page 3: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsKey Points

• Hash function Variable-length message Fixed-length message digest

• Cryptographic hash functions iterative use of a compression function

• Compression function

Specific function (SHA)

Symmetric block cipher (Whirlpool)

Page 4: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash Functions

• Hash function Computationally infeasible

One-way property Collision-free property

H“Hash function”M H(M)

Data Integrity

Page 5: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsBlock diagram

Page 6: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsApplications

1. Message Authentication2. Digital Signatures3. Other Applications (Internet protocols)

Page 7: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsMessage Authentication

• Message authentication Mechanism or service used to verify the integrity of a message.

No modificationNo insertionNo deletionNo replay

Page 8: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsMessage Authentication

Confidentiality

No Confidentiality

Page 9: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsMessage Authentication

Confidentiality

Page 10: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsMessage Authentication

• No confidentiality: method (b) has an advantage over methods (a) and (d)

less computation

• Avoid encryption method (c)

Encryption software relatively slow Encryption hardware high cost Time high Encryption algorithms patents cost

Page 11: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsMessage Authentication

M: variable-length message K: secret key KOutput: fixed-size

MAC: message authentication code (keyed hash function)

Page 12: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsDigital Signatures

Public key

H“Hash

function”M H(M)

Encryption algorithm

Private key

Page 13: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsDigital Signatures

Page 14: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsDigital Signatures

• Digital signature private-key-encrypted hash code authentication (only the sender could have produced the encrypted hash code, essence of the digital signature technique)

• Confidentiality + Digital signature message + private-key-encrypted hash codeencrypted using a symmetric secret key

Page 15: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsDigital Signatures

Page 16: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsOther Applications

1. One-way password file2. Intrusion detection3. Virus detection4. Pseudorandom function(PRF) or a

Pseudorandom number generator (PRNG).

Page 17: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsPassword

Page 18: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsTwo Simple Hash Functions

1. Bit-by-Bit exclusive-OR (XOR) of every block

Page 19: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsTwo Simple Hash Functions

2. Rotated exclusive-OR (XOR) of every blocki. Initially set the -bit hash value to zero.ii. Process each successive -bit block of data as

follows: a. Rotate the current hash value to the left by one bit. b. XOR the block into the hash value.

Page 20: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsRequirements and Security

Page 21: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsSecond Preimage Resistant

Page 22: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsSecond Preimage Resistant

Page 23: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsRequirements and Security

1. Brute-force attacks bit length (hash value)

2. Cryptanalysis weaknesses in cryptographic algorithm

Page 24: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsBrute-Force Attacks

• Preimage and second preimage attacks

y H(y)=h

• Collision resistant attacks

y H(y)

Birthday paradox

Page 25: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsBrute-Force Attacks

m: number of hash value bits

Page 26: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsCryptanalysis

Merkle–Damgård hash function

Page 27: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsCryptanalysis

Page 28: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsSecure Hash Algorithm(SHA)

• National Institute of Standards and Technology (NIST)- Federal information processing standard (FIPS 180)-1993

SHA-0 (1993)SHA-1 (1995)SHA-256SHA-384 (2002)SHA-512

Page 29: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsSecure Hash Algorithm(SHA)

Page 30: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsSHA-512 Logic

Page 31: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsSHA-512 Logic

1. Append padding bits (length896 mod 1024)2. Append length (128 bits=16 bytes)3. Initialize hash buffer

4. Process message in 1024-bit blocks5. Output 80

rounds

Page 32: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy
Page 33: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsSHA-512 Logic

Page 34: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsSHA-512 Logic

• Let 32 bit quantity 90AB12CD16

• 4 bytes are: 90, AB, 12, CD • Two ways to store in memory

Address Value

1000 90 1001 AB 1002 12 1003 CD

Address Value

1000 CD 1001 12 1002 AB 1003 90

Big -endian

Little -endian

Page 35: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsSHA-512 Round Function

Page 36: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsSHA-512 Round Function

Page 37: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsSHA-512 Round Function

Page 38: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsSHA-512 Round Function

Page 39: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsSHA-3

• SHA-1& SHA-2 Not broken • NIST competition (2007) SHA-3Replace SHA-2 with SHA-3 in any application by

a simple drop-in substitution.Preserve online nature (SHA-2) small

blocks (no buffer-entire message)

Page 40: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Example

M=“abc”

ASCII code

Padding bits=896-24=871

Length=24 bits=18 hexadecimal

1024-bit massage

Page 41: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsExample

Page 42: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Cryptographic Hash FunctionsExample

After two rounds

Page 43: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Example

After 80 rounds

Hash value

Page 44: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Example

512-bit message digest Finally

Page 45: Computer Security Lecture 6 Ch.11 Cryptographic Hash Functions Prepared by Dr. Lamiaa Elshenawy

Thank you for your attention