SlideShare a Scribd company logo
Hash Functions
CS4501, Fall 2015
David Evans and Samee Zahur
University of Virginia
Hash("I, Alice, hereby pay Bob an
amount of 23 mBTC")
=
7abc39d0 2e0194bc d7e93192 bcdfe412
Hash Functions in Signatures
signsk 𝑚 = 𝑠
Signature algorithms require a fixed-size 𝑚!
Hash Functions in Signatures
signsk H 𝑚 = 𝑠
Signature algorithms can use a fixed-size H 𝑚
Verifying Hashed Signatures
1. Compute ℎ = H(𝑚)
2. Run verifyvk ℎ, 𝑠
3. Accept if verify passed
Cannot have collisions!
Hash("I, Alice, hereby pay Bob an
amount of 23 mBTC")
=
7abc39d0 2e0194bc d7e93192 bcdfe412
Arbitrary
Strings
Fixed-size
numbers
Infinitely large set
Collisions Unavoidable
Finite set
Cannot have collisions!
find
Common Hash Properties
1. Collision resistance
“It is hard to find any two 𝑚1, 𝑚2 such that H 𝑚1 = H(𝑚2)”
2. Second preimage resistance
“For given 𝑚1, it is hard to find 𝑚2 such that H 𝑚1 = H(𝑚2)”
3. Preimage resistance (such functions are also called one-way)
“For a given ℎ, it is hard to find any 𝑚 such that H 𝑚 = ℎ”
1 ⇒ 2 ⇒ 3
Recap
• Signing algorithms work on small inputs
• We hash strings before signing them
• We need collision-resistant hashes
The Birthday Problem
Find smallest number of people such that
E pairs of common birthdays ≥ 1
Ways to pair 4 people
3 + 2 + 1 = 6
Ways to pair 𝑛 people
𝑛 − 1 + ⋯ + 3 + 2 + 1 =
𝑛 𝑛 − 1
2
=
𝑛2
− 𝑛
2
E pairs of common birthdays
=
𝑛2 − 𝑛
2 × 365
How many common pairs?
E pairs =
𝑛2 − 𝑛
2 × 365
Using 𝑛 = 30:
E pairs =
𝑛2−𝑛
2×365
=
900−30
2×365
= 1.192
I wish a year had more days …
If we select 𝑛 items out of 𝑁,
number of repeats expected
=
𝑛2 − 𝑛
2𝑁
We expect first repeat in
𝑛 = Θ( 𝑁) trials
I was born on 0x8ca8294be…
H(some input) looks like random 𝑘-bits
How many trials before we find collision?
80-bit hashes have 280
possible outputs.
On the order of 280 = 240 trials.
Real-life hash functions
Name Output
Length (bits)
Security status
MD5 128 Collisions found
SHA1 160 Can be broken in ~261 iterations
SHA2
→ SHA-256
224-512
→ 256
No known attacks
SHA3 224-512 No known attacks
Bitcoin typically uses SHA-256(SHA-256(transaction))
Hash-function
life cycle
New function
proposed
Security
evaluated
Function
standardized
Theoretical
attacks
proposed
Attacks
improved
and are
practical
“Typical” timelines
MD5
• First proposed: 1991
• Published: 1992
• First signs of trouble: 1996
• Not collision resistant: 2004
• Chosen-prefix collision: by 2007
SHA3
• Competition started: 2007
• Submission deadline: 2008
• Elimination rounds: 2008-2010
• 5 finalists announced: 2010
• Kekkak algorithm selected as
winner: 2012
Digital signatures
JasonBenjamin
Bitcoin transaction ID
Deduplication
Password storage
Password Databases
Username Password
Jack.Clough 12password
Betty.Smith 8c2odkw
Username “Salt” Scrypt(password+salt)
Jack.Clough 150FE5Btiq… PaR6mPwHBj…
Betty.Smith t1Y1B67ulN… QrUaLRqFvc…
Insecure Better
Partial verification
A block is a group of transactions in the Bitcoin ledger.
Straightforward way:
H 𝑇1 + 𝑇2 + ⋯ + 𝑇1000 = 0xa8c9239 …
Verification requires me to inspect all 1000 transactions in the block.
Merkle Tree
root = 0x220c04634a…
p = H(a+b)
= 0x2626113d5b…
q = H(c+d)
= 0x305e321c3e…
H(T1) = a
= 0x1763023d40…
H(T2) = a
= 0x1c1c3a3831…
H(T3) = a
= 0x2955461d31…
H(T4) = a
= 0x160b445b5e…
Recap
• Hash functions used in lots of places:
• Signatures
• Unique global IDs: bitcoin transaction, Dropbox files
• Password databases
• File downloads
• Birthday attacks: hashes with 𝑘-bit output can be expected to collide
in 2
𝑘
2 iterations
• Weak hashes can be broken faster: don’t use MD5, avoid SHA-1
• Merkle trees enable partial verification
Coming up…
• Problemset 1 due tomorrow: (8:29 PM)
• Ori has office hours today (5 PM – 6:30 PM)
• Next class topic: Bitcoin mining

More Related Content

What's hot

ASFWS 2012 - Hash-flooding DoS reloaded: attacks and defenses par Jean-Philip...
ASFWS 2012 - Hash-flooding DoS reloaded: attacks and defenses par Jean-Philip...ASFWS 2012 - Hash-flooding DoS reloaded: attacks and defenses par Jean-Philip...
ASFWS 2012 - Hash-flooding DoS reloaded: attacks and defenses par Jean-Philip...
Cyber Security Alliance
 
Hash function
Hash functionHash function
Hash function
Harry Potter
 
Introduction to Homomorphic Encryption
Introduction to Homomorphic EncryptionIntroduction to Homomorphic Encryption
Introduction to Homomorphic Encryption
Christoph Matthies
 
Secure and privacy-preserving data transmission and processing using homomorp...
Secure and privacy-preserving data transmission and processing using homomorp...Secure and privacy-preserving data transmission and processing using homomorp...
Secure and privacy-preserving data transmission and processing using homomorp...
DefCamp
 
On Mining Bitcoins - Fundamentals & Outlooks
On Mining Bitcoins - Fundamentals & OutlooksOn Mining Bitcoins - Fundamentals & Outlooks
On Mining Bitcoins - Fundamentals & Outlooks
Filip Maertens
 
Computing on Encrypted Data
Computing on Encrypted DataComputing on Encrypted Data
Computing on Encrypted Data
New York Technology Council
 
Cyclic code non systematic
Cyclic code non systematicCyclic code non systematic
Cyclic code non systematic
Nihal Gupta
 
A verifiable random function with short proofs and keys
A verifiable random function with short proofs and keysA verifiable random function with short proofs and keys
A verifiable random function with short proofs and keys
Aleksandr Yampolskiy
 
Using timed-release cryptography to mitigate the preservation risk of embargo...
Using timed-release cryptography to mitigate the preservation risk of embargo...Using timed-release cryptography to mitigate the preservation risk of embargo...
Using timed-release cryptography to mitigate the preservation risk of embargo...
Michael Nelson
 
Rsa Signature: Behind The Scenes
Rsa Signature: Behind The Scenes Rsa Signature: Behind The Scenes
Rsa Signature: Behind The Scenes
acijjournal
 
CRC JAVA CODE
CRC JAVA CODECRC JAVA CODE
CRC JAVA CODE
sandeep101026
 
Predicate-Preserving Collision-Resistant Hashing
Predicate-Preserving  Collision-Resistant HashingPredicate-Preserving  Collision-Resistant Hashing
Predicate-Preserving Collision-Resistant Hashing
Philippe Camacho, Ph.D.
 
Deep dive into rsa
Deep dive into rsaDeep dive into rsa
Deep dive into rsa
Bill GU
 
Quantum challenge2021 Ex1
Quantum challenge2021 Ex1Quantum challenge2021 Ex1
Quantum challenge2021 Ex1
UkyoKimura
 
1542 inner products
1542 inner products1542 inner products
1542 inner products
Dr Fereidoun Dejahang
 
Digi qestions
Digi qestionsDigi qestions
Digi qestions
Sasanka1993
 

What's hot (16)

ASFWS 2012 - Hash-flooding DoS reloaded: attacks and defenses par Jean-Philip...
ASFWS 2012 - Hash-flooding DoS reloaded: attacks and defenses par Jean-Philip...ASFWS 2012 - Hash-flooding DoS reloaded: attacks and defenses par Jean-Philip...
ASFWS 2012 - Hash-flooding DoS reloaded: attacks and defenses par Jean-Philip...
 
Hash function
Hash functionHash function
Hash function
 
Introduction to Homomorphic Encryption
Introduction to Homomorphic EncryptionIntroduction to Homomorphic Encryption
Introduction to Homomorphic Encryption
 
Secure and privacy-preserving data transmission and processing using homomorp...
Secure and privacy-preserving data transmission and processing using homomorp...Secure and privacy-preserving data transmission and processing using homomorp...
Secure and privacy-preserving data transmission and processing using homomorp...
 
On Mining Bitcoins - Fundamentals & Outlooks
On Mining Bitcoins - Fundamentals & OutlooksOn Mining Bitcoins - Fundamentals & Outlooks
On Mining Bitcoins - Fundamentals & Outlooks
 
Computing on Encrypted Data
Computing on Encrypted DataComputing on Encrypted Data
Computing on Encrypted Data
 
Cyclic code non systematic
Cyclic code non systematicCyclic code non systematic
Cyclic code non systematic
 
A verifiable random function with short proofs and keys
A verifiable random function with short proofs and keysA verifiable random function with short proofs and keys
A verifiable random function with short proofs and keys
 
Using timed-release cryptography to mitigate the preservation risk of embargo...
Using timed-release cryptography to mitigate the preservation risk of embargo...Using timed-release cryptography to mitigate the preservation risk of embargo...
Using timed-release cryptography to mitigate the preservation risk of embargo...
 
Rsa Signature: Behind The Scenes
Rsa Signature: Behind The Scenes Rsa Signature: Behind The Scenes
Rsa Signature: Behind The Scenes
 
CRC JAVA CODE
CRC JAVA CODECRC JAVA CODE
CRC JAVA CODE
 
Predicate-Preserving Collision-Resistant Hashing
Predicate-Preserving  Collision-Resistant HashingPredicate-Preserving  Collision-Resistant Hashing
Predicate-Preserving Collision-Resistant Hashing
 
Deep dive into rsa
Deep dive into rsaDeep dive into rsa
Deep dive into rsa
 
Quantum challenge2021 Ex1
Quantum challenge2021 Ex1Quantum challenge2021 Ex1
Quantum challenge2021 Ex1
 
1542 inner products
1542 inner products1542 inner products
1542 inner products
 
Digi qestions
Digi qestionsDigi qestions
Digi qestions
 

Viewers also liked

Becoming More Paranoid
Becoming More ParanoidBecoming More Paranoid
Becoming More Paranoid
David Evans
 
Asymmetric Key Signatures
Asymmetric Key SignaturesAsymmetric Key Signatures
Asymmetric Key Signatures
David Evans
 
Mining
MiningMining
Mining
David Evans
 
More mining
More miningMore mining
More mining
sameezahur
 
Class 1: What is Money?
Class 1: What is Money?Class 1: What is Money?
Class 1: What is Money?
David Evans
 
Altcoins
AltcoinsAltcoins
Altcoins
sameezahur
 
Scripting Transactions
Scripting TransactionsScripting Transactions
Scripting Transactions
David Evans
 
Midterm Confirmations
Midterm ConfirmationsMidterm Confirmations
Midterm Confirmations
David Evans
 
Anonymity in Bitcoin
Anonymity in BitcoinAnonymity in Bitcoin
Anonymity in Bitcoin
David Evans
 
Lecture 9 key distribution and user authentication
Lecture 9 key distribution and user authentication Lecture 9 key distribution and user authentication
Lecture 9 key distribution and user authentication
rajakhurram
 
Digital Signature Recognition using RSA Algorithm
Digital Signature Recognition using RSA AlgorithmDigital Signature Recognition using RSA Algorithm
Digital Signature Recognition using RSA Algorithm
Vinayak Raja
 
key distribution in network security
key distribution in network securitykey distribution in network security
key distribution in network security
babak danyal
 
Rsa Algorithm
Rsa AlgorithmRsa Algorithm
Rsa Algorithm
Ashik Iqbal
 
Public Key Cryptography and RSA algorithm
Public Key Cryptography and RSA algorithmPublic Key Cryptography and RSA algorithm
Public Key Cryptography and RSA algorithm
Indra97065
 
Digital signature
Digital signatureDigital signature
Digital signature
Hossain Md Shakhawat
 
Ch14
Ch14Ch14
Digital Signature
Digital SignatureDigital Signature
Digital Signature
saurav5884
 
Introduction to Digital signatures
Introduction to Digital signaturesIntroduction to Digital signatures
Introduction to Digital signatures
Rohit Bhat
 

Viewers also liked (18)

Becoming More Paranoid
Becoming More ParanoidBecoming More Paranoid
Becoming More Paranoid
 
Asymmetric Key Signatures
Asymmetric Key SignaturesAsymmetric Key Signatures
Asymmetric Key Signatures
 
Mining
MiningMining
Mining
 
More mining
More miningMore mining
More mining
 
Class 1: What is Money?
Class 1: What is Money?Class 1: What is Money?
Class 1: What is Money?
 
Altcoins
AltcoinsAltcoins
Altcoins
 
Scripting Transactions
Scripting TransactionsScripting Transactions
Scripting Transactions
 
Midterm Confirmations
Midterm ConfirmationsMidterm Confirmations
Midterm Confirmations
 
Anonymity in Bitcoin
Anonymity in BitcoinAnonymity in Bitcoin
Anonymity in Bitcoin
 
Lecture 9 key distribution and user authentication
Lecture 9 key distribution and user authentication Lecture 9 key distribution and user authentication
Lecture 9 key distribution and user authentication
 
Digital Signature Recognition using RSA Algorithm
Digital Signature Recognition using RSA AlgorithmDigital Signature Recognition using RSA Algorithm
Digital Signature Recognition using RSA Algorithm
 
key distribution in network security
key distribution in network securitykey distribution in network security
key distribution in network security
 
Rsa Algorithm
Rsa AlgorithmRsa Algorithm
Rsa Algorithm
 
Public Key Cryptography and RSA algorithm
Public Key Cryptography and RSA algorithmPublic Key Cryptography and RSA algorithm
Public Key Cryptography and RSA algorithm
 
Digital signature
Digital signatureDigital signature
Digital signature
 
Ch14
Ch14Ch14
Ch14
 
Digital Signature
Digital SignatureDigital Signature
Digital Signature
 
Introduction to Digital signatures
Introduction to Digital signaturesIntroduction to Digital signatures
Introduction to Digital signatures
 

Similar to Hash functions

Hashfunction
HashfunctionHashfunction
Hashfunction
Tony Nguyen
 
Hashfunction
HashfunctionHashfunction
Hashfunction
Fraboni Ec
 
Hashfunction
HashfunctionHashfunction
Hashfunction
Young Alista
 
Hashfunction
HashfunctionHashfunction
Hashfunction
Luis Goldster
 
Hashfunction
HashfunctionHashfunction
Hashfunction
David Hoen
 
Hashfunction
HashfunctionHashfunction
Hashfunction
James Wong
 
Smart City Lecture 5 - Introduction to Encryption
Smart City Lecture 5 - Introduction to EncryptionSmart City Lecture 5 - Introduction to Encryption
Smart City Lecture 5 - Introduction to Encryption
Peter Waher
 
Bitcoin MOOC Lecture 1.pptx
Bitcoin MOOC Lecture 1.pptxBitcoin MOOC Lecture 1.pptx
Bitcoin MOOC Lecture 1.pptx
Oluseyi Akindeinde
 
Cryptographic Hashing Functions
Cryptographic Hashing FunctionsCryptographic Hashing Functions
Cryptographic Hashing Functions
Yusuf Uzun
 
Webinar: MongoDB 2.4 Feature Demo and Q&A on Hash-based Sharding
Webinar: MongoDB 2.4 Feature Demo and Q&A on Hash-based ShardingWebinar: MongoDB 2.4 Feature Demo and Q&A on Hash-based Sharding
Webinar: MongoDB 2.4 Feature Demo and Q&A on Hash-based Sharding
MongoDB
 
Cryptography for Smalltalkers 2
Cryptography for Smalltalkers 2Cryptography for Smalltalkers 2
Cryptography for Smalltalkers 2
ESUG
 
Keccak
KeccakKeccak
Keccak
Rajeev Verma
 
notes.pdf
notes.pdfnotes.pdf
notes.pdf
test643768
 
Consistent hashing
Consistent hashingConsistent hashing
Consistent hashing
Jooho Lee
 
Secure hashing algorithm
Secure hashing algorithmSecure hashing algorithm
Secure hashing algorithm
Karteek Paruchuri
 
introduction to cryptography
introduction to cryptographyintroduction to cryptography
introduction to cryptography
Priyamvada Singh
 
crypto1.ppt
crypto1.pptcrypto1.ppt
crypto1.ppt
tommychauhan
 
crypto.ppt
crypto.pptcrypto.ppt
crypto.ppt
Ganesh Chavan
 
needed.ppt
needed.pptneeded.ppt
needed.ppt
faizalkhan673954
 
introduction to cryptography (basics of it)
introduction to cryptography (basics of it)introduction to cryptography (basics of it)
introduction to cryptography (basics of it)
neonaveen
 

Similar to Hash functions (20)

Hashfunction
HashfunctionHashfunction
Hashfunction
 
Hashfunction
HashfunctionHashfunction
Hashfunction
 
Hashfunction
HashfunctionHashfunction
Hashfunction
 
Hashfunction
HashfunctionHashfunction
Hashfunction
 
Hashfunction
HashfunctionHashfunction
Hashfunction
 
Hashfunction
HashfunctionHashfunction
Hashfunction
 
Smart City Lecture 5 - Introduction to Encryption
Smart City Lecture 5 - Introduction to EncryptionSmart City Lecture 5 - Introduction to Encryption
Smart City Lecture 5 - Introduction to Encryption
 
Bitcoin MOOC Lecture 1.pptx
Bitcoin MOOC Lecture 1.pptxBitcoin MOOC Lecture 1.pptx
Bitcoin MOOC Lecture 1.pptx
 
Cryptographic Hashing Functions
Cryptographic Hashing FunctionsCryptographic Hashing Functions
Cryptographic Hashing Functions
 
Webinar: MongoDB 2.4 Feature Demo and Q&A on Hash-based Sharding
Webinar: MongoDB 2.4 Feature Demo and Q&A on Hash-based ShardingWebinar: MongoDB 2.4 Feature Demo and Q&A on Hash-based Sharding
Webinar: MongoDB 2.4 Feature Demo and Q&A on Hash-based Sharding
 
Cryptography for Smalltalkers 2
Cryptography for Smalltalkers 2Cryptography for Smalltalkers 2
Cryptography for Smalltalkers 2
 
Keccak
KeccakKeccak
Keccak
 
notes.pdf
notes.pdfnotes.pdf
notes.pdf
 
Consistent hashing
Consistent hashingConsistent hashing
Consistent hashing
 
Secure hashing algorithm
Secure hashing algorithmSecure hashing algorithm
Secure hashing algorithm
 
introduction to cryptography
introduction to cryptographyintroduction to cryptography
introduction to cryptography
 
crypto1.ppt
crypto1.pptcrypto1.ppt
crypto1.ppt
 
crypto.ppt
crypto.pptcrypto.ppt
crypto.ppt
 
needed.ppt
needed.pptneeded.ppt
needed.ppt
 
introduction to cryptography (basics of it)
introduction to cryptography (basics of it)introduction to cryptography (basics of it)
introduction to cryptography (basics of it)
 

Recently uploaded

The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
dot55audits
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
HajraNaeem15
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Leena Ghag-Sakpal
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
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
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 
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
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
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
 
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
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
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
 

Recently uploaded (20)

The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
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
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 
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
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
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
 
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 ...
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 

Hash functions

  • 1. Hash Functions CS4501, Fall 2015 David Evans and Samee Zahur University of Virginia
  • 2. Hash("I, Alice, hereby pay Bob an amount of 23 mBTC") = 7abc39d0 2e0194bc d7e93192 bcdfe412
  • 3. Hash Functions in Signatures signsk 𝑚 = 𝑠 Signature algorithms require a fixed-size 𝑚!
  • 4. Hash Functions in Signatures signsk H 𝑚 = 𝑠 Signature algorithms can use a fixed-size H 𝑚
  • 5. Verifying Hashed Signatures 1. Compute ℎ = H(𝑚) 2. Run verifyvk ℎ, 𝑠 3. Accept if verify passed
  • 7. Hash("I, Alice, hereby pay Bob an amount of 23 mBTC") = 7abc39d0 2e0194bc d7e93192 bcdfe412
  • 10. Common Hash Properties 1. Collision resistance “It is hard to find any two 𝑚1, 𝑚2 such that H 𝑚1 = H(𝑚2)” 2. Second preimage resistance “For given 𝑚1, it is hard to find 𝑚2 such that H 𝑚1 = H(𝑚2)” 3. Preimage resistance (such functions are also called one-way) “For a given ℎ, it is hard to find any 𝑚 such that H 𝑚 = ℎ” 1 ⇒ 2 ⇒ 3
  • 11. Recap • Signing algorithms work on small inputs • We hash strings before signing them • We need collision-resistant hashes
  • 13. Find smallest number of people such that E pairs of common birthdays ≥ 1 Ways to pair 4 people 3 + 2 + 1 = 6 Ways to pair 𝑛 people 𝑛 − 1 + ⋯ + 3 + 2 + 1 = 𝑛 𝑛 − 1 2 = 𝑛2 − 𝑛 2 E pairs of common birthdays = 𝑛2 − 𝑛 2 × 365
  • 14. How many common pairs? E pairs = 𝑛2 − 𝑛 2 × 365 Using 𝑛 = 30: E pairs = 𝑛2−𝑛 2×365 = 900−30 2×365 = 1.192
  • 15. I wish a year had more days … If we select 𝑛 items out of 𝑁, number of repeats expected = 𝑛2 − 𝑛 2𝑁 We expect first repeat in 𝑛 = Θ( 𝑁) trials
  • 16. I was born on 0x8ca8294be… H(some input) looks like random 𝑘-bits How many trials before we find collision? 80-bit hashes have 280 possible outputs. On the order of 280 = 240 trials.
  • 17. Real-life hash functions Name Output Length (bits) Security status MD5 128 Collisions found SHA1 160 Can be broken in ~261 iterations SHA2 → SHA-256 224-512 → 256 No known attacks SHA3 224-512 No known attacks Bitcoin typically uses SHA-256(SHA-256(transaction))
  • 19. “Typical” timelines MD5 • First proposed: 1991 • Published: 1992 • First signs of trouble: 1996 • Not collision resistant: 2004 • Chosen-prefix collision: by 2007 SHA3 • Competition started: 2007 • Submission deadline: 2008 • Elimination rounds: 2008-2010 • 5 finalists announced: 2010 • Kekkak algorithm selected as winner: 2012
  • 20. Digital signatures JasonBenjamin Bitcoin transaction ID Deduplication Password storage
  • 21. Password Databases Username Password Jack.Clough 12password Betty.Smith 8c2odkw Username “Salt” Scrypt(password+salt) Jack.Clough 150FE5Btiq… PaR6mPwHBj… Betty.Smith t1Y1B67ulN… QrUaLRqFvc… Insecure Better
  • 22. Partial verification A block is a group of transactions in the Bitcoin ledger. Straightforward way: H 𝑇1 + 𝑇2 + ⋯ + 𝑇1000 = 0xa8c9239 … Verification requires me to inspect all 1000 transactions in the block.
  • 23. Merkle Tree root = 0x220c04634a… p = H(a+b) = 0x2626113d5b… q = H(c+d) = 0x305e321c3e… H(T1) = a = 0x1763023d40… H(T2) = a = 0x1c1c3a3831… H(T3) = a = 0x2955461d31… H(T4) = a = 0x160b445b5e…
  • 24. Recap • Hash functions used in lots of places: • Signatures • Unique global IDs: bitcoin transaction, Dropbox files • Password databases • File downloads • Birthday attacks: hashes with 𝑘-bit output can be expected to collide in 2 𝑘 2 iterations • Weak hashes can be broken faster: don’t use MD5, avoid SHA-1 • Merkle trees enable partial verification
  • 25. Coming up… • Problemset 1 due tomorrow: (8:29 PM) • Ori has office hours today (5 PM – 6:30 PM) • Next class topic: Bitcoin mining