SlideShare a Scribd company logo
1 of 32
Download to read offline
Understanding Cryptography – A Textbook for
Students and Practitioners
by Christof Paar and JanPelzl
www.crypto-textbook.com
Chapter 11 – Hash Functions
ver. October 29, 2009
These slides were prepared by Stefan Heyse and Christof Paar and Jan Pelzl
And modified by Sam Bowne
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl2
Some legal stuff (sorry): Terms of Use
• The slides can used free of charge. All copyrights for the slides remain with
Christof Paar and Jan Pelzl.
• The title of the accompanying book “Understanding Cryptography” by
Springer and the author’s names must remain on eachslide.
• If the slides are modified, appropriate credits to the book authorsand the
book title must remain within the slides.
• It is not permitted to reproduce parts or all of the slides in printed form
whatsoever without written consent by the authors.
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl3
Contents of this Chapter
11.1 Motivation: Signing Long Messages
11.2 Security Requirements of Hash Functions
11.3 Overview of Hash Algorithms
11.4 The Secure Hash Algorithm SHA-1
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl4
11.1 Motivation: Signing Long Messages
• Three Problems
• Computational overhead
• Message overhead
• Security limitations
• Attacker could re-order or re-use signed blocks
Solution:
Instead of signing the whole message, sign only a digest (=hash)
Also secure, but much faster
Needed:
Hash Functions
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl
Motivation
Problem:
Naive signing of long messages generates a signature of same length.
5
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl
Solution
6
• Hash, then sign
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl
Principal input–output behavior of hash functions
7
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl8
11.2 Security Requirements of Hash Functions
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl
The three security properties of hash functions
9
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl10
Hash Functions: Security Properties
• Preimage resistance: For a given output z, it is impossible to
findany input x such that h(x) = z, i.e., h(x) is one-way

(Also called one-wayness)
• Second preimage resistance: Given x1, and thus h(x1), it is
computationally infeasible to find any x2 such that h(x1) =h(x2)

(Also called weak collision resistance)
• Collision resistance: It is computationally infeasible to find
anypairs x1 ≠ x2 such that h(x1) =h(x2)

(Also called strong collision resistance)
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl11
Hash Functions: Security
• Collison resistance causes most problems
• How hard is it to find a collision with a probability of 0.5 ?
• Related Problem: How many people are needed such that two
of them have the same birthday with a probability of 0.5 ?
• No! Not 365/2=183
• 23 are enough ! This is called the birthday paradox (Search
takes ≈√2n steps)
• To deal with this paradox, hash functions need a output size of
at least 160 bits
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl12
Hash Functions: Security
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl13
11.3 Overview of Hash Algorithms
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl
• MD4 family
• SHA-1: output - 160 Bit; input - 512 bit chunks of message x;

operations - bitwise AND, OR, XOR, complement and cyclic shifts.
• RIPE-MD 160: output - 160 Bit; input - 512 bit chunks of message
x; operations – like in SHA-1, but two in parallel and combinations
of them after each round.
Hash Functions: Algorithms
Hash Algorithms
based on
block ciphers
SpecialAlgorithms,
e.g. MD4 family
14
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl
• Matyas-Meyer-Oseas hash
function
• Break original file into
blocks
• Start with known public
block H0, which may be all
zeroes
• Encrypt a block using
previous H as the key, then
XOR with next block of file
data to form the new H
• Repeat through whole file
Hash Functions from Block Ciphers
15
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl
Other Hash Functions from Block Ciphers
16
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl17
11.4 The Secure Hash Algorithm SHA-1
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl18
SHA-1
•Part of the MD-4 family.
•Based on a Merkle-Dåmgard construction
•Similar to a Feistel block cipher
•160-bit output from a message of maximum length
264 bit.
•Widely used ( even tough some weaknesses are
known)
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl19
How Big is 2**60 bits?
•2**10 = 1024 = 1Kb
•2**20 = 1Mb
•2**30 = 1Gb
•2**40 = 1 Tb
•2**60 = 1 million Tb
•2**63 = 1 million TB
•2**54 = 2 million TB
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl
SHA-1 High Level Diagram
20
Compression
Function
consists of 80
rounds which
are divided
into four
stages of 20
rounds each
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl
SHA-1: Padding
• Message x has to be padded to fit a size of a multiple of
512 bits
• Add k zero bits
• k = 512 − 64 − 1 − l = 448 − (l + 1) mod512
21
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl
SHA-1: Padding Example
• Message is abc

24 bits long

k = 512 − 64 − 1 − 24 = 423
22
64 bits long
Value = 24 in binary
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl23
SHA-1: Hash Computation
• Each message block xi is processed in four stages with 20 rounds each
SHA-1 uses:
• A message schedule which computes a 32-bit word W0, W1, ..., W79
foreach of the 80 rounds
• Five working registers of size of 32 bits A,B,C,D,E
• A hash value Hi consisting of five 32-bit words Hi
(0), Hi
(1), Hi
(2) , Hi
(3), Hi
(4)
• In the beginning, the hash value holds the initial value H0, which is
replaced by a new hash value after the processing of each single
messageblock.
• The final hash value Hn is equal to the output h(x) of SHA-1.
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl24
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl
SHA-1: All four stages
25
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl
SHA-1:
Internals of
a Round
Stage t Round j Constant Kt Function ft
1 00…19 5A827999 (B∧C)∨(¯ B∧D)
2 20…39 6ED9EBA1 B⊕C⊕D
3 40…59 8F1BBCDC (B⊕C)∨(B⊕D)∨(C⊕D)
4 60…79 CA62C1D6 B⊕C⊕D
AND
OR
NOT
XOR
SHA-1 Collision Found
• Collision found on Feb. 23, 2017
• Links Ch 12-2017-1, 2, and 3 in CNIT 123
28
29
Browsers Deprecated SHA-1
• Link Ch 12zr in CNIT 123
Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl31
■ Lessons Learned: Hash-Functions
• Hash functions are keyless. The two most important applications of hash
functions are their use in digital signatures and in message authentication
codes such as HMAC.
• The three security requirements for hash functions are one-wayness,
second preimage resistance and collisionresistance.
• Hash functions should have at least 160-bit output length in order to
withstand collision attacks; 256 bit or more is desirable for long-term
security.
• MD5, which was widely used, is insecure. Serious security weaknesses
have been found in SHA-1, and the hash function should be phased out.
The SHA-2 algorithms all appear to be secure.
• The ongoing SHA-3 competition will result in new standardized hash
functions in a few years.
CNIT 141: 11. Hash Functions

More Related Content

What's hot

Etude et implémentation de quelle que
Etude et implémentation de quelle que Etude et implémentation de quelle que
Etude et implémentation de quelle que
Yassine Nasser
 

What's hot (20)

Post quantum cryptography
Post quantum cryptographyPost quantum cryptography
Post quantum cryptography
 
2. Stream Ciphers
2. Stream Ciphers2. Stream Ciphers
2. Stream Ciphers
 
Idea(international data encryption algorithm)
Idea(international data encryption algorithm)Idea(international data encryption algorithm)
Idea(international data encryption algorithm)
 
Chacha ppt
Chacha pptChacha ppt
Chacha ppt
 
Two fish cipher
Two fish cipherTwo fish cipher
Two fish cipher
 
Des lecture
Des lectureDes lecture
Des lecture
 
AES.pptx
AES.pptxAES.pptx
AES.pptx
 
Emily Stamm - Post-Quantum Cryptography
Emily Stamm - Post-Quantum CryptographyEmily Stamm - Post-Quantum Cryptography
Emily Stamm - Post-Quantum Cryptography
 
DES (Data Encryption Standard) pressentation
DES (Data Encryption Standard) pressentationDES (Data Encryption Standard) pressentation
DES (Data Encryption Standard) pressentation
 
Internet Key Exchange (ikev2) Protocol
Internet Key Exchange (ikev2) ProtocolInternet Key Exchange (ikev2) Protocol
Internet Key Exchange (ikev2) Protocol
 
Cryptography
CryptographyCryptography
Cryptography
 
Block ciphers & public key cryptography
Block ciphers & public key cryptographyBlock ciphers & public key cryptography
Block ciphers & public key cryptography
 
Applied Cryptography
Applied CryptographyApplied Cryptography
Applied Cryptography
 
Overview on Cryptography and Network Security
Overview on Cryptography and Network SecurityOverview on Cryptography and Network Security
Overview on Cryptography and Network Security
 
Ecc2
Ecc2Ecc2
Ecc2
 
Etude et implémentation de quelle que
Etude et implémentation de quelle que Etude et implémentation de quelle que
Etude et implémentation de quelle que
 
Examen principal - Algorithme & Structures de données
Examen principal - Algorithme & Structures de donnéesExamen principal - Algorithme & Structures de données
Examen principal - Algorithme & Structures de données
 
SéCurité Fonctions Chaotiques
SéCurité Fonctions ChaotiquesSéCurité Fonctions Chaotiques
SéCurité Fonctions Chaotiques
 
Aes
AesAes
Aes
 
I2C-Bus Design and Verification Specs
I2C-Bus Design and Verification SpecsI2C-Bus Design and Verification Specs
I2C-Bus Design and Verification Specs
 

Similar to CNIT 141: 11. Hash Functions

Crypto theory practice
Crypto theory practiceCrypto theory practice
Crypto theory practice
Fraboni Ec
 
Crypto theory to practice
Crypto theory to practiceCrypto theory to practice
Crypto theory to practice
Luis Goldster
 
Crypto theory practice
Crypto theory practiceCrypto theory practice
Crypto theory practice
James Wong
 
Crypto theory to practice
Crypto theory to practiceCrypto theory to practice
Crypto theory to practice
Tony Nguyen
 
Crypto theory to practice
Crypto theory to practiceCrypto theory to practice
Crypto theory to practice
David Hoen
 
Crypto theory practice
Crypto theory practiceCrypto theory practice
Crypto theory practice
Young Alista
 
cryptography and network security chap 3
cryptography and network security chap 3cryptography and network security chap 3
cryptography and network security chap 3
Debanjan Bhattacharya
 
Ch03 block-cipher-and-data-encryption-standard
Ch03 block-cipher-and-data-encryption-standardCh03 block-cipher-and-data-encryption-standard
Ch03 block-cipher-and-data-encryption-standard
tarekiceiuk
 

Similar to CNIT 141: 11. Hash Functions (20)

Introduction to Cryptography Parts II and III
Introduction to Cryptography Parts II and IIIIntroduction to Cryptography Parts II and III
Introduction to Cryptography Parts II and III
 
Crypto-Presentation jfjfd dkfdnfdj kdfjdjfdjkfd .pptx
Crypto-Presentation jfjfd dkfdnfdj kdfjdjfdjkfd .pptxCrypto-Presentation jfjfd dkfdnfdj kdfjdjfdjkfd .pptx
Crypto-Presentation jfjfd dkfdnfdj kdfjdjfdjkfd .pptx
 
Crypto theory practice
Crypto theory practiceCrypto theory practice
Crypto theory practice
 
Crypto theory to practice
Crypto theory to practiceCrypto theory to practice
Crypto theory to practice
 
Crypto theory practice
Crypto theory practiceCrypto theory practice
Crypto theory practice
 
Crypto theory to practice
Crypto theory to practiceCrypto theory to practice
Crypto theory to practice
 
Crypto theory to practice
Crypto theory to practiceCrypto theory to practice
Crypto theory to practice
 
Crypto theory to practice
Crypto theory to practiceCrypto theory to practice
Crypto theory to practice
 
Crypto theory practice
Crypto theory practiceCrypto theory practice
Crypto theory practice
 
Cryptography and Network Security William Stallings Lawrie Brown
Cryptography and Network Security William Stallings Lawrie BrownCryptography and Network Security William Stallings Lawrie Brown
Cryptography and Network Security William Stallings Lawrie Brown
 
cryptography and network security chap 3
cryptography and network security chap 3cryptography and network security chap 3
cryptography and network security chap 3
 
DES-lecture (1).ppt
DES-lecture (1).pptDES-lecture (1).ppt
DES-lecture (1).ppt
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Ch03
Ch03Ch03
Ch03
 
block ciphers
block ciphersblock ciphers
block ciphers
 
SymmetricCryptography-Part3 - Tagged.pdf
SymmetricCryptography-Part3 - Tagged.pdfSymmetricCryptography-Part3 - Tagged.pdf
SymmetricCryptography-Part3 - Tagged.pdf
 
public-key cryptography Shamir
public-key cryptography Shamirpublic-key cryptography Shamir
public-key cryptography Shamir
 
Ch03 block-cipher-and-data-encryption-standard
Ch03 block-cipher-and-data-encryption-standardCh03 block-cipher-and-data-encryption-standard
Ch03 block-cipher-and-data-encryption-standard
 
Everything I always wanted to know about crypto, but never thought I'd unders...
Everything I always wanted to know about crypto, but never thought I'd unders...Everything I always wanted to know about crypto, but never thought I'd unders...
Everything I always wanted to know about crypto, but never thought I'd unders...
 
Cryptography-101
Cryptography-101Cryptography-101
Cryptography-101
 

More from Sam Bowne

More from Sam Bowne (20)

Cyberwar
CyberwarCyberwar
Cyberwar
 
3: DNS vulnerabilities
3: DNS vulnerabilities 3: DNS vulnerabilities
3: DNS vulnerabilities
 
8. Software Development Security
8. Software Development Security8. Software Development Security
8. Software Development Security
 
4 Mapping the Application
4 Mapping the Application4 Mapping the Application
4 Mapping the Application
 
3. Attacking iOS Applications (Part 2)
 3. Attacking iOS Applications (Part 2) 3. Attacking iOS Applications (Part 2)
3. Attacking iOS Applications (Part 2)
 
12 Elliptic Curves
12 Elliptic Curves12 Elliptic Curves
12 Elliptic Curves
 
11. Diffie-Hellman
11. Diffie-Hellman11. Diffie-Hellman
11. Diffie-Hellman
 
2a Analyzing iOS Apps Part 1
2a Analyzing iOS Apps Part 12a Analyzing iOS Apps Part 1
2a Analyzing iOS Apps Part 1
 
9 Writing Secure Android Applications
9 Writing Secure Android Applications9 Writing Secure Android Applications
9 Writing Secure Android Applications
 
12 Investigating Windows Systems (Part 2 of 3)
12 Investigating Windows Systems (Part 2 of 3)12 Investigating Windows Systems (Part 2 of 3)
12 Investigating Windows Systems (Part 2 of 3)
 
10 RSA
10 RSA10 RSA
10 RSA
 
12 Investigating Windows Systems (Part 1 of 3
12 Investigating Windows Systems (Part 1 of 312 Investigating Windows Systems (Part 1 of 3
12 Investigating Windows Systems (Part 1 of 3
 
9. Hard Problems
9. Hard Problems9. Hard Problems
9. Hard Problems
 
8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)
 
11 Analysis Methodology
11 Analysis Methodology11 Analysis Methodology
11 Analysis Methodology
 
8. Authenticated Encryption
8. Authenticated Encryption8. Authenticated Encryption
8. Authenticated Encryption
 
7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)
 
7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)
 
5. Stream Ciphers
5. Stream Ciphers5. Stream Ciphers
5. Stream Ciphers
 
6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data Collection6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data Collection
 

Recently uploaded

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Recently uploaded (20)

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 

CNIT 141: 11. Hash Functions

  • 1. Understanding Cryptography – A Textbook for Students and Practitioners by Christof Paar and JanPelzl www.crypto-textbook.com Chapter 11 – Hash Functions ver. October 29, 2009 These slides were prepared by Stefan Heyse and Christof Paar and Jan Pelzl And modified by Sam Bowne
  • 2. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl2 Some legal stuff (sorry): Terms of Use • The slides can used free of charge. All copyrights for the slides remain with Christof Paar and Jan Pelzl. • The title of the accompanying book “Understanding Cryptography” by Springer and the author’s names must remain on eachslide. • If the slides are modified, appropriate credits to the book authorsand the book title must remain within the slides. • It is not permitted to reproduce parts or all of the slides in printed form whatsoever without written consent by the authors.
  • 3. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl3 Contents of this Chapter 11.1 Motivation: Signing Long Messages 11.2 Security Requirements of Hash Functions 11.3 Overview of Hash Algorithms 11.4 The Secure Hash Algorithm SHA-1
  • 4. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl4 11.1 Motivation: Signing Long Messages
  • 5. • Three Problems • Computational overhead • Message overhead • Security limitations • Attacker could re-order or re-use signed blocks Solution: Instead of signing the whole message, sign only a digest (=hash) Also secure, but much faster Needed: Hash Functions Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl Motivation Problem: Naive signing of long messages generates a signature of same length. 5
  • 6. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl Solution 6 • Hash, then sign
  • 7. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl Principal input–output behavior of hash functions 7
  • 8. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl8 11.2 Security Requirements of Hash Functions
  • 9. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl The three security properties of hash functions 9
  • 10. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl10 Hash Functions: Security Properties • Preimage resistance: For a given output z, it is impossible to findany input x such that h(x) = z, i.e., h(x) is one-way
 (Also called one-wayness) • Second preimage resistance: Given x1, and thus h(x1), it is computationally infeasible to find any x2 such that h(x1) =h(x2)
 (Also called weak collision resistance) • Collision resistance: It is computationally infeasible to find anypairs x1 ≠ x2 such that h(x1) =h(x2)
 (Also called strong collision resistance)
  • 11. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl11 Hash Functions: Security • Collison resistance causes most problems • How hard is it to find a collision with a probability of 0.5 ? • Related Problem: How many people are needed such that two of them have the same birthday with a probability of 0.5 ? • No! Not 365/2=183 • 23 are enough ! This is called the birthday paradox (Search takes ≈√2n steps) • To deal with this paradox, hash functions need a output size of at least 160 bits
  • 12. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl12 Hash Functions: Security
  • 13. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl13 11.3 Overview of Hash Algorithms
  • 14. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl • MD4 family • SHA-1: output - 160 Bit; input - 512 bit chunks of message x;
 operations - bitwise AND, OR, XOR, complement and cyclic shifts. • RIPE-MD 160: output - 160 Bit; input - 512 bit chunks of message x; operations – like in SHA-1, but two in parallel and combinations of them after each round. Hash Functions: Algorithms Hash Algorithms based on block ciphers SpecialAlgorithms, e.g. MD4 family 14
  • 15. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl • Matyas-Meyer-Oseas hash function • Break original file into blocks • Start with known public block H0, which may be all zeroes • Encrypt a block using previous H as the key, then XOR with next block of file data to form the new H • Repeat through whole file Hash Functions from Block Ciphers 15
  • 16. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl Other Hash Functions from Block Ciphers 16
  • 17. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl17 11.4 The Secure Hash Algorithm SHA-1
  • 18. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl18 SHA-1 •Part of the MD-4 family. •Based on a Merkle-Dåmgard construction •Similar to a Feistel block cipher •160-bit output from a message of maximum length 264 bit. •Widely used ( even tough some weaknesses are known)
  • 19. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl19 How Big is 2**60 bits? •2**10 = 1024 = 1Kb •2**20 = 1Mb •2**30 = 1Gb •2**40 = 1 Tb •2**60 = 1 million Tb •2**63 = 1 million TB •2**54 = 2 million TB
  • 20. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl SHA-1 High Level Diagram 20 Compression Function consists of 80 rounds which are divided into four stages of 20 rounds each
  • 21. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl SHA-1: Padding • Message x has to be padded to fit a size of a multiple of 512 bits • Add k zero bits • k = 512 − 64 − 1 − l = 448 − (l + 1) mod512 21
  • 22. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl SHA-1: Padding Example • Message is abc
 24 bits long
 k = 512 − 64 − 1 − 24 = 423 22 64 bits long Value = 24 in binary
  • 23. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl23 SHA-1: Hash Computation • Each message block xi is processed in four stages with 20 rounds each SHA-1 uses: • A message schedule which computes a 32-bit word W0, W1, ..., W79 foreach of the 80 rounds • Five working registers of size of 32 bits A,B,C,D,E • A hash value Hi consisting of five 32-bit words Hi (0), Hi (1), Hi (2) , Hi (3), Hi (4) • In the beginning, the hash value holds the initial value H0, which is replaced by a new hash value after the processing of each single messageblock. • The final hash value Hn is equal to the output h(x) of SHA-1.
  • 24. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl24
  • 25. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl SHA-1: All four stages 25
  • 26. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl SHA-1: Internals of a Round Stage t Round j Constant Kt Function ft 1 00…19 5A827999 (B∧C)∨(¯ B∧D) 2 20…39 6ED9EBA1 B⊕C⊕D 3 40…59 8F1BBCDC (B⊕C)∨(B⊕D)∨(C⊕D) 4 60…79 CA62C1D6 B⊕C⊕D AND OR NOT XOR
  • 27. SHA-1 Collision Found • Collision found on Feb. 23, 2017 • Links Ch 12-2017-1, 2, and 3 in CNIT 123
  • 28. 28
  • 29. 29
  • 30. Browsers Deprecated SHA-1 • Link Ch 12zr in CNIT 123
  • 31. Chapter 11 of Understanding Cryptography by Christof Paar and Jan Pelzl31 ■ Lessons Learned: Hash-Functions • Hash functions are keyless. The two most important applications of hash functions are their use in digital signatures and in message authentication codes such as HMAC. • The three security requirements for hash functions are one-wayness, second preimage resistance and collisionresistance. • Hash functions should have at least 160-bit output length in order to withstand collision attacks; 256 bit or more is desirable for long-term security. • MD5, which was widely used, is insecure. Serious security weaknesses have been found in SHA-1, and the hash function should be phased out. The SHA-2 algorithms all appear to be secure. • The ongoing SHA-3 competition will result in new standardized hash functions in a few years.