SlideShare a Scribd company logo
CNIT 141
Cryptography for Computer Networks
6. Hash Functions
Updated 10-1-2020
Topics
• Secure Hash Functions
• Building Hash Functions
• The SHA Family
• BLAKE2
• How Things Can Go Wrong
Use Cases of Hash
Functions
• Digital signatures
• Public-key encryption
• Message authentication
• Integrity verification
• Password storage
Fingerprinting
• Hash function creates a fixed-length "fingerprint"
• From input of any length
• Not encryption
• No key; cannot be reversed
Non-Cryptographic Hash
Functions
• Provide no security; easily fooled by crafted
input
• Used in hash tables
• To make table lookups faster
• To detect accidental errors
• Ex: CRC (Cyclic Redundancy Check)
• Used at layer 2 by Ethernet and Wi-Fi
Secure Hash Functions
Digital Signature
• Most common use case for hashing
• Message M hashed, then the hash is signed
• Hash is smaller so the signature computation is
faster
• But the hash function must be secure
Unpredictability
• Two different inputs must always have different
hashes
• Changing one bit in the input makes the hash
totally different
Non-Uniqueness
• Consider an input message 1024 bits long
• And a hash 256 bits long
• There are 21024 different messages
• But only are 2256 different hashes
• So many different messages have the same
hash
One-Wayness
• Hashing cannot be reversed
• An attacker cannot find M from H
• In principle, always true
• Many different messages have the same
hash
Preimage Resistance
• An attacker given H cannot find any M with
that hash
• This is preimage resistance
• Also called first preimage resistance
The Cost of Preimages
• Attacker hashes many messages
• Hunting for a match
• Will take 2N guesses for hash of length N bits
• For n = 256, that's forever
Second Preimage
• Given M1 and H1
• Attacker tries to find another message M2
• That hashes to the same H
• Essentially the same as first preimage resistance
• Unless the hash function has a certain type of
mathematical defect
• Like length extension attacks
Collision Resistance
• Every hash function has collisions
• Two messages with the same hash
• Because there are more possible messages
than hashes
• Pigeonhole principle
• If you have 10 holes and 11 pigeons, at least
one hole contains more than one pigeon
Collision Resistance
• Collisions should be hard to find
• In practice, impossible
Birthday Attack
• Get each person in a group to say the month
and day they were born
• With 23 people, the probability of two having
the same birthday is 51%
Finding Collisions
• If you search for collsions
• And have enough RAM to remember each
hash you calculate
• It only takes 2N/2 hashes to find a collision
• N is the number of bits in the hash
Naive Birthday Attack
• Requires 2N/2 calculations to create the list
• And 2N/2 units of storage to hold it
• Sorting the list takes even more calculations
MD5 Example
Preimage Attack
• MD5 is 128 bits long
• Given an MD5 hash, can we find an input with
that hash value?
• Calculating every possible hash (nearly) would
require 2128 calculations
• But we don't need to store them: we just
compare each one with the target
• How hard is that?
72 Bit Brute-Force
• RSA Security made several challenges to test
brute-force attacks
• Distributed.net has been attacking these
challenges since 1997
• Cracked a 56-bit key in 250 days in 1997
• Cracked a 64-bit key in 5 years in 2002
• 72-bit key attack is in progress
• So far they'te tested 5.6% of the keyspace
• It will take 127 years to test all keys
• Link Ch 6g
MD5 Preimage Attack
Safety Margin
• Max. computing available to any attacker is 296
calculations
• Preimage attack requires 2128 calculations
• Safety margin is 230 units of RAM
• 210 is 1024
• 230 is 1024 x 1024 x 1024 = 1 billion
Naive Birthday Attack on
MD5
• Take 264 inputs, such as counting numbers
from 1 to 264
• Calculating the hashes, requiring 264
calculations
• Store them, using 264 units of RAM
• What's the safety margin?
Requirements for Naive
Birthday Attack on MD5
• 264 calculations is not impossible
• But 264 units of RAM?
• 1GB = 109 = 230
• 1TB = 240
• 1 million TB = 260
• 16 million TB = 264 = 16,000 PB
• (1 PB (petabyte) = 1000 TB = 1 million GB)
Worldwide Data Center Storage
Capacity
MD5 Naive Birthday Attack
Safety Margin
• Attack requires 16,000 PB
• Whole world has less than 3,000 PB
• Safety margin is a factor of 5
• Not very large
Preimage Attack
• MD5 is 128 bits long
• Calculating every possible hash (nearly) would
require 2128 calculations
• Storing them would take 2128 units of RAM
• What's the safety margin?
Low-Memory Collision
Search: The Rho Method
• Don't just choose sequential inputs to hash
• Calculate the hash of the previous hash
• Start with any random seed s
• H1 = hash(s)
• H2 = hash(H1)
• H3 = hash (H2)
• etc...
Rho Method
Rho Method
• Tail and circle are approximately 2N/2 long
• Since the hashes are going in a circle
• You don't need to store all the hash values in
memory to detect a collision
• You store only hashes starting with many
zeroes ("Distinguished Points")
• This requires more calculations but less
storage -- time-memory trade-off
• Link Ch 6k
Rho Method
Rho Method for 16-bit
Hash
Building Hash Functions
Iterative Hashing
• A long messages is broken into blocks
• Each block is processed consecutively using
compression or permutation
Compression-Based Hash Functions:
the Merkle-Damgard Construction
• Used in MD5, MD5, SHA-1, and SHA-2
• Also RIPEMD and Whirlpool
• H0 is an initial value
• H1, H2, ... are chaining values
• The final H is the output
Padding Blocks
• Pad with 1, then zeroes, finally the message
length
• SHA-256 uses 512-bit blocks
• To hash the eight-bit message 10101010
Building Compression Functions:
The Davies-Meyer Construction
• Uses a block cipher to build a compression
function
• Use message blocks as keys
• The XOR feedback makes it secure against
decryption
Other Compression
Functions
• Less popular because
• They are more complex, or
• Require message block to be same length
as chaining value
Permutation-Based Hash
Functions: Sponge Functions
• Simpler than using a cipher
• No key
• Keccak is the most famous sponge function
• Also known as SHA-3
The SHA Family
MD5
• Broken in 2005
• Fast attacks now to generate MD5 collisions
• It still cannot be reversed in general
SHA-0
• Approved by NIST in 1993
• Replaced in 1995 by SHA-1
• To fix an unidentified security issue
• 160 bits long, so it should take 280 calculations
to find a collision
• In 1998 an attack was found requiring only
260 calculations to find a SHA-0 collision
• Later attacks work in 233 calculations--less
than an hour of computing (for SHA-0)
SHA-1
• Uses an encryption function called SHACAL
• Repeats this calculation for every 512-bit block
in the message M
Compression Function
• 160-bit chaining value broken into 5 32-bit
words a b c d e
Attacks on SHA-1
• In 2005 an attack
was found that
would find a
collision in 263
calculations
instead of 280
• In 2017 a SHA-1
collision was
found
• No longer trusted
SHA-2
• Four versions
• SHA-224, SHA-256, SHA-384, SHA-512
• SHA-256 uses
• Eight 32-bit words
• 64 rounds of calculation with a more
complex expand function
Security of SHA-2
• All four SHA-2 algorithms are still considered
strong
• But researchers and NIST grew concerned
because its algorithm is close to SHA-1's
SHA-3 Finalists
• BLAKE
• Grøstl
• JH
• Keccak
• Skein
Keccak (SHA-3)
• Completely different from SHA-1 and SHA-2
• Sponge function with a 1600-bit state
• Includes four hashes:
• SHA3-224, SHA3-256, SHA3-384, SHA3-512
• And two Extendible output functions
• Can produce hashes of any length
• Called SHAKE128 and SHAKE256
BLAKE2
Speed
• BLAKE2 is a secure as SHA-3
• But much faster to compute
• Faster than MD5 or SHA-1
• Two functions
• BLAKE2 (also called BLAKE2b) optimized for
64-bit platforms, produces digests from 1 to 64
bytes
• BLAKE2s optimized for 8-bit to 32-bit
platforms, produces digests from 1 to 32 bytes
Usage
• BLAKE2 is the fastest secure hash available
today
• The most popular non-NIST-standard hash
• Used in many apps and in major libraries such
as openSSL and Sodium
BLAKE's Compression
Function
• Parameters: a counter and a flag
• Block cipher is based on ChaCha
• Which is based on Salsa20
BLAKE2b's Core
Operations
• Transforms the state
of four 64-bit words
• a b c d
• Using two message
words
• Mi Mj
How Things Can Go
Wrong
Misuse
• Using weak checksum algorithms like CRC32
for file integrity
• Instead of a cryptographic hash algorithm
The Length-Extension
Attack
• If you know the hash H(M)
• You can add more data to the right and
calculate the hash of the longer message
• Without knowing the original message
Padding
• If the original message is properly padded, it's
actually M1 || M2
• M1 is message; M2 is padding
• || means concatenating text
• The extended message is M1 || M2 || M3
• Won't affect most applications
• But some applications do get fooled
SHA-2 Length Extension
• SHA-2 is vulnerable
• Could have easily been avoided by making
the last compression function different
• BLAKE2 does that
Fooling Proof-of-Storage
Protocols
• A cloud server verifies that it has stored a
message M
• Server can cheat by keeping only the chain
value from hashing the message
• And discarding the message
• Server can still calculate the respose by
length extension
• Works for SHA-1, SHA-2, SHA-3, and BLAKE
• Cure: hash C||M instead of M||C
Fooling Proof-of-Storage
Protocols
CNIT 141: 6. Hash Functions

More Related Content

What's hot

CNIT 129S: 12: Attacking Users: Cross-Site Scripting (Part 1 of 2)
CNIT 129S: 12: Attacking Users: Cross-Site Scripting (Part 1 of 2)CNIT 129S: 12: Attacking Users: Cross-Site Scripting (Part 1 of 2)
CNIT 129S: 12: Attacking Users: Cross-Site Scripting (Part 1 of 2)
Sam Bowne
 
CNIT 141: 2. Randomness
CNIT 141: 2. RandomnessCNIT 141: 2. Randomness
CNIT 141: 2. Randomness
Sam Bowne
 
CNIT 126 11. Malware Behavior
CNIT 126 11. Malware BehaviorCNIT 126 11. Malware Behavior
CNIT 126 11. Malware Behavior
Sam Bowne
 
Practical Malware Analysis Ch12
Practical Malware Analysis Ch12Practical Malware Analysis Ch12
Practical Malware Analysis Ch12
Sam Bowne
 
CNIT 141: 7. Keyed Hashing
CNIT 141: 7. Keyed HashingCNIT 141: 7. Keyed Hashing
CNIT 141: 7. Keyed Hashing
Sam Bowne
 
Practical Malware Analysis Ch 14: Malware-Focused Network Signatures
Practical Malware Analysis Ch 14: Malware-Focused Network SignaturesPractical Malware Analysis Ch 14: Malware-Focused Network Signatures
Practical Malware Analysis Ch 14: Malware-Focused Network Signatures
Sam Bowne
 
CNIT 141: 6. Hash Functions
CNIT 141: 6. Hash FunctionsCNIT 141: 6. Hash Functions
CNIT 141: 6. Hash Functions
Sam Bowne
 
9: OllyDbg
9: OllyDbg9: OllyDbg
9: OllyDbg
Sam Bowne
 
Ch 6: Attacking Authentication
Ch 6: Attacking AuthenticationCh 6: Attacking Authentication
Ch 6: Attacking Authentication
Sam Bowne
 
Practical Malware Analysis: Ch 9: OllyDbg
Practical Malware Analysis: Ch 9: OllyDbgPractical Malware Analysis: Ch 9: OllyDbg
Practical Malware Analysis: Ch 9: OllyDbg
Sam Bowne
 
Information and data security cryptographic hash functions
Information and data security cryptographic hash functionsInformation and data security cryptographic hash functions
Information and data security cryptographic hash functions
Mazin Alwaaly
 
CNIT 141 13. TLS
CNIT 141 13. TLSCNIT 141 13. TLS
CNIT 141 13. TLS
Sam Bowne
 
CNIT 126: Ch 2 & 3
CNIT 126: Ch 2 & 3CNIT 126: Ch 2 & 3
CNIT 126: Ch 2 & 3
Sam Bowne
 
Practical Malware Analysis Ch13
Practical Malware Analysis Ch13Practical Malware Analysis Ch13
Practical Malware Analysis Ch13
Sam Bowne
 
Practical Malware Analysis: Ch 2 Malware Analysis in Virtual Machines & 3: Ba...
Practical Malware Analysis: Ch 2 Malware Analysis in Virtual Machines & 3: Ba...Practical Malware Analysis: Ch 2 Malware Analysis in Virtual Machines & 3: Ba...
Practical Malware Analysis: Ch 2 Malware Analysis in Virtual Machines & 3: Ba...
Sam Bowne
 
Practical Malware Analysis: Ch 10: Kernel Debugging with WinDbg
Practical Malware Analysis: Ch 10: Kernel Debugging with WinDbgPractical Malware Analysis: Ch 10: Kernel Debugging with WinDbg
Practical Malware Analysis: Ch 10: Kernel Debugging with WinDbg
Sam Bowne
 
CNIT 141: 1. Encryption
CNIT 141: 1. EncryptionCNIT 141: 1. Encryption
CNIT 141: 1. Encryption
Sam Bowne
 
Windows 10 Nt Heap Exploitation (Chinese version)
Windows 10 Nt Heap Exploitation (Chinese version)Windows 10 Nt Heap Exploitation (Chinese version)
Windows 10 Nt Heap Exploitation (Chinese version)
Angel Boy
 
Malware Static Analysis
Malware Static AnalysisMalware Static Analysis
Malware Static Analysis
Hossein Yavari
 
CNIT 141: 9. Hard Problems
CNIT 141: 9. Hard ProblemsCNIT 141: 9. Hard Problems
CNIT 141: 9. Hard Problems
Sam Bowne
 

What's hot (20)

CNIT 129S: 12: Attacking Users: Cross-Site Scripting (Part 1 of 2)
CNIT 129S: 12: Attacking Users: Cross-Site Scripting (Part 1 of 2)CNIT 129S: 12: Attacking Users: Cross-Site Scripting (Part 1 of 2)
CNIT 129S: 12: Attacking Users: Cross-Site Scripting (Part 1 of 2)
 
CNIT 141: 2. Randomness
CNIT 141: 2. RandomnessCNIT 141: 2. Randomness
CNIT 141: 2. Randomness
 
CNIT 126 11. Malware Behavior
CNIT 126 11. Malware BehaviorCNIT 126 11. Malware Behavior
CNIT 126 11. Malware Behavior
 
Practical Malware Analysis Ch12
Practical Malware Analysis Ch12Practical Malware Analysis Ch12
Practical Malware Analysis Ch12
 
CNIT 141: 7. Keyed Hashing
CNIT 141: 7. Keyed HashingCNIT 141: 7. Keyed Hashing
CNIT 141: 7. Keyed Hashing
 
Practical Malware Analysis Ch 14: Malware-Focused Network Signatures
Practical Malware Analysis Ch 14: Malware-Focused Network SignaturesPractical Malware Analysis Ch 14: Malware-Focused Network Signatures
Practical Malware Analysis Ch 14: Malware-Focused Network Signatures
 
CNIT 141: 6. Hash Functions
CNIT 141: 6. Hash FunctionsCNIT 141: 6. Hash Functions
CNIT 141: 6. Hash Functions
 
9: OllyDbg
9: OllyDbg9: OllyDbg
9: OllyDbg
 
Ch 6: Attacking Authentication
Ch 6: Attacking AuthenticationCh 6: Attacking Authentication
Ch 6: Attacking Authentication
 
Practical Malware Analysis: Ch 9: OllyDbg
Practical Malware Analysis: Ch 9: OllyDbgPractical Malware Analysis: Ch 9: OllyDbg
Practical Malware Analysis: Ch 9: OllyDbg
 
Information and data security cryptographic hash functions
Information and data security cryptographic hash functionsInformation and data security cryptographic hash functions
Information and data security cryptographic hash functions
 
CNIT 141 13. TLS
CNIT 141 13. TLSCNIT 141 13. TLS
CNIT 141 13. TLS
 
CNIT 126: Ch 2 & 3
CNIT 126: Ch 2 & 3CNIT 126: Ch 2 & 3
CNIT 126: Ch 2 & 3
 
Practical Malware Analysis Ch13
Practical Malware Analysis Ch13Practical Malware Analysis Ch13
Practical Malware Analysis Ch13
 
Practical Malware Analysis: Ch 2 Malware Analysis in Virtual Machines & 3: Ba...
Practical Malware Analysis: Ch 2 Malware Analysis in Virtual Machines & 3: Ba...Practical Malware Analysis: Ch 2 Malware Analysis in Virtual Machines & 3: Ba...
Practical Malware Analysis: Ch 2 Malware Analysis in Virtual Machines & 3: Ba...
 
Practical Malware Analysis: Ch 10: Kernel Debugging with WinDbg
Practical Malware Analysis: Ch 10: Kernel Debugging with WinDbgPractical Malware Analysis: Ch 10: Kernel Debugging with WinDbg
Practical Malware Analysis: Ch 10: Kernel Debugging with WinDbg
 
CNIT 141: 1. Encryption
CNIT 141: 1. EncryptionCNIT 141: 1. Encryption
CNIT 141: 1. Encryption
 
Windows 10 Nt Heap Exploitation (Chinese version)
Windows 10 Nt Heap Exploitation (Chinese version)Windows 10 Nt Heap Exploitation (Chinese version)
Windows 10 Nt Heap Exploitation (Chinese version)
 
Malware Static Analysis
Malware Static AnalysisMalware Static Analysis
Malware Static Analysis
 
CNIT 141: 9. Hard Problems
CNIT 141: 9. Hard ProblemsCNIT 141: 9. Hard Problems
CNIT 141: 9. Hard Problems
 

Similar to CNIT 141: 6. Hash Functions

CNIT 141 6. Hash Functions
CNIT 141 6. Hash FunctionsCNIT 141 6. Hash Functions
CNIT 141 6. Hash Functions
Sam Bowne
 
CNIT 125 Ch 4. Security Engineering (Part 2)
CNIT 125 Ch 4. Security Engineering (Part 2)CNIT 125 Ch 4. Security Engineering (Part 2)
CNIT 125 Ch 4. Security Engineering (Part 2)
Sam Bowne
 
Ch 12: Cryptography
Ch 12: CryptographyCh 12: Cryptography
Ch 12: Cryptography
Sam Bowne
 
Blockchain Technology Introduction and Basics
Blockchain Technology  Introduction and BasicsBlockchain Technology  Introduction and Basics
Blockchain Technology Introduction and Basics
jayasris2023
 
CNIT 123 12: Cryptography
CNIT 123 12: CryptographyCNIT 123 12: Cryptography
CNIT 123 12: Cryptography
Sam Bowne
 
Symmetric encryption
Symmetric encryptionSymmetric encryption
Symmetric encryption
DR RICHMOND ADEBIAYE
 
CISSP Week 20
CISSP Week 20CISSP Week 20
CISSP Week 20
jemtallon
 
Cns
CnsCns
Cns
ArthyR3
 
CNIT 141: 14. Quantum and Post-Quantum
CNIT 141: 14. Quantum and Post-Quantum CNIT 141: 14. Quantum and Post-Quantum
CNIT 141: 14. Quantum and Post-Quantum
Sam Bowne
 
Chapter 8 cryptography lanjutan
Chapter 8 cryptography lanjutanChapter 8 cryptography lanjutan
Chapter 8 cryptography lanjutan
newbie2019
 
CISSP Prep: Ch 4. Security Engineering (Part 2)
CISSP Prep: Ch 4. Security Engineering (Part 2)CISSP Prep: Ch 4. Security Engineering (Part 2)
CISSP Prep: Ch 4. Security Engineering (Part 2)
Sam Bowne
 
Distribution of public keys and hmac
Distribution of public keys and hmacDistribution of public keys and hmac
Distribution of public keys and hmac
anuragjagetiya
 
Ch_07 (1).pptx
Ch_07 (1).pptxCh_07 (1).pptx
Ch_07 (1).pptx
siddhusid10
 
CNIT 141: 14. Quantum and Post-Quantum
CNIT 141: 14. Quantum and Post-QuantumCNIT 141: 14. Quantum and Post-Quantum
CNIT 141: 14. Quantum and Post-Quantum
Sam Bowne
 
UNIT 4 CRYPTOGRAPHIC SYSTEMS.pptx
UNIT 4  CRYPTOGRAPHIC SYSTEMS.pptxUNIT 4  CRYPTOGRAPHIC SYSTEMS.pptx
UNIT 4 CRYPTOGRAPHIC SYSTEMS.pptx
ssuserd5e356
 
Hash Function
Hash FunctionHash Function
Hash Function
Siddharth Srivastava
 
Information Security Lesson 8 - Cryptography - Eric Vanderburg
Information Security Lesson 8 - Cryptography - Eric VanderburgInformation Security Lesson 8 - Cryptography - Eric Vanderburg
Information Security Lesson 8 - Cryptography - Eric Vanderburg
Eric Vanderburg
 
Hash Function & Analysis
Hash Function & AnalysisHash Function & Analysis
Hash Function & Analysis
Pawandeep Kaur
 
501 ch 10 cryptography
501 ch 10 cryptography501 ch 10 cryptography
501 ch 10 cryptography
Toyeeb Onimole
 
UNIT3_class (1).ppt CRYPTOGRAPHY NOTES AND NETWORK
UNIT3_class (1).ppt CRYPTOGRAPHY NOTES AND NETWORKUNIT3_class (1).ppt CRYPTOGRAPHY NOTES AND NETWORK
UNIT3_class (1).ppt CRYPTOGRAPHY NOTES AND NETWORK
jeevasreemurali
 

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

CNIT 141 6. Hash Functions
CNIT 141 6. Hash FunctionsCNIT 141 6. Hash Functions
CNIT 141 6. Hash Functions
 
CNIT 125 Ch 4. Security Engineering (Part 2)
CNIT 125 Ch 4. Security Engineering (Part 2)CNIT 125 Ch 4. Security Engineering (Part 2)
CNIT 125 Ch 4. Security Engineering (Part 2)
 
Ch 12: Cryptography
Ch 12: CryptographyCh 12: Cryptography
Ch 12: Cryptography
 
Blockchain Technology Introduction and Basics
Blockchain Technology  Introduction and BasicsBlockchain Technology  Introduction and Basics
Blockchain Technology Introduction and Basics
 
CNIT 123 12: Cryptography
CNIT 123 12: CryptographyCNIT 123 12: Cryptography
CNIT 123 12: Cryptography
 
Symmetric encryption
Symmetric encryptionSymmetric encryption
Symmetric encryption
 
CISSP Week 20
CISSP Week 20CISSP Week 20
CISSP Week 20
 
Cns
CnsCns
Cns
 
CNIT 141: 14. Quantum and Post-Quantum
CNIT 141: 14. Quantum and Post-Quantum CNIT 141: 14. Quantum and Post-Quantum
CNIT 141: 14. Quantum and Post-Quantum
 
Chapter 8 cryptography lanjutan
Chapter 8 cryptography lanjutanChapter 8 cryptography lanjutan
Chapter 8 cryptography lanjutan
 
CISSP Prep: Ch 4. Security Engineering (Part 2)
CISSP Prep: Ch 4. Security Engineering (Part 2)CISSP Prep: Ch 4. Security Engineering (Part 2)
CISSP Prep: Ch 4. Security Engineering (Part 2)
 
Distribution of public keys and hmac
Distribution of public keys and hmacDistribution of public keys and hmac
Distribution of public keys and hmac
 
Ch_07 (1).pptx
Ch_07 (1).pptxCh_07 (1).pptx
Ch_07 (1).pptx
 
CNIT 141: 14. Quantum and Post-Quantum
CNIT 141: 14. Quantum and Post-QuantumCNIT 141: 14. Quantum and Post-Quantum
CNIT 141: 14. Quantum and Post-Quantum
 
UNIT 4 CRYPTOGRAPHIC SYSTEMS.pptx
UNIT 4  CRYPTOGRAPHIC SYSTEMS.pptxUNIT 4  CRYPTOGRAPHIC SYSTEMS.pptx
UNIT 4 CRYPTOGRAPHIC SYSTEMS.pptx
 
Hash Function
Hash FunctionHash Function
Hash Function
 
Information Security Lesson 8 - Cryptography - Eric Vanderburg
Information Security Lesson 8 - Cryptography - Eric VanderburgInformation Security Lesson 8 - Cryptography - Eric Vanderburg
Information Security Lesson 8 - Cryptography - Eric Vanderburg
 
Hash Function & Analysis
Hash Function & AnalysisHash Function & Analysis
Hash Function & Analysis
 
501 ch 10 cryptography
501 ch 10 cryptography501 ch 10 cryptography
501 ch 10 cryptography
 
UNIT3_class (1).ppt CRYPTOGRAPHY NOTES AND NETWORK
UNIT3_class (1).ppt CRYPTOGRAPHY NOTES AND NETWORKUNIT3_class (1).ppt CRYPTOGRAPHY NOTES AND NETWORK
UNIT3_class (1).ppt CRYPTOGRAPHY NOTES AND NETWORK
 

More from Sam Bowne

Cyberwar
CyberwarCyberwar
Cyberwar
Sam Bowne
 
3: DNS vulnerabilities
3: DNS vulnerabilities 3: DNS vulnerabilities
3: DNS vulnerabilities
Sam Bowne
 
8. Software Development Security
8. Software Development Security8. Software Development Security
8. Software Development Security
Sam Bowne
 
4 Mapping the Application
4 Mapping the Application4 Mapping the Application
4 Mapping the Application
Sam Bowne
 
3. Attacking iOS Applications (Part 2)
 3. Attacking iOS Applications (Part 2) 3. Attacking iOS Applications (Part 2)
3. Attacking iOS Applications (Part 2)
Sam Bowne
 
12 Elliptic Curves
12 Elliptic Curves12 Elliptic Curves
12 Elliptic Curves
Sam Bowne
 
11. Diffie-Hellman
11. Diffie-Hellman11. Diffie-Hellman
11. Diffie-Hellman
Sam Bowne
 
2a Analyzing iOS Apps Part 1
2a Analyzing iOS Apps Part 12a Analyzing iOS Apps Part 1
2a Analyzing iOS Apps Part 1
Sam Bowne
 
9 Writing Secure Android Applications
9 Writing Secure Android Applications9 Writing Secure Android Applications
9 Writing Secure Android Applications
Sam Bowne
 
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)
Sam Bowne
 
10 RSA
10 RSA10 RSA
10 RSA
Sam Bowne
 
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
Sam Bowne
 
8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)
Sam Bowne
 
11 Analysis Methodology
11 Analysis Methodology11 Analysis Methodology
11 Analysis Methodology
Sam Bowne
 
8. Authenticated Encryption
8. Authenticated Encryption8. Authenticated Encryption
8. Authenticated Encryption
Sam Bowne
 
7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)
Sam Bowne
 
7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)
Sam Bowne
 
6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data Collection6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data Collection
Sam Bowne
 
4. Block Ciphers
4. Block Ciphers 4. Block Ciphers
4. Block Ciphers
Sam Bowne
 
6 Analyzing Android Applications (Part 2)
6 Analyzing Android Applications (Part 2)6 Analyzing Android Applications (Part 2)
6 Analyzing Android Applications (Part 2)
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
 
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)
 
6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data Collection6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data Collection
 
4. Block Ciphers
4. Block Ciphers 4. Block Ciphers
4. Block Ciphers
 
6 Analyzing Android Applications (Part 2)
6 Analyzing Android Applications (Part 2)6 Analyzing Android Applications (Part 2)
6 Analyzing Android Applications (Part 2)
 

Recently uploaded

How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
HajraNaeem15
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 

Recently uploaded (20)

How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 

CNIT 141: 6. Hash Functions

  • 1. CNIT 141 Cryptography for Computer Networks 6. Hash Functions Updated 10-1-2020
  • 2. Topics • Secure Hash Functions • Building Hash Functions • The SHA Family • BLAKE2 • How Things Can Go Wrong
  • 3. Use Cases of Hash Functions • Digital signatures • Public-key encryption • Message authentication • Integrity verification • Password storage
  • 4. Fingerprinting • Hash function creates a fixed-length "fingerprint" • From input of any length • Not encryption • No key; cannot be reversed
  • 5. Non-Cryptographic Hash Functions • Provide no security; easily fooled by crafted input • Used in hash tables • To make table lookups faster • To detect accidental errors • Ex: CRC (Cyclic Redundancy Check) • Used at layer 2 by Ethernet and Wi-Fi
  • 7. Digital Signature • Most common use case for hashing • Message M hashed, then the hash is signed • Hash is smaller so the signature computation is faster • But the hash function must be secure
  • 8. Unpredictability • Two different inputs must always have different hashes • Changing one bit in the input makes the hash totally different
  • 9. Non-Uniqueness • Consider an input message 1024 bits long • And a hash 256 bits long • There are 21024 different messages • But only are 2256 different hashes • So many different messages have the same hash
  • 10. One-Wayness • Hashing cannot be reversed • An attacker cannot find M from H • In principle, always true • Many different messages have the same hash
  • 11. Preimage Resistance • An attacker given H cannot find any M with that hash • This is preimage resistance • Also called first preimage resistance
  • 12. The Cost of Preimages • Attacker hashes many messages • Hunting for a match • Will take 2N guesses for hash of length N bits • For n = 256, that's forever
  • 13. Second Preimage • Given M1 and H1 • Attacker tries to find another message M2 • That hashes to the same H • Essentially the same as first preimage resistance • Unless the hash function has a certain type of mathematical defect • Like length extension attacks
  • 14. Collision Resistance • Every hash function has collisions • Two messages with the same hash • Because there are more possible messages than hashes • Pigeonhole principle • If you have 10 holes and 11 pigeons, at least one hole contains more than one pigeon
  • 15. Collision Resistance • Collisions should be hard to find • In practice, impossible
  • 16. Birthday Attack • Get each person in a group to say the month and day they were born • With 23 people, the probability of two having the same birthday is 51%
  • 17. Finding Collisions • If you search for collsions • And have enough RAM to remember each hash you calculate • It only takes 2N/2 hashes to find a collision • N is the number of bits in the hash
  • 18. Naive Birthday Attack • Requires 2N/2 calculations to create the list • And 2N/2 units of storage to hold it • Sorting the list takes even more calculations
  • 20. Preimage Attack • MD5 is 128 bits long • Given an MD5 hash, can we find an input with that hash value? • Calculating every possible hash (nearly) would require 2128 calculations • But we don't need to store them: we just compare each one with the target • How hard is that?
  • 21. 72 Bit Brute-Force • RSA Security made several challenges to test brute-force attacks • Distributed.net has been attacking these challenges since 1997 • Cracked a 56-bit key in 250 days in 1997 • Cracked a 64-bit key in 5 years in 2002 • 72-bit key attack is in progress • So far they'te tested 5.6% of the keyspace • It will take 127 years to test all keys
  • 23. MD5 Preimage Attack Safety Margin • Max. computing available to any attacker is 296 calculations • Preimage attack requires 2128 calculations • Safety margin is 230 units of RAM • 210 is 1024 • 230 is 1024 x 1024 x 1024 = 1 billion
  • 24. Naive Birthday Attack on MD5 • Take 264 inputs, such as counting numbers from 1 to 264 • Calculating the hashes, requiring 264 calculations • Store them, using 264 units of RAM • What's the safety margin?
  • 25. Requirements for Naive Birthday Attack on MD5 • 264 calculations is not impossible • But 264 units of RAM? • 1GB = 109 = 230 • 1TB = 240 • 1 million TB = 260 • 16 million TB = 264 = 16,000 PB • (1 PB (petabyte) = 1000 TB = 1 million GB)
  • 26. Worldwide Data Center Storage Capacity
  • 27. MD5 Naive Birthday Attack Safety Margin • Attack requires 16,000 PB • Whole world has less than 3,000 PB • Safety margin is a factor of 5 • Not very large
  • 28. Preimage Attack • MD5 is 128 bits long • Calculating every possible hash (nearly) would require 2128 calculations • Storing them would take 2128 units of RAM • What's the safety margin?
  • 29. Low-Memory Collision Search: The Rho Method • Don't just choose sequential inputs to hash • Calculate the hash of the previous hash • Start with any random seed s • H1 = hash(s) • H2 = hash(H1) • H3 = hash (H2) • etc...
  • 31. Rho Method • Tail and circle are approximately 2N/2 long • Since the hashes are going in a circle • You don't need to store all the hash values in memory to detect a collision • You store only hashes starting with many zeroes ("Distinguished Points") • This requires more calculations but less storage -- time-memory trade-off
  • 32. • Link Ch 6k Rho Method
  • 33. Rho Method for 16-bit Hash
  • 34.
  • 36. Iterative Hashing • A long messages is broken into blocks • Each block is processed consecutively using compression or permutation
  • 37. Compression-Based Hash Functions: the Merkle-Damgard Construction • Used in MD5, MD5, SHA-1, and SHA-2 • Also RIPEMD and Whirlpool • H0 is an initial value • H1, H2, ... are chaining values • The final H is the output
  • 38. Padding Blocks • Pad with 1, then zeroes, finally the message length • SHA-256 uses 512-bit blocks • To hash the eight-bit message 10101010
  • 39. Building Compression Functions: The Davies-Meyer Construction • Uses a block cipher to build a compression function • Use message blocks as keys • The XOR feedback makes it secure against decryption
  • 40. Other Compression Functions • Less popular because • They are more complex, or • Require message block to be same length as chaining value
  • 41. Permutation-Based Hash Functions: Sponge Functions • Simpler than using a cipher • No key • Keccak is the most famous sponge function • Also known as SHA-3
  • 42.
  • 44. MD5 • Broken in 2005 • Fast attacks now to generate MD5 collisions • It still cannot be reversed in general
  • 45. SHA-0 • Approved by NIST in 1993 • Replaced in 1995 by SHA-1 • To fix an unidentified security issue • 160 bits long, so it should take 280 calculations to find a collision • In 1998 an attack was found requiring only 260 calculations to find a SHA-0 collision • Later attacks work in 233 calculations--less than an hour of computing (for SHA-0)
  • 46. SHA-1 • Uses an encryption function called SHACAL • Repeats this calculation for every 512-bit block in the message M
  • 47. Compression Function • 160-bit chaining value broken into 5 32-bit words a b c d e
  • 48. Attacks on SHA-1 • In 2005 an attack was found that would find a collision in 263 calculations instead of 280 • In 2017 a SHA-1 collision was found • No longer trusted
  • 49. SHA-2 • Four versions • SHA-224, SHA-256, SHA-384, SHA-512 • SHA-256 uses • Eight 32-bit words • 64 rounds of calculation with a more complex expand function
  • 50. Security of SHA-2 • All four SHA-2 algorithms are still considered strong • But researchers and NIST grew concerned because its algorithm is close to SHA-1's
  • 51. SHA-3 Finalists • BLAKE • Grøstl • JH • Keccak • Skein
  • 52. Keccak (SHA-3) • Completely different from SHA-1 and SHA-2 • Sponge function with a 1600-bit state • Includes four hashes: • SHA3-224, SHA3-256, SHA3-384, SHA3-512 • And two Extendible output functions • Can produce hashes of any length • Called SHAKE128 and SHAKE256
  • 54. Speed • BLAKE2 is a secure as SHA-3 • But much faster to compute • Faster than MD5 or SHA-1 • Two functions • BLAKE2 (also called BLAKE2b) optimized for 64-bit platforms, produces digests from 1 to 64 bytes • BLAKE2s optimized for 8-bit to 32-bit platforms, produces digests from 1 to 32 bytes
  • 55.
  • 56. Usage • BLAKE2 is the fastest secure hash available today • The most popular non-NIST-standard hash • Used in many apps and in major libraries such as openSSL and Sodium
  • 57. BLAKE's Compression Function • Parameters: a counter and a flag • Block cipher is based on ChaCha • Which is based on Salsa20
  • 58. BLAKE2b's Core Operations • Transforms the state of four 64-bit words • a b c d • Using two message words • Mi Mj
  • 59. How Things Can Go Wrong
  • 60. Misuse • Using weak checksum algorithms like CRC32 for file integrity • Instead of a cryptographic hash algorithm
  • 61. The Length-Extension Attack • If you know the hash H(M) • You can add more data to the right and calculate the hash of the longer message • Without knowing the original message
  • 62. Padding • If the original message is properly padded, it's actually M1 || M2 • M1 is message; M2 is padding • || means concatenating text • The extended message is M1 || M2 || M3 • Won't affect most applications • But some applications do get fooled
  • 63. SHA-2 Length Extension • SHA-2 is vulnerable • Could have easily been avoided by making the last compression function different • BLAKE2 does that
  • 64. Fooling Proof-of-Storage Protocols • A cloud server verifies that it has stored a message M
  • 65. • Server can cheat by keeping only the chain value from hashing the message • And discarding the message • Server can still calculate the respose by length extension • Works for SHA-1, SHA-2, SHA-3, and BLAKE • Cure: hash C||M instead of M||C Fooling Proof-of-Storage Protocols