SlideShare a Scribd company logo
MAC, Hashes
MAC, Message Authentication Code
Security
Secure if Pr[b=1] is negligible
ECBC-MAC
Secure as long as q << |X|½,
where |X| - length of
message, q - number of
messages.
Raw CBC-MAC is insecure
Commonly used as AES-
based MAC (CCM mode in
Wi-Fi)
CMAC is similar
PMAC, Parallelizable MAC
Incremental if F is PRP:
m[1] → m`[1]
tag` = F(k,x), where
x = F-1(k, tag)⊕F(k, m[1], P(k,1))⊕F(k, m`[1],
P(k,1))
Length-extension attack
Knowing hash(m) and len(m) it is possible to calculate hash(m||m`)
Vulnerable: Merkle–Damgård (MD5, SHA-1, SHA-2)
Not vulnerable: HMAC, SHA-3
Original Data: count=10&lat=37.351&user_id=1&long=-119.827&waffle=eggo
Original Signature: 6d5f807e23db210bc254a28be2d6759a0f5f5d99
Desired New Data: count=10&lat=37.351&user_id=1&long=-119.827&waffle=eggo&waffle=liege
New Data: count=10&lat=37.351&user_id=1&long=-119.827&waffle=eggox80x00x00
x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00
x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00
x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00
x00x00x02x28&waffle=liege
Setup function’s internal state.
New Signature: 0e41270260895979317fff3898ab85668953aaa2
Cryptographic hashes
Pre-image resistance. Infeasible to recover message from hash
Second pre-image resistance. Given m1 it is difficult to find m2 such that hash(m1)
= hash(m2)
Collision resistance. Infeasible to find pair m1, m2 such that hash(m1) = hash(m2)
Avalanche effect. One bit change in messages results in uncorrelated hashes.
Merkle-Damgard hash
f is compression function
often built from block cipher E
Fortified by Wide pipe
construction (internal state
bigger than output)
Collisions, Birthday paradox
For p < 0.5 N ≈ √(2m * p(N)), where
p - probability of collision, m - size of set,
N - size of set where collision exists
For birthdays: √(2 * 365 * 0.5) ≈ 19
For 128-bit hash: √(2 * 2128 * 0.5) ≈ 264
*IRL people’s birthdays are not uniformly distributed, unlike ideal hashes
KDF, Key derivation function
Prevents stealing of password
Makes strong key from weak short password
Slower than regular hash
Random salt prevents attack by dictionary
PBKDF2, bcrypt, scrypt, Argon2
KDF(password + pepper, salt, iterations, keylen, digest), pepper is optional
hardcoded const, digest is a hash function
HMAC
Ipad, opad - magic numbers
Secure as long as q << |T|1/2
Timing attack
Loop over all possible values of first byte and query server. Stop when response
time increased. Repeat for all bytes.
Make hash string comparator always take the same time.
Authenticated encryption
Integrity. MACs. Unforgeability under CPA.
Confidentiality. Semantic security under CPA. Encryption secure eavesdropping
only.
Integrity + Confidentiality = Authenticated encryption. Secure against tampering.
Ciphertext integrity
m1, m2, mn
c1←E(k, m1), c2, cn
b
Challenger Adversary
b = 1 if D(k, c) valid and c` not in {c1, c2, cn}
b = 0 otherwise
Has integrity if Pr[b=1] ≈ 0
k
c`
Implications
Authenticity. MiM (man in the middle) can’t can not create valid CT. (still can
replay)
Security against CCA (chosen ciphertext attack)
MAC+Encryption
Encryption key kE, MAC key kI
Standards
GCM. CTR encryption then CW-MAC (Intel accelerated)
CCM. CBC-MAC then CTR encryption (WiFI 802.11i)
EAX. CTR encryption then CMAC.
OCB, Offset Code Book
Parallelizable
Patented in U.S. but free for GNU
64Gb per key
Academy PRO: Cryptography 3

More Related Content

PDF
IPv6 for Pentester
PPT
Classical Encryption Techniques in Network Security
PDF
Cryptography With PHP
PPTX
The Cryptography has YOU
PDF
Cryptography with PHP (Workshop)
PPTX
How-to crack 43kk passwords while drinking your juice/smoozie in the Hood
PPT
Cipher techniques
PDF
Information Security Cryptography ( L03- Old Cryptography Algorithms )
IPv6 for Pentester
Classical Encryption Techniques in Network Security
Cryptography With PHP
The Cryptography has YOU
Cryptography with PHP (Workshop)
How-to crack 43kk passwords while drinking your juice/smoozie in the Hood
Cipher techniques
Information Security Cryptography ( L03- Old Cryptography Algorithms )

What's hot (20)

PDF
HMAC authentication
PPTX
Hacking cryptography: 0xdec0de01 cryptoCTF solutions and a bit more - Владими...
PDF
Is unit 5_message authentication and hash functions
PPT
Classical Encryption
PDF
basic encryption and decryption
PPTX
Symmetric ciphermodel
PPT
Message Authentication: MAC, Hashes
PPTX
HMAC - HASH FUNCTION AND DIGITAL SIGNATURES
PPT
Information and data security cryptography and network security
PPTX
SSL/POODLE: History repeats itself
PPT
Elementry Cryptography
PPT
Conventional Encryption NS2
PDF
Symmetric Cipher Model, Substitution techniques, Transposition techniques, St...
PDF
0xdec0de01 crypto CTF solutions
PPT
overview of cryptographic techniques
PPT
History of Cipher System
PPT
Elementary cryptography
PPT
Chguatda.com/cmx.p02...1
PDF
18CS2005 Cryptography and Network Security
PPTX
Crpto ppt
HMAC authentication
Hacking cryptography: 0xdec0de01 cryptoCTF solutions and a bit more - Владими...
Is unit 5_message authentication and hash functions
Classical Encryption
basic encryption and decryption
Symmetric ciphermodel
Message Authentication: MAC, Hashes
HMAC - HASH FUNCTION AND DIGITAL SIGNATURES
Information and data security cryptography and network security
SSL/POODLE: History repeats itself
Elementry Cryptography
Conventional Encryption NS2
Symmetric Cipher Model, Substitution techniques, Transposition techniques, St...
0xdec0de01 crypto CTF solutions
overview of cryptographic techniques
History of Cipher System
Elementary cryptography
Chguatda.com/cmx.p02...1
18CS2005 Cryptography and Network Security
Crpto ppt
Ad

Similar to Academy PRO: Cryptography 3 (20)

PDF
CNIT 141 7. Keyed Hashing
PDF
CNIT 141: 7. Keyed Hashing
PDF
CNIT 1417. Keyed Hashing
PPTX
Cryptography for Absolute Beginners (May 2019)
PDF
Computer network (3)
PDF
Message Authentication and Hash Function.pdf
PPT
lec-05-Message authentication, hashing, basic number theory.ppt
PDF
Applied cryptanalysis - everything else
PDF
Computer network system presentation pdf
PPT
Message Authentication Requirement-MAC
PPTX
Cryptography and network_security
PPTX
Cryptography 3 Cryptography 3 Cryptography 3
PPTX
Lecture 2 Message Authentication
PPTX
unit4- predicate logic in artificial intelligence
PPT
PPTX
Unit - 4.pptx
PDF
Cns
PDF
Cs8792 cns - unit iv
PDF
Cs8792 cns - unit iv
PPT
NSC_Unit-III_final.ppt
CNIT 141 7. Keyed Hashing
CNIT 141: 7. Keyed Hashing
CNIT 1417. Keyed Hashing
Cryptography for Absolute Beginners (May 2019)
Computer network (3)
Message Authentication and Hash Function.pdf
lec-05-Message authentication, hashing, basic number theory.ppt
Applied cryptanalysis - everything else
Computer network system presentation pdf
Message Authentication Requirement-MAC
Cryptography and network_security
Cryptography 3 Cryptography 3 Cryptography 3
Lecture 2 Message Authentication
unit4- predicate logic in artificial intelligence
Unit - 4.pptx
Cns
Cs8792 cns - unit iv
Cs8792 cns - unit iv
NSC_Unit-III_final.ppt
Ad

More from Binary Studio (20)

PPTX
Academy PRO: D3, part 3
PPTX
Academy PRO: D3, part 1
PPTX
Academy PRO: Cryptography 1
PPTX
Academy PRO: Advanced React Ecosystem. MobX
PPTX
Academy PRO: Docker. Part 4
PPTX
Academy PRO: Docker. Part 2
PPTX
Academy PRO: Docker. Part 1
PPTX
Binary Studio Academy 2017: JS team project - Orderly
PPTX
Binary Studio Academy 2017: .NET team project - Unicorn
PPTX
Academy PRO: React native - miscellaneous
PPTX
Academy PRO: React native - publish
PPTX
Academy PRO: React native - navigation
PPTX
Academy PRO: React native - building first scenes
PPTX
Academy PRO: React Native - introduction
PPTX
Academy PRO: Push notifications. Denis Beketsky
PPTX
Academy PRO: Docker. Lecture 4
PPTX
Academy PRO: Docker. Lecture 3
PPTX
Academy PRO: Docker. Lecture 2
PPTX
Academy PRO: Docker. Lecture 1
PPTX
Academy PRO: Node.js - miscellaneous. Lecture 5
Academy PRO: D3, part 3
Academy PRO: D3, part 1
Academy PRO: Cryptography 1
Academy PRO: Advanced React Ecosystem. MobX
Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 1
Binary Studio Academy 2017: JS team project - Orderly
Binary Studio Academy 2017: .NET team project - Unicorn
Academy PRO: React native - miscellaneous
Academy PRO: React native - publish
Academy PRO: React native - navigation
Academy PRO: React native - building first scenes
Academy PRO: React Native - introduction
Academy PRO: Push notifications. Denis Beketsky
Academy PRO: Docker. Lecture 4
Academy PRO: Docker. Lecture 3
Academy PRO: Docker. Lecture 2
Academy PRO: Docker. Lecture 1
Academy PRO: Node.js - miscellaneous. Lecture 5

Recently uploaded (20)

PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Programs and apps: productivity, graphics, security and other tools
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPT
Teaching material agriculture food technology
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Spectroscopy.pptx food analysis technology
“AI and Expert System Decision Support & Business Intelligence Systems”
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
20250228 LYD VKU AI Blended-Learning.pptx
NewMind AI Weekly Chronicles - August'25 Week I
Network Security Unit 5.pdf for BCA BBA.
Building Integrated photovoltaic BIPV_UPV.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Spectral efficient network and resource selection model in 5G networks
Programs and apps: productivity, graphics, security and other tools
The AUB Centre for AI in Media Proposal.docx
Chapter 3 Spatial Domain Image Processing.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Understanding_Digital_Forensics_Presentation.pptx
Teaching material agriculture food technology
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
MIND Revenue Release Quarter 2 2025 Press Release
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Unlocking AI with Model Context Protocol (MCP)
Spectroscopy.pptx food analysis technology

Academy PRO: Cryptography 3

  • 4. ECBC-MAC Secure as long as q << |X|½, where |X| - length of message, q - number of messages. Raw CBC-MAC is insecure Commonly used as AES- based MAC (CCM mode in Wi-Fi) CMAC is similar
  • 5. PMAC, Parallelizable MAC Incremental if F is PRP: m[1] → m`[1] tag` = F(k,x), where x = F-1(k, tag)⊕F(k, m[1], P(k,1))⊕F(k, m`[1], P(k,1))
  • 6. Length-extension attack Knowing hash(m) and len(m) it is possible to calculate hash(m||m`) Vulnerable: Merkle–Damgård (MD5, SHA-1, SHA-2) Not vulnerable: HMAC, SHA-3 Original Data: count=10&lat=37.351&user_id=1&long=-119.827&waffle=eggo Original Signature: 6d5f807e23db210bc254a28be2d6759a0f5f5d99 Desired New Data: count=10&lat=37.351&user_id=1&long=-119.827&waffle=eggo&waffle=liege New Data: count=10&lat=37.351&user_id=1&long=-119.827&waffle=eggox80x00x00 x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00 x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00 x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00 x00x00x02x28&waffle=liege Setup function’s internal state. New Signature: 0e41270260895979317fff3898ab85668953aaa2
  • 7. Cryptographic hashes Pre-image resistance. Infeasible to recover message from hash Second pre-image resistance. Given m1 it is difficult to find m2 such that hash(m1) = hash(m2) Collision resistance. Infeasible to find pair m1, m2 such that hash(m1) = hash(m2) Avalanche effect. One bit change in messages results in uncorrelated hashes.
  • 8. Merkle-Damgard hash f is compression function often built from block cipher E Fortified by Wide pipe construction (internal state bigger than output)
  • 9. Collisions, Birthday paradox For p < 0.5 N ≈ √(2m * p(N)), where p - probability of collision, m - size of set, N - size of set where collision exists For birthdays: √(2 * 365 * 0.5) ≈ 19 For 128-bit hash: √(2 * 2128 * 0.5) ≈ 264 *IRL people’s birthdays are not uniformly distributed, unlike ideal hashes
  • 10. KDF, Key derivation function Prevents stealing of password Makes strong key from weak short password Slower than regular hash Random salt prevents attack by dictionary PBKDF2, bcrypt, scrypt, Argon2 KDF(password + pepper, salt, iterations, keylen, digest), pepper is optional hardcoded const, digest is a hash function
  • 11. HMAC Ipad, opad - magic numbers Secure as long as q << |T|1/2
  • 12. Timing attack Loop over all possible values of first byte and query server. Stop when response time increased. Repeat for all bytes. Make hash string comparator always take the same time.
  • 13. Authenticated encryption Integrity. MACs. Unforgeability under CPA. Confidentiality. Semantic security under CPA. Encryption secure eavesdropping only. Integrity + Confidentiality = Authenticated encryption. Secure against tampering.
  • 14. Ciphertext integrity m1, m2, mn c1←E(k, m1), c2, cn b Challenger Adversary b = 1 if D(k, c) valid and c` not in {c1, c2, cn} b = 0 otherwise Has integrity if Pr[b=1] ≈ 0 k c`
  • 15. Implications Authenticity. MiM (man in the middle) can’t can not create valid CT. (still can replay) Security against CCA (chosen ciphertext attack)
  • 17. Standards GCM. CTR encryption then CW-MAC (Intel accelerated) CCM. CBC-MAC then CTR encryption (WiFI 802.11i) EAX. CTR encryption then CMAC.
  • 18. OCB, Offset Code Book Parallelizable Patented in U.S. but free for GNU 64Gb per key