SlideShare a Scribd company logo
CMSC 414
Computer and Network Security
Lecture 5
Jonathan Katz
Message integrity
MAC functionality (review)
k k
Vrfyk(m’,t’) ??
m, t
t = Mack(m)
•Shared key k
•Sender computes a tag t on the message m
using k
•Receiver verifies the message/tag pair using k
Alice Bob
Defining security
 Attack model:
– A random key k is chosen
– Attacker is allowed to obtain t1 = MACk(m1), …, tn =
MACk(mn) for any messages m1, …, mn of its choice
 Attacker is successful if it outputs a forgery; i.e.,
(m, t) with:
– m ≠ mi for all i
– VrfyK(m, t) = 1
 For any time-bounded adversary, the probability of
a successful attack should be small
A MAC for short messages
 Let F be a block cipher with n-bit output
 To authenticate m using key k, compute
t = Fk(m)
 Vrfyk(m, t): output 1 iff t = Fk(m)
 Why is this secure?
Authenticating longer messages?
 Two widely used schemes (among several):
– CBC-MAC
– HMAC
CBC-MAC
 Fix a message length Ln, where the block cipher
has n-bit block length
 To compute MACk(m1, …, mL) do:
– Set t0 = 0n
– For i=1 to L, set ti := Fk(ti-1  mi)
– Output tL
 To verify, re-compute and check…
 [Note the similarities to (and differences from) CBC
mode encryption]
Security of CBC-MAC?
 Secure for fixed-length messages
 Insecure (as described) for variable-length
messages
– Must use secure variants of CBC-MAC if variable-
length messages will be authenticated
HMAC
 Can be viewed as a version of “hash-and-MAC”,
using collision-resistant hashing…
Hash functions
 A (cryptographic) hash function H maps arbitrary
length inputs to a fixed-length output
 Main goal is collision resistance:
– Hard to find distinct x, x’ such that H(x) = H(x’)
 Other goals
– Second pre-image resistance: given x, hard to find
x’ ≠ x with H(x) = H(x’)
– “Random-looking output”: I.e., “acts like a random
oracle”
• Controversial; more later
Hash functions in practice
 MD5
– 128-bit output
– Introduced in 1991…collision attacks found in 2004…several
extensions and improvements since then
– Still widely deployed(!)
 SHA-1
– 160-bit output
– No collisions known, but theoretical attacks exist
 SHA-2
– 256-/512-bit outputs
 Competition to design new hash standard has just begun…
Hash-and-MAC
 Hash message to short “digest”
 MAC the digest
 HMAC uses essentially this idea
H MAC
M H(M)
K
t
(Informal) sketch of security?
 Say the adversary sees tags on m1, …, mt,, and
outputs a valid forgery on m  {m1, …, mt}
 Two possibilities:
– H(m) = H(mi) for some i – collision in H
– H(m)  {H(m1), …, H(mt)} – forgery in the underlying
MAC for short messages
Encryption + integrity
 In most settings, confidentiality and integrity are
both needed
– How to obtain both?
 Use ‘encrypt-then-authenticate’
 Other natural possibilities are problematic!
lec-05-Message authentication, hashing, basic number theory.ppt
Toward public-key crypto…
Sharing keys?
 Secure sharing of a key is necessary for private-
key crypto
– How do parties share a key in the first place?
 One possibility is a secure physical channel
– E.g., in-person meeting
– Dedicated (un-tappable) phone line
– USB stick via courier service
 Another possibility: key exchange protocols
– Parties can agree on a key over a public channel
– This is amazing! (And began a revolution in crypto…)
Diffie-Hellman key exchange
 Before describing the protocol, a brief detour
through number theory…
– Modular arithmetic, Zp, Zp
*
– Generators
– The discrete logarithm assumption

More Related Content

PPTX
Lecture 2 Message Authentication
PPT
Message Authentication
PDF
Computer network (3)
PPT
lec-04-Private-key encryption, message authentication.ppt
PPTX
Cryptography and network_security
PPT
SHA New Revised Version - SHA-512 Syllabus Module 3
PPT
Chapter 15 - Security
PPT
Lecture 2 Message Authentication
Message Authentication
Computer network (3)
lec-04-Private-key encryption, message authentication.ppt
Cryptography and network_security
SHA New Revised Version - SHA-512 Syllabus Module 3
Chapter 15 - Security

Similar to lec-05-Message authentication, hashing, basic number theory.ppt (20)

PDF
Message Authentication and Hash Function.pdf
PPT
Cryptographic-Hash-Functions.ppt
PDF
Common Crypto Pitfalls
PPTX
Hashfunction
PPTX
Hashfunction
PPTX
Hashfunction
PPTX
Hashfunction
PPTX
Hash function
PPTX
Hashfunction
PPTX
Hashfunction
PPT
NSC_Unit-III_final.ppt
PPTX
20180503_hash_based.pptx
PDF
Crypto - Chunk 6.3.pdf
PDF
Cs8792 cns - unit iv
PDF
Cs8792 cns - unit iv
PPT
Network Security Lec5
PPT
introduction to cryptography (basics of it)
PPT
needed.ppt
PPT
crypto1.ppt
PPT
crypto.ppt
Message Authentication and Hash Function.pdf
Cryptographic-Hash-Functions.ppt
Common Crypto Pitfalls
Hashfunction
Hashfunction
Hashfunction
Hashfunction
Hash function
Hashfunction
Hashfunction
NSC_Unit-III_final.ppt
20180503_hash_based.pptx
Crypto - Chunk 6.3.pdf
Cs8792 cns - unit iv
Cs8792 cns - unit iv
Network Security Lec5
introduction to cryptography (basics of it)
needed.ppt
crypto1.ppt
crypto.ppt
Ad

Recently uploaded (20)

PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
composite construction of structures.pdf
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
PPT on Performance Review to get promotions
PPT
Project quality management in manufacturing
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PDF
Digital Logic Computer Design lecture notes
PPTX
Sustainable Sites - Green Building Construction
CYBER-CRIMES AND SECURITY A guide to understanding
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
composite construction of structures.pdf
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
R24 SURVEYING LAB MANUAL for civil enggi
bas. eng. economics group 4 presentation 1.pptx
PPT on Performance Review to get promotions
Project quality management in manufacturing
Embodied AI: Ushering in the Next Era of Intelligent Systems
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Digital Logic Computer Design lecture notes
Sustainable Sites - Green Building Construction
Ad

lec-05-Message authentication, hashing, basic number theory.ppt

  • 1. CMSC 414 Computer and Network Security Lecture 5 Jonathan Katz
  • 3. MAC functionality (review) k k Vrfyk(m’,t’) ?? m, t t = Mack(m) •Shared key k •Sender computes a tag t on the message m using k •Receiver verifies the message/tag pair using k Alice Bob
  • 4. Defining security  Attack model: – A random key k is chosen – Attacker is allowed to obtain t1 = MACk(m1), …, tn = MACk(mn) for any messages m1, …, mn of its choice  Attacker is successful if it outputs a forgery; i.e., (m, t) with: – m ≠ mi for all i – VrfyK(m, t) = 1  For any time-bounded adversary, the probability of a successful attack should be small
  • 5. A MAC for short messages  Let F be a block cipher with n-bit output  To authenticate m using key k, compute t = Fk(m)  Vrfyk(m, t): output 1 iff t = Fk(m)  Why is this secure?
  • 6. Authenticating longer messages?  Two widely used schemes (among several): – CBC-MAC – HMAC
  • 7. CBC-MAC  Fix a message length Ln, where the block cipher has n-bit block length  To compute MACk(m1, …, mL) do: – Set t0 = 0n – For i=1 to L, set ti := Fk(ti-1  mi) – Output tL  To verify, re-compute and check…  [Note the similarities to (and differences from) CBC mode encryption]
  • 8. Security of CBC-MAC?  Secure for fixed-length messages  Insecure (as described) for variable-length messages – Must use secure variants of CBC-MAC if variable- length messages will be authenticated
  • 9. HMAC  Can be viewed as a version of “hash-and-MAC”, using collision-resistant hashing…
  • 10. Hash functions  A (cryptographic) hash function H maps arbitrary length inputs to a fixed-length output  Main goal is collision resistance: – Hard to find distinct x, x’ such that H(x) = H(x’)  Other goals – Second pre-image resistance: given x, hard to find x’ ≠ x with H(x) = H(x’) – “Random-looking output”: I.e., “acts like a random oracle” • Controversial; more later
  • 11. Hash functions in practice  MD5 – 128-bit output – Introduced in 1991…collision attacks found in 2004…several extensions and improvements since then – Still widely deployed(!)  SHA-1 – 160-bit output – No collisions known, but theoretical attacks exist  SHA-2 – 256-/512-bit outputs  Competition to design new hash standard has just begun…
  • 12. Hash-and-MAC  Hash message to short “digest”  MAC the digest  HMAC uses essentially this idea H MAC M H(M) K t
  • 13. (Informal) sketch of security?  Say the adversary sees tags on m1, …, mt,, and outputs a valid forgery on m  {m1, …, mt}  Two possibilities: – H(m) = H(mi) for some i – collision in H – H(m)  {H(m1), …, H(mt)} – forgery in the underlying MAC for short messages
  • 14. Encryption + integrity  In most settings, confidentiality and integrity are both needed – How to obtain both?  Use ‘encrypt-then-authenticate’  Other natural possibilities are problematic!
  • 17. Sharing keys?  Secure sharing of a key is necessary for private- key crypto – How do parties share a key in the first place?  One possibility is a secure physical channel – E.g., in-person meeting – Dedicated (un-tappable) phone line – USB stick via courier service  Another possibility: key exchange protocols – Parties can agree on a key over a public channel – This is amazing! (And began a revolution in crypto…)
  • 18. Diffie-Hellman key exchange  Before describing the protocol, a brief detour through number theory… – Modular arithmetic, Zp, Zp * – Generators – The discrete logarithm assumption