SlideShare a Scribd company logo
Lect. 16- 17: Hash Functions and MAC
2
1. Introduction - Hash Function vs. MAC
2. Hash Functions
 Security Requirements
 Finding collisions – birthday paradox
 Dedicated hash functions
 SHA-1
 Hash functions based on block ciphers
Contents
3
1. Hash Functions vs. MAC
4
 Hash Function
Generate a fixed length “Fingerprint” for an arbitrary
length message
No Key involved
Must be at least One-way to be useful
 Applications
Keyed hash: MAC/ICV generation
Unkeyed hash: digital signature, password file, key
stream / pseudo-random number generator
 Constructions
Iterated hash functions (MD4-family hash functions):
MD5, SHA1, SHA2, RMD160, HAS160
Hash functions based on block ciphers:
MDC(Manipulation Detection Code)
Hash Functions
H
Message M
Message Digest D
D = H(M)
5
 MAC
 Generate a fixed length MAC for an
arbitrary length message
 A keyed hash function
 Message origin authentication
 Message integrity
 Entity authentication
 Transaction authentication
 Constructions
 Keyed hash: HMAC, KMAC
 Block cipher: CBC-MAC
 Dedicated MAC: MAA, UMAC
Message Authentication Codes (MACs)
MAC
SEND
MAC
MAC
Shared
Secret Key
6
Comparison of Hash Function & MAC
Hash
function
Arbitrary length
message
Hash
fixed length
MAC
function
Arbitrary length
message
MAC
fixed length
Secret key
 Easy to compute
 Compression: arbitrary length input to fixed length output
 Unkeyed function vs. Keyed function
7
Symmetric Authentication (MAC)
Secret key
algorithm
KAB
Shared
Secret key
between
Alice and Bob
Secret key
algorithm
KAB
yes no
Message MAC
transmit
Message MAC
MAC
Alice Bob
Shared
Secret key
between
Alice and Bob
8
Digital Signature
Hash
function
Alice’s
Public keyyes no
Message Signature transmit Message Signature
Alice Bob
Public key
algorithm
Alice’s
Private key
Hash value
Hash
function
Hash value 1
Public key
algorithm
Hash value 2
9
 MAC (Message Authentication Code)
 Generated and verified by a secret key algorithm
 Message origin authentication & Message integrity
 Schemes
 Keyed hash: HMAC
 Block cipher: CBC-MAC, XCBC-MAC
 Dedicated MAC: UMAC
 Digital Signature
 Generated and verified by a public key algorithm and a hash function
 Message origin authentication & Message integrity
 Non-repudiation
 Schemes
Hash + Digital signature algorithm
RSA; DSA, KCDSA; ECDSA, EC-KCDSA
MAC and Digital Signature
10
2. Hash Functions
11
Hash Functions – Requirements
 Definition
 Compression: arbitrary length input to fixed length output
 Ease of computation
 Security Properties
 Preimage resistance (One-wayness) :
 Given y, it is computationally infeasible to find any input x
such that y = h(x)
 2nd preimage resistance (Weak collision resistance) :
 Given x, it is computationally infeasible to find another input
x  x such that h(x) = h(x)
 Collision resistance (Strong collision resistance) :
 It is computationally infeasible to find any two distinct inputs
x and x such that h(x) = h(x)
12
Brute Force Attack on One-Way Hash Functions
h
mi
h(mi)
Given y,
find m such that
h(m) = y
n bits
h(mi) = y ?
for i = 1, 2, . . . 2n
Arbitrary message m
Or
m of the same meaning ?
13
Constructing Multiple Versions of the Same Message
I state thereby that I borrowed $10,000 from
confirm received ten thousand dollars
Mr. Kris Gaj on October 15, 2001. This money
Dr. Krzysztof 15 October amount of money
should be returned to Mr. Gaj by November 30, 2001.
is required to given back Dr. 30 November
11 different positions of similar expressions

211 different messages of the same meaning
14
Finding Collision in Collision-Resistant
Hash Functions
h
mi
h(mi)
Find any two distinct messages m, m such that h(m) = h(m).
n bits
for i = 1, 2, . . . 2m
h
mi
h(mi)
n bits
How large m should be
to get a match ?
15
Birthday Paradox
How many students there must be in a class for there be a
greater than 50% chance that
1. One of the students shares the teacher’s birthday ?
(complexity breaking one-wayness)
365/2  188
2. Any two of the students share the same birthday ?
(complexity breaking collision resistance)
1 – 365  364  . . .  (365-k+1) / 365k > 0.5  k  23
In general, the probability of a match being found when k
samples are randomly selected between 1 and n equals
( 1)
2
!
1 1
( )!
k k
n
k
n
e
n k n


  

16
One Million $ Hardware Brute Force Attack
 One-Way Hash Functions (complexity = 2n)
n = 64 n = 80 n = 128
Year 2001 4 days 718 years 1017 years
 Collision-Resistant Hash Functions (complexity = 2n/2)
n = 128 n = 160 n = 256
Year 2001 4 days 718 years 1017 years
17
f f f fIV=H0
H1 H2
Ht-1
Ht. . .
b b b b
n n n n n
n
Legend:
 IV : Initial Value
 Hi : i-th Chaining variable
 Mi : i-th input block
 f : Compression function
 g : Output transformation (optional)
 t : Number of input blocks
 b : Block size in bits
 n : Hash code size in bits
g
h(m)
General Construction of a Secure Hash Function
Message m 100…000 length
M1 M2 M3
Mt
Padding & length encoding
18
General Construction of a Secure Hash Function
f
Hi-1
Hi
Mi
b
n
n
Entire hash
Compression
Function
(fixed-size hash function)
H0 = IV
Hi = f (Hi-1, Mi) for 1  i  t
H(m) = g(Ht)
Fact(by Merkle-Damgård)
Any collision-resistant compression function f can
be extended to a collision-resistant hash function h
19
Typical Hash Padding
Message m 100…000 length
64 bit integer
(bit-length of
message m)
 Assume Block size = 512 bits (MD5, SHA1, RMD160, HAS160 …)
Last 512-bit block
Let r = |m| mod 512
If 512-r > 64
padding = 512-(r+64) bits
else
padding = 512-r+448 bits
(two padding blocks)
20
Classification of Hash Functions
Dedicated
(Customized)
Based on
block ciphers
Based on
Modular Arith.
MD2
MD4
MD5 SHA0
SHA1
RIPEMD-128
RIPEMD-160
HAS-160
MDC-1
MDC-2
MDC-4
MASH-1Broken
Broken
Broken Broken
Reduced round
Version broken
SHA2
Weakness
discovered
21
SHA (Secure Hash Algorithm) (1/2)
 SHA was designed by NIST (national institute of standards and
technology) & NSA (National Security Agency)
 US standard for use with DSA signature scheme
 The algorithm is SHA, the standard is SHS
 Based on the design of MD4 and MD5 by R. Rivest MIT
SHA-0: FIPS PUB 180, 1993
SHA-1: FIPS Pub 180-1, 1995
bitwise rotation of message schedule of SHA-0 changed
widely-used security applications and protocols such as
TLS and SSL, PGP, SSH, S/MIME, and IPsec
SHA-2: FIPS Pub 180-2, 2001
SHA-224, SHA-256, SHA-384, and SHA-512
Not so popular as SHA-1
* Federal Information Processing Standard
22
Algorithm and
variant
Output
size (bits)
Internal
state siz
e (bits)
Block
size (bits)
Max me-
ssage siz
e (bits)
Word
size (bits)
Rounds Operation
Collisions
found
SHA-0 160 160 512 264 − 1 32 80
+,and,or,
xor,rot
Yes
SHA-1 160 160 512 264 − 1 32 80
+,and,or,
xor,rot
Yes
(252
attack (*)[
SHA-2
SHA-25
6/224
256/224 256 512 264 − 1 32 64
+,and,or,
xor,shr,rot
None
SHA-51
2/384
512/384 512 1024 2128 − 1 64 80
+,and,or,
xor,shr,rot
None
SHA (Secure Hash Algorithm) (2/2)
* Cameron McDonald, Philip Hawkes and Josef Pieprzyk, SHA-1 collisions now 2^52, Eurocrypt 2009
Rump session, http://eurocrypt2009rump.cr.yp.to/ 837a0a8086fa6ca714249409ddfae43d.pdf.
23
SHA-1 Overview
round 0 f1, ABCDE, Yq, K0, w0
round 1 f2, ABCDE, Yq, K1, w1
round 79 f80, ABCDE, Yq, K79, w79
A B C D E
A B C D E



160
CVq+1
CVq
A B C D E
160
Yq
512
24
SHA-1 round function
EDCBA
EDCBA
Input buffer
Output buffer
ft
CLS5
CLS30
Wt
Kt Constants
From message
Boolean function
Cyclic left shift
25
SHA-1
Initial values
A = 6 7 4 5 2 3 0 1
B = E F C D A B 8 9
C = 9 8 B A D C F E
D = 1 0 3 2 5 4 7 6
E = C 3 D 2 E 1 F 0
Constants Kt
t = 0 ~ 19 Kt = 5 A 8 2 7 9 9 9
t = 20 ~ 39 Kt = 6 E D 9 E B A 1
t = 40 ~ 59 Kt = 8 F 1 B B C D C
t = 60 ~ 79 Kt = C A 6 2 C 1 D 6
Boolean function ft
t = 0 ~ 19 ft (B, C, D) = B · C + B · D
t = 20 ~ 39 ft (B, C, D) = B  C  D
t = 40 ~ 59 ft (B, C, D) = B · C + B · D + C · D
t = 60 ~ 79 ft (B, C, D) = B  C  D
26
SHA-1 message inputs
Yq
512-bit

32
w0
32
w1
32
w15 w16 wt w79 
CLS1
w0 w13
w2 w8
CLS1
wt–16 wt–3
wt–14 wt–8
CLS1
w63 w76
w65 w71
CLS: Cyclic Left Shift
27
Step Operations of MD5 & SHA1
A B C D E
A B C D E
fr
<<30
<<5
+
+
+
+
Mi
Kr
0 1 19. . .
. . .
D C B A
D C B A
fr
<<si
+
Mi
Kr
+
+
+
0 115
Big
endian
Little
endian
28
Step Operations of SHA1 & HAS160
A B C D E
A B C D E
fr
<<30
<<5
+
+
+
+
Mi
Kr
ABCDE
ABCDE
fr
<<sr
<<si
+
+
+
+
Mi
Kr
0 1 19 1 019
<<sr
. . . . . .
29
Comparison of Popular Hash Functions
Hash Func. MD5 SHA1 RMD160 HAS160
Digest size(bits) 128 160 160 160
Block size(bits) 512 512 512 512
No of steps 64(4x16) 80(4x20) 160(5x2x16) 80(4x20)
Boolean func. 4 4(3) 5 4(3)
Constants 64 4 9 4
Endianness Little Big Little Little
Speed ratio 1.0 0.57 0.5 0.94
30
Hash Functions Based on Block Ciphers: MDC1
Matyas-Meyer-Oseas Scheme
g: a function mapping an
input Hi to a key
suitable for E, might be
the identity function
Compression
function f
Eg
Hi
MiHi-1
block size
block size
block size
• Provably Secure under
an appropriate black-
box model
• But produces too short
hash codes for use in
most applications
31
Hash Functions Based on Block Ciphers: MDC2
Compression
function f
Mi
Hi
EgHi-1
A B
E g
C D
A D C B
Hi-1

Hi

Ex. of MD5 Collisions
32
Collision1.bin Collision2.bin
Same MD5 Hashed Value !!
Practical Collision Attacks (MD5)
• Colliding valid X.509 certificates
– Lenstra, Wang, Weger, forged X.509 certificates,
http://eprint.iacr.org/2005/067.pdf
Same owner with different public keys (2048 bits)
– Stevens, Lenstra, Weger, Eurocrypt 2007
8192-bit public key (8-block collision)
– Stevens etc. Crypto 2009
Pass the browser authentication, different owners,
different public keys (See next page.)
33
X.509v3 Real and Fake Certificates
34
SHA-3 Project
35

More Related Content

What's hot

Public Key Algorithms
Public Key AlgorithmsPublic Key Algorithms
Public Key Algorithms
Bit Hacker
 
Cryptography
CryptographyCryptography
Cryptography
David Evans
 
Introduction to Cryptography
Introduction to CryptographyIntroduction to Cryptography
Introduction to Cryptography
David Evans
 
Homomorphic Encryption
Homomorphic EncryptionHomomorphic Encryption
Homomorphic Encryption
Victor Pereira
 
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE
ShivangiSingh241
 
Tele4653 l11
Tele4653 l11Tele4653 l11
Tele4653 l11Vin Voro
 
Bch codes
Bch codesBch codes
Bch codes
Gaurav Thakur
 
Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...
Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...
Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...
Madhumita Tamhane
 
A survey on Fully Homomorphic Encryption
A survey on Fully Homomorphic EncryptionA survey on Fully Homomorphic Encryption
A survey on Fully Homomorphic Encryption
iosrjce
 
Information Theory and Coding Question Bank
Information Theory and Coding Question BankInformation Theory and Coding Question Bank
Information Theory and Coding Question Bank
miraclebabu
 
RSA-W7(rsa) d1-d2
RSA-W7(rsa) d1-d2RSA-W7(rsa) d1-d2
RSA-W7(rsa) d1-d2
Fahad Layth
 
Rsa diffi-network security-itt
Rsa diffi-network security-ittRsa diffi-network security-itt
Rsa diffi-network security-ittrameshvvv
 
Error Detection and Correction in SRAM Cell Using Decimal Matrix Code
Error Detection and Correction in SRAM Cell Using Decimal Matrix CodeError Detection and Correction in SRAM Cell Using Decimal Matrix Code
Error Detection and Correction in SRAM Cell Using Decimal Matrix Code
iosrjce
 
Hamming codes
Hamming codesHamming codes
Hamming codes
GIGI JOSEPH
 

What's hot (14)

Public Key Algorithms
Public Key AlgorithmsPublic Key Algorithms
Public Key Algorithms
 
Cryptography
CryptographyCryptography
Cryptography
 
Introduction to Cryptography
Introduction to CryptographyIntroduction to Cryptography
Introduction to Cryptography
 
Homomorphic Encryption
Homomorphic EncryptionHomomorphic Encryption
Homomorphic Encryption
 
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE
 
Tele4653 l11
Tele4653 l11Tele4653 l11
Tele4653 l11
 
Bch codes
Bch codesBch codes
Bch codes
 
Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...
Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...
Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...
 
A survey on Fully Homomorphic Encryption
A survey on Fully Homomorphic EncryptionA survey on Fully Homomorphic Encryption
A survey on Fully Homomorphic Encryption
 
Information Theory and Coding Question Bank
Information Theory and Coding Question BankInformation Theory and Coding Question Bank
Information Theory and Coding Question Bank
 
RSA-W7(rsa) d1-d2
RSA-W7(rsa) d1-d2RSA-W7(rsa) d1-d2
RSA-W7(rsa) d1-d2
 
Rsa diffi-network security-itt
Rsa diffi-network security-ittRsa diffi-network security-itt
Rsa diffi-network security-itt
 
Error Detection and Correction in SRAM Cell Using Decimal Matrix Code
Error Detection and Correction in SRAM Cell Using Decimal Matrix CodeError Detection and Correction in SRAM Cell Using Decimal Matrix Code
Error Detection and Correction in SRAM Cell Using Decimal Matrix Code
 
Hamming codes
Hamming codesHamming codes
Hamming codes
 

Viewers also liked

Plan Anual de Adquisiciones y contrataciones
Plan Anual de Adquisiciones y contratacionesPlan Anual de Adquisiciones y contrataciones
Plan Anual de Adquisiciones y contrataciones
selene12332123
 
Android Programming without Java
Android Programming without JavaAndroid Programming without Java
Android Programming without Java
Chris Ward
 
Banesco_Innovacion&CalidadServicio_RevistadeEmpresa
Banesco_Innovacion&CalidadServicio_RevistadeEmpresaBanesco_Innovacion&CalidadServicio_RevistadeEmpresa
Banesco_Innovacion&CalidadServicio_RevistadeEmpresa
Oswaldo Lorenzo
 
Directory based cache coherence
Directory based cache coherenceDirectory based cache coherence
Directory based cache coherence
Fraboni Ec
 
Reunión nacional de infraestructura hidráulica 2014
Reunión nacional de infraestructura hidráulica 2014Reunión nacional de infraestructura hidráulica 2014
Reunión nacional de infraestructura hidráulica 2014
Netzahualcóyotl Salvatierra López
 
Cupcakes
CupcakesCupcakes
Cupcakes
Darly Flores
 
ICU of the Future- Egyptian Critical Care Summit 2015
ICU of the Future- Egyptian Critical Care Summit 2015ICU of the Future- Egyptian Critical Care Summit 2015
ICU of the Future- Egyptian Critical Care Summit 2015
Dr.Mahmoud Abbas
 
Agile camp2016 accountabilitycommitment
Agile camp2016 accountabilitycommitmentAgile camp2016 accountabilitycommitment
Agile camp2016 accountabilitycommitment
Erin Bolk
 
ANZICS S&Q 2014 - Abstract Presentation: Joanne Molloy on How time of day for...
ANZICS S&Q 2014 - Abstract Presentation: Joanne Molloy on How time of day for...ANZICS S&Q 2014 - Abstract Presentation: Joanne Molloy on How time of day for...
ANZICS S&Q 2014 - Abstract Presentation: Joanne Molloy on How time of day for...
ANZICS
 
Talent Management - Manager Presentation
Talent Management - Manager PresentationTalent Management - Manager Presentation
Talent Management - Manager Presentation
Kerry Foster
 
Electron - Solving our cross platform dreams?
Electron - Solving our cross platform dreams?Electron - Solving our cross platform dreams?
Electron - Solving our cross platform dreams?
Chris Ward
 

Viewers also liked (13)

Plan Anual de Adquisiciones y contrataciones
Plan Anual de Adquisiciones y contratacionesPlan Anual de Adquisiciones y contrataciones
Plan Anual de Adquisiciones y contrataciones
 
Android Programming without Java
Android Programming without JavaAndroid Programming without Java
Android Programming without Java
 
Banesco_Innovacion&CalidadServicio_RevistadeEmpresa
Banesco_Innovacion&CalidadServicio_RevistadeEmpresaBanesco_Innovacion&CalidadServicio_RevistadeEmpresa
Banesco_Innovacion&CalidadServicio_RevistadeEmpresa
 
Directory based cache coherence
Directory based cache coherenceDirectory based cache coherence
Directory based cache coherence
 
Lesosn 5
Lesosn 5Lesosn 5
Lesosn 5
 
Reunión nacional de infraestructura hidráulica 2014
Reunión nacional de infraestructura hidráulica 2014Reunión nacional de infraestructura hidráulica 2014
Reunión nacional de infraestructura hidráulica 2014
 
Cupcakes
CupcakesCupcakes
Cupcakes
 
ICU of the Future- Egyptian Critical Care Summit 2015
ICU of the Future- Egyptian Critical Care Summit 2015ICU of the Future- Egyptian Critical Care Summit 2015
ICU of the Future- Egyptian Critical Care Summit 2015
 
Agile camp2016 accountabilitycommitment
Agile camp2016 accountabilitycommitmentAgile camp2016 accountabilitycommitment
Agile camp2016 accountabilitycommitment
 
ANZICS S&Q 2014 - Abstract Presentation: Joanne Molloy on How time of day for...
ANZICS S&Q 2014 - Abstract Presentation: Joanne Molloy on How time of day for...ANZICS S&Q 2014 - Abstract Presentation: Joanne Molloy on How time of day for...
ANZICS S&Q 2014 - Abstract Presentation: Joanne Molloy on How time of day for...
 
EVAPORATIVE cool
EVAPORATIVE coolEVAPORATIVE cool
EVAPORATIVE cool
 
Talent Management - Manager Presentation
Talent Management - Manager PresentationTalent Management - Manager Presentation
Talent Management - Manager Presentation
 
Electron - Solving our cross platform dreams?
Electron - Solving our cross platform dreams?Electron - Solving our cross platform dreams?
Electron - Solving our cross platform dreams?
 

Similar to Hashfunction

20180503_hash_based.pptx
20180503_hash_based.pptx20180503_hash_based.pptx
20180503_hash_based.pptx
nagalakshmig4
 
6.hash mac
6.hash mac6.hash mac
Blockchain Cryptography for Developers (Nakov @ BGWebSummit 2018)
Blockchain Cryptography for Developers (Nakov @ BGWebSummit 2018)Blockchain Cryptography for Developers (Nakov @ BGWebSummit 2018)
Blockchain Cryptography for Developers (Nakov @ BGWebSummit 2018)
Svetlin Nakov
 
Blockchain Cryptography for Developers (Nakov @ BlockWorld 2018, San Jose)
Blockchain Cryptography for Developers (Nakov @ BlockWorld 2018, San Jose)Blockchain Cryptography for Developers (Nakov @ BlockWorld 2018, San Jose)
Blockchain Cryptography for Developers (Nakov @ BlockWorld 2018, San Jose)
Svetlin Nakov
 
Message Authentication
Message AuthenticationMessage Authentication
Message Authentication
Ram Dutt Shukla
 
SHA
SHASHA
BCH Codes
BCH CodesBCH Codes
BCH Codes
AakankshaR
 
27-SHA1.ppt
27-SHA1.ppt27-SHA1.ppt
27-SHA1.ppt
PranjalSinha23
 
Hash Techniques in Cryptography
Hash Techniques in CryptographyHash Techniques in Cryptography
Hash Techniques in CryptographyBasudev Saha
 
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
Fraboni Ec
 
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
Young Alista
 
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
David Hoen
 
Hash& mac algorithms
Hash& mac algorithmsHash& mac algorithms
Hash& mac algorithms
Harry Potter
 
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
James Wong
 
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
Luis Goldster
 
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
Tony Nguyen
 
A Decompiler for Blackhain-Based Smart Contracts Bytecode
A Decompiler for Blackhain-Based Smart Contracts BytecodeA Decompiler for Blackhain-Based Smart Contracts Bytecode
A Decompiler for Blackhain-Based Smart Contracts Bytecode
Shakacon
 
crypto1.ppt
crypto1.pptcrypto1.ppt
crypto1.ppt
tommychauhan
 
needed.ppt
needed.pptneeded.ppt
needed.ppt
faizalkhan673954
 

Similar to Hashfunction (20)

Secure hashing algorithm
Secure hashing algorithmSecure hashing algorithm
Secure hashing algorithm
 
20180503_hash_based.pptx
20180503_hash_based.pptx20180503_hash_based.pptx
20180503_hash_based.pptx
 
6.hash mac
6.hash mac6.hash mac
6.hash mac
 
Blockchain Cryptography for Developers (Nakov @ BGWebSummit 2018)
Blockchain Cryptography for Developers (Nakov @ BGWebSummit 2018)Blockchain Cryptography for Developers (Nakov @ BGWebSummit 2018)
Blockchain Cryptography for Developers (Nakov @ BGWebSummit 2018)
 
Blockchain Cryptography for Developers (Nakov @ BlockWorld 2018, San Jose)
Blockchain Cryptography for Developers (Nakov @ BlockWorld 2018, San Jose)Blockchain Cryptography for Developers (Nakov @ BlockWorld 2018, San Jose)
Blockchain Cryptography for Developers (Nakov @ BlockWorld 2018, San Jose)
 
Message Authentication
Message AuthenticationMessage Authentication
Message Authentication
 
SHA
SHASHA
SHA
 
BCH Codes
BCH CodesBCH Codes
BCH Codes
 
27-SHA1.ppt
27-SHA1.ppt27-SHA1.ppt
27-SHA1.ppt
 
Hash Techniques in Cryptography
Hash Techniques in CryptographyHash Techniques in Cryptography
Hash Techniques in Cryptography
 
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
 
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
 
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
 
Hash& mac algorithms
Hash& mac algorithmsHash& mac algorithms
Hash& mac algorithms
 
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
 
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
 
Hash mac algorithms
Hash mac algorithmsHash mac algorithms
Hash mac algorithms
 
A Decompiler for Blackhain-Based Smart Contracts Bytecode
A Decompiler for Blackhain-Based Smart Contracts BytecodeA Decompiler for Blackhain-Based Smart Contracts Bytecode
A Decompiler for Blackhain-Based Smart Contracts Bytecode
 
crypto1.ppt
crypto1.pptcrypto1.ppt
crypto1.ppt
 
needed.ppt
needed.pptneeded.ppt
needed.ppt
 

More from Fraboni Ec

Hardware multithreading
Hardware multithreadingHardware multithreading
Hardware multithreading
Fraboni Ec
 
What is simultaneous multithreading
What is simultaneous multithreadingWhat is simultaneous multithreading
What is simultaneous multithreading
Fraboni Ec
 
Business analytics and data mining
Business analytics and data miningBusiness analytics and data mining
Business analytics and data mining
Fraboni Ec
 
Big picture of data mining
Big picture of data miningBig picture of data mining
Big picture of data mining
Fraboni Ec
 
Data mining and knowledge discovery
Data mining and knowledge discoveryData mining and knowledge discovery
Data mining and knowledge discovery
Fraboni Ec
 
Cache recap
Cache recapCache recap
Cache recap
Fraboni Ec
 
How analysis services caching works
How analysis services caching worksHow analysis services caching works
How analysis services caching works
Fraboni Ec
 
Hardware managed cache
Hardware managed cacheHardware managed cache
Hardware managed cache
Fraboni Ec
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
Fraboni Ec
 
Cobol, lisp, and python
Cobol, lisp, and pythonCobol, lisp, and python
Cobol, lisp, and python
Fraboni Ec
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
Fraboni Ec
 
Optimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessorsOptimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessors
Fraboni Ec
 
Abstraction file
Abstraction fileAbstraction file
Abstraction file
Fraboni Ec
 
Object model
Object modelObject model
Object model
Fraboni Ec
 
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
Fraboni Ec
 
Abstract class
Abstract classAbstract class
Abstract class
Fraboni Ec
 
Concurrency with java
Concurrency with javaConcurrency with java
Concurrency with java
Fraboni Ec
 
Inheritance
InheritanceInheritance
Inheritance
Fraboni Ec
 

More from Fraboni Ec (20)

Hardware multithreading
Hardware multithreadingHardware multithreading
Hardware multithreading
 
Lisp
LispLisp
Lisp
 
What is simultaneous multithreading
What is simultaneous multithreadingWhat is simultaneous multithreading
What is simultaneous multithreading
 
Business analytics and data mining
Business analytics and data miningBusiness analytics and data mining
Business analytics and data mining
 
Big picture of data mining
Big picture of data miningBig picture of data mining
Big picture of data mining
 
Data mining and knowledge discovery
Data mining and knowledge discoveryData mining and knowledge discovery
Data mining and knowledge discovery
 
Cache recap
Cache recapCache recap
Cache recap
 
How analysis services caching works
How analysis services caching worksHow analysis services caching works
How analysis services caching works
 
Hardware managed cache
Hardware managed cacheHardware managed cache
Hardware managed cache
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
Cobol, lisp, and python
Cobol, lisp, and pythonCobol, lisp, and python
Cobol, lisp, and python
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Optimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessorsOptimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessors
 
Abstraction file
Abstraction fileAbstraction file
Abstraction file
 
Object model
Object modelObject model
Object model
 
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
 
Abstract class
Abstract classAbstract class
Abstract class
 
Concurrency with java
Concurrency with javaConcurrency with java
Concurrency with java
 
Inheritance
InheritanceInheritance
Inheritance
 
Api crash
Api crashApi crash
Api crash
 

Recently uploaded

Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 

Recently uploaded (20)

Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 

Hashfunction

  • 1. Lect. 16- 17: Hash Functions and MAC
  • 2. 2 1. Introduction - Hash Function vs. MAC 2. Hash Functions  Security Requirements  Finding collisions – birthday paradox  Dedicated hash functions  SHA-1  Hash functions based on block ciphers Contents
  • 4. 4  Hash Function Generate a fixed length “Fingerprint” for an arbitrary length message No Key involved Must be at least One-way to be useful  Applications Keyed hash: MAC/ICV generation Unkeyed hash: digital signature, password file, key stream / pseudo-random number generator  Constructions Iterated hash functions (MD4-family hash functions): MD5, SHA1, SHA2, RMD160, HAS160 Hash functions based on block ciphers: MDC(Manipulation Detection Code) Hash Functions H Message M Message Digest D D = H(M)
  • 5. 5  MAC  Generate a fixed length MAC for an arbitrary length message  A keyed hash function  Message origin authentication  Message integrity  Entity authentication  Transaction authentication  Constructions  Keyed hash: HMAC, KMAC  Block cipher: CBC-MAC  Dedicated MAC: MAA, UMAC Message Authentication Codes (MACs) MAC SEND MAC MAC Shared Secret Key
  • 6. 6 Comparison of Hash Function & MAC Hash function Arbitrary length message Hash fixed length MAC function Arbitrary length message MAC fixed length Secret key  Easy to compute  Compression: arbitrary length input to fixed length output  Unkeyed function vs. Keyed function
  • 7. 7 Symmetric Authentication (MAC) Secret key algorithm KAB Shared Secret key between Alice and Bob Secret key algorithm KAB yes no Message MAC transmit Message MAC MAC Alice Bob Shared Secret key between Alice and Bob
  • 8. 8 Digital Signature Hash function Alice’s Public keyyes no Message Signature transmit Message Signature Alice Bob Public key algorithm Alice’s Private key Hash value Hash function Hash value 1 Public key algorithm Hash value 2
  • 9. 9  MAC (Message Authentication Code)  Generated and verified by a secret key algorithm  Message origin authentication & Message integrity  Schemes  Keyed hash: HMAC  Block cipher: CBC-MAC, XCBC-MAC  Dedicated MAC: UMAC  Digital Signature  Generated and verified by a public key algorithm and a hash function  Message origin authentication & Message integrity  Non-repudiation  Schemes Hash + Digital signature algorithm RSA; DSA, KCDSA; ECDSA, EC-KCDSA MAC and Digital Signature
  • 11. 11 Hash Functions – Requirements  Definition  Compression: arbitrary length input to fixed length output  Ease of computation  Security Properties  Preimage resistance (One-wayness) :  Given y, it is computationally infeasible to find any input x such that y = h(x)  2nd preimage resistance (Weak collision resistance) :  Given x, it is computationally infeasible to find another input x  x such that h(x) = h(x)  Collision resistance (Strong collision resistance) :  It is computationally infeasible to find any two distinct inputs x and x such that h(x) = h(x)
  • 12. 12 Brute Force Attack on One-Way Hash Functions h mi h(mi) Given y, find m such that h(m) = y n bits h(mi) = y ? for i = 1, 2, . . . 2n Arbitrary message m Or m of the same meaning ?
  • 13. 13 Constructing Multiple Versions of the Same Message I state thereby that I borrowed $10,000 from confirm received ten thousand dollars Mr. Kris Gaj on October 15, 2001. This money Dr. Krzysztof 15 October amount of money should be returned to Mr. Gaj by November 30, 2001. is required to given back Dr. 30 November 11 different positions of similar expressions  211 different messages of the same meaning
  • 14. 14 Finding Collision in Collision-Resistant Hash Functions h mi h(mi) Find any two distinct messages m, m such that h(m) = h(m). n bits for i = 1, 2, . . . 2m h mi h(mi) n bits How large m should be to get a match ?
  • 15. 15 Birthday Paradox How many students there must be in a class for there be a greater than 50% chance that 1. One of the students shares the teacher’s birthday ? (complexity breaking one-wayness) 365/2  188 2. Any two of the students share the same birthday ? (complexity breaking collision resistance) 1 – 365  364  . . .  (365-k+1) / 365k > 0.5  k  23 In general, the probability of a match being found when k samples are randomly selected between 1 and n equals ( 1) 2 ! 1 1 ( )! k k n k n e n k n      
  • 16. 16 One Million $ Hardware Brute Force Attack  One-Way Hash Functions (complexity = 2n) n = 64 n = 80 n = 128 Year 2001 4 days 718 years 1017 years  Collision-Resistant Hash Functions (complexity = 2n/2) n = 128 n = 160 n = 256 Year 2001 4 days 718 years 1017 years
  • 17. 17 f f f fIV=H0 H1 H2 Ht-1 Ht. . . b b b b n n n n n n Legend:  IV : Initial Value  Hi : i-th Chaining variable  Mi : i-th input block  f : Compression function  g : Output transformation (optional)  t : Number of input blocks  b : Block size in bits  n : Hash code size in bits g h(m) General Construction of a Secure Hash Function Message m 100…000 length M1 M2 M3 Mt Padding & length encoding
  • 18. 18 General Construction of a Secure Hash Function f Hi-1 Hi Mi b n n Entire hash Compression Function (fixed-size hash function) H0 = IV Hi = f (Hi-1, Mi) for 1  i  t H(m) = g(Ht) Fact(by Merkle-Damgård) Any collision-resistant compression function f can be extended to a collision-resistant hash function h
  • 19. 19 Typical Hash Padding Message m 100…000 length 64 bit integer (bit-length of message m)  Assume Block size = 512 bits (MD5, SHA1, RMD160, HAS160 …) Last 512-bit block Let r = |m| mod 512 If 512-r > 64 padding = 512-(r+64) bits else padding = 512-r+448 bits (two padding blocks)
  • 20. 20 Classification of Hash Functions Dedicated (Customized) Based on block ciphers Based on Modular Arith. MD2 MD4 MD5 SHA0 SHA1 RIPEMD-128 RIPEMD-160 HAS-160 MDC-1 MDC-2 MDC-4 MASH-1Broken Broken Broken Broken Reduced round Version broken SHA2 Weakness discovered
  • 21. 21 SHA (Secure Hash Algorithm) (1/2)  SHA was designed by NIST (national institute of standards and technology) & NSA (National Security Agency)  US standard for use with DSA signature scheme  The algorithm is SHA, the standard is SHS  Based on the design of MD4 and MD5 by R. Rivest MIT SHA-0: FIPS PUB 180, 1993 SHA-1: FIPS Pub 180-1, 1995 bitwise rotation of message schedule of SHA-0 changed widely-used security applications and protocols such as TLS and SSL, PGP, SSH, S/MIME, and IPsec SHA-2: FIPS Pub 180-2, 2001 SHA-224, SHA-256, SHA-384, and SHA-512 Not so popular as SHA-1 * Federal Information Processing Standard
  • 22. 22 Algorithm and variant Output size (bits) Internal state siz e (bits) Block size (bits) Max me- ssage siz e (bits) Word size (bits) Rounds Operation Collisions found SHA-0 160 160 512 264 − 1 32 80 +,and,or, xor,rot Yes SHA-1 160 160 512 264 − 1 32 80 +,and,or, xor,rot Yes (252 attack (*)[ SHA-2 SHA-25 6/224 256/224 256 512 264 − 1 32 64 +,and,or, xor,shr,rot None SHA-51 2/384 512/384 512 1024 2128 − 1 64 80 +,and,or, xor,shr,rot None SHA (Secure Hash Algorithm) (2/2) * Cameron McDonald, Philip Hawkes and Josef Pieprzyk, SHA-1 collisions now 2^52, Eurocrypt 2009 Rump session, http://eurocrypt2009rump.cr.yp.to/ 837a0a8086fa6ca714249409ddfae43d.pdf.
  • 23. 23 SHA-1 Overview round 0 f1, ABCDE, Yq, K0, w0 round 1 f2, ABCDE, Yq, K1, w1 round 79 f80, ABCDE, Yq, K79, w79 A B C D E A B C D E    160 CVq+1 CVq A B C D E 160 Yq 512
  • 24. 24 SHA-1 round function EDCBA EDCBA Input buffer Output buffer ft CLS5 CLS30 Wt Kt Constants From message Boolean function Cyclic left shift
  • 25. 25 SHA-1 Initial values A = 6 7 4 5 2 3 0 1 B = E F C D A B 8 9 C = 9 8 B A D C F E D = 1 0 3 2 5 4 7 6 E = C 3 D 2 E 1 F 0 Constants Kt t = 0 ~ 19 Kt = 5 A 8 2 7 9 9 9 t = 20 ~ 39 Kt = 6 E D 9 E B A 1 t = 40 ~ 59 Kt = 8 F 1 B B C D C t = 60 ~ 79 Kt = C A 6 2 C 1 D 6 Boolean function ft t = 0 ~ 19 ft (B, C, D) = B · C + B · D t = 20 ~ 39 ft (B, C, D) = B  C  D t = 40 ~ 59 ft (B, C, D) = B · C + B · D + C · D t = 60 ~ 79 ft (B, C, D) = B  C  D
  • 26. 26 SHA-1 message inputs Yq 512-bit  32 w0 32 w1 32 w15 w16 wt w79  CLS1 w0 w13 w2 w8 CLS1 wt–16 wt–3 wt–14 wt–8 CLS1 w63 w76 w65 w71 CLS: Cyclic Left Shift
  • 27. 27 Step Operations of MD5 & SHA1 A B C D E A B C D E fr <<30 <<5 + + + + Mi Kr 0 1 19. . . . . . D C B A D C B A fr <<si + Mi Kr + + + 0 115 Big endian Little endian
  • 28. 28 Step Operations of SHA1 & HAS160 A B C D E A B C D E fr <<30 <<5 + + + + Mi Kr ABCDE ABCDE fr <<sr <<si + + + + Mi Kr 0 1 19 1 019 <<sr . . . . . .
  • 29. 29 Comparison of Popular Hash Functions Hash Func. MD5 SHA1 RMD160 HAS160 Digest size(bits) 128 160 160 160 Block size(bits) 512 512 512 512 No of steps 64(4x16) 80(4x20) 160(5x2x16) 80(4x20) Boolean func. 4 4(3) 5 4(3) Constants 64 4 9 4 Endianness Little Big Little Little Speed ratio 1.0 0.57 0.5 0.94
  • 30. 30 Hash Functions Based on Block Ciphers: MDC1 Matyas-Meyer-Oseas Scheme g: a function mapping an input Hi to a key suitable for E, might be the identity function Compression function f Eg Hi MiHi-1 block size block size block size • Provably Secure under an appropriate black- box model • But produces too short hash codes for use in most applications
  • 31. 31 Hash Functions Based on Block Ciphers: MDC2 Compression function f Mi Hi EgHi-1 A B E g C D A D C B Hi-1  Hi 
  • 32. Ex. of MD5 Collisions 32 Collision1.bin Collision2.bin Same MD5 Hashed Value !!
  • 33. Practical Collision Attacks (MD5) • Colliding valid X.509 certificates – Lenstra, Wang, Weger, forged X.509 certificates, http://eprint.iacr.org/2005/067.pdf Same owner with different public keys (2048 bits) – Stevens, Lenstra, Weger, Eurocrypt 2007 8192-bit public key (8-block collision) – Stevens etc. Crypto 2009 Pass the browser authentication, different owners, different public keys (See next page.) 33
  • 34. X.509v3 Real and Fake Certificates 34