1 / 62
What is a hash function?
By a hash function we usually mean a map h : D 0, 1
n
that is
compressing, meaning [D[ > 2
n
.
E.g. D = 0, 1
2
64
is the set of all strings of length at most 2
64
.
h n
MD4 128
MD5 128
SHA1 160
RIPEMD 128
RIPEMD160 160
SHA256 256
Skein 256, 512, 1024
2 / 62
Collision resistance (CR)
Denition: A collision for h : D 0, 1
n
is a pair x
1
, x
2
D of points
such that h(x
1
) = h(x
2
) but x
1
,= x
2
.
If [D[ > 2
n
then the pigeonhole principle tells us that there must exist a
collision for h.
3 / 62
Collision resistance (CR)
Denition: A collision for h : D 0, 1
n
is a pair x
1
, x
2
D of points
such that h(x
1
) = h(x
2
) but x
1
,= x
2
.
If [D[ > 2
n
then the pigeonhole principle tells us that there must exist a
collision for h.
3 / 62
Collision resistance (CR)
Denition: A collision for h : D 0, 1
n
is a pair x
1
, x
2
D of points
such that h(x
1
) = h(x
2
) but x
1
,= x
2
.
If [D[ > 2
n
then the pigeonhole principle tells us that there must exist a
collision for h.
Function h is collisionresistant if it is computationally infeasible to nd
a collision.
3 / 62
Function families
We consider a family H : 0, 1
k
D 0, 1
n
of functions, meaning
for each K we have a map h = H
K
: D 0, 1
n
dened by
h(x) = H(K, x)
Usage: K
$
0, 1
k
is made public, dening hash function h = H
K
.
Note the key K is not secret. Both users and adversaries get it.
4 / 62
CR of function families
Let H : 0, 1
k
D 0, 1
n
be a family of functions. A cradversary
A for H
Takes input a key K 0, 1
k
Outputs a pair x
1
, x
2
D of points in the domain of H
K
A
x
1
, x
2
A wins if x
1
, x
2
are a collision for H
K
, meaning
x
1
,= x
2
, and
H
K
(x
1
) = H
K
(x
2
)
Denote by Adv
cr
H
(A) the probability that A wins.
5 / 62
CR of function families
Let H : 0, 1
k
D 0, 1
n
be a family of functions and A a
cradversary for H.
Game CR
H
procedure Initialize
K
$
0, 1
k
Return K
procedure Finalize(x
1
, x
2
)
Return (x
1
,= x
2
H
K
(x
1
) = H
K
(x
2
))
Let
Adv
cr
H
(A) = Pr
CR
A
H
true
.
6 / 62
The measure of success
Let H: 0, 1
k
D 0, 1
n
be a family of functions and A a cr
adversary. Then
Adv
cr
H
(A) = Pr
CR
A
H
true
.
is a number between 0 and 1.
A large (close to 1) advantage means
A is doing well
H is not secure
A small (close to 0) advantage means
A is doing poorly
H resists the attack A is mounting
7 / 62
CR security
Adversary advantage depends on its
strategy
resources: Running time t
Security: H is CR if Adv
cr
H
(A) is small for ALL A that use
practical amounts of resources.
Insecurity: H is insecure (not CR) if there exists A using few
resources that achieves high advantage.
In notes we sometimes refer to CR as CRKK2.
8 / 62
Example
Let H: 0, 1
k
0, 1
256
0, 1
128
be dened by
H
K
(x) = H
K
(x[1]x[2]) = AES
K
(x[1]) AES
K
(x[2])
Is H collision resistant?
9 / 62
Example
Let H: 0, 1
k
0, 1
256
0, 1
128
be dened by
H
K
(x) = H
K
(x[1]x[2]) = AES
K
(x[1]) AES
K
(x[2])
Is H collision resistant?
Can you design an adversary A
K
A
x
1
= x
1
[1]x
1
[2]
x
2
= x
2
[1]x
2
[2]
such that H
K
(x
1
) = H
K
(x
2
)?
9 / 62
Example
Let H: 0, 1
k
0, 1
256
0, 1
128
be dened by
H
K
(x) = H
K
(x[1]x[2]) = AES
K
(x[1]) AES
K
(x[2])
Weakness:
H
K
(x[1]x[2]) = H
K
(x[2]x[1])
adversary A
x
1
0
128
1
128
; x
2
1
128
0
128
; return x
1
, x
2
Then
Adv
cr
H
(A) = 1
and A is ecient, so H is not CR.
10 / 62
SHA1
algorithm SHA1(M) // [M[ < 2
64
V SHF1( 5A827999  6ED9EBA1  8F1BBCDC  CA62C1D6, M )
return V
algorithm SHF1(K, M) // [K[ = 128 and [M[ < 2
64
y shapad(M)
Parse y as M
1
 M
2
  M
n
where [M
i
[ = 512 (1 i n)
V 67452301  EFCDAB89  98BADCFE  10325476  C3D2E1F0
for i = 1, . . . , n do
V shf1(K, M
i
 V)
return V
algorithm shapad(M) // [M[ < 2
64
d (447 [M[) mod 512
Let be the 64bit binary representation of [M[
y M  1  0
d
 // [y[ is a multiple of 512
return y 11 / 62
SHA1
algorithm shf1(K, B  V) // [K[ = 128, [B[ = 512 and [V[ = 160
Parse B as W
0
 W
1
  W
15
where [W
i
[ = 32 (0 i 15)
Parse V as V
0
 V
1
  V
4
where [V
i
[ = 32 (0 i 4)
Parse K as K
0
 K
1
 K
2
 K
3
where [K
i
[ = 32 (0 i 3)
for t = 16 to 79 do W
t
ROTL
1
(W
t3
W
t8
W
t14
W
t16
)
A V
0
; B V
1
; C V
2
; D V
3
; E V
4
for t = 0 to 19 do L
t
K
0
; L
t+20
K
1
; L
t+40
K
2
; L
t+60
K
3
for t = 0 to 79 do
if (0 t 19) then f (B C) ((B) D)
if (20 t 39 OR 60 t 79) then f B C D
if (40 t 59) then f (B C) (B D) (C D)
temp ROTL
5
(A) + f + E + W
t
+ L
t
E D ; D C ; C ROTL
30
(B) ; B A; A temp
V
0
V
0
+A; V
1
V
1
+B ; V
2
V
2
+C ; V
3
V
3
+D ; V
4
V
4
+E
V V
0
 V
1
 V
2
 V
3
 V
4
return V
12 / 62
Applications of hash functions
primitive in cryptographic schemes
tool for security applications
tool for nonsecurity applications
13 / 62
Password verication
Client A has a password PW that is also held by server B
A authenticates itself by sending PW to B over a secure channel
(SSL)
A
PW
PW
 B
PW
Problem: The password will be found by an attacker who compromises
the server.
14 / 62
Password verication
Client A has a password PW and server stores PW = H(PW).
A sends PW to B (over a secure channel) and B checks that
H(PW) = PW
A
PW
PW
 B
PW
Server compromise results in attacker getting PW which should not
reveal PW as long as H is oneway, which we will see is a consequence
of collisionresistance.
But we will revisit this when we consider dictionary attacks!
15 / 62
Comparebyhash
A has a large le F
A
and B has a large le F
B
. For example, music
collections.
They want to know whether F
A
= F
B
A sends F
A
to B and B checks whether F
A
= F
B
A
F
A
F
A
 B
F
B
Problem: Transmission could take forever, particularly if the link is slow
(DSL).
16 / 62
Comparebyhash
A has a large le F
A
and B has a large le F
B
and they want to
know whether F
A
= F
B
A computes h
A
= H(F
A
) and sends it to B, and B checks whether
h
A
= H(F
B
).
A
F
A
h
A
 B
F
B
Collisionresistance of H guarantees that B does not accept if F
A
,= F
B
!
17 / 62
Comparebyhash
A has a large le F
A
and B has a large le F
B
and they want to
know whether F
A
= F
B
A computes h
A
= H(F
A
) and sends it to B, and B checks whether
h
A
= H(F
B
).
A
F
A
h
A
 B
F
B
Collisionresistance of H guarantees that B does not accept if F
A
,= F
B
!
Added bonus: This to some extent protects privacy of F
A
, F
B
. But be
careful: not in the strong INDCPA sense we have studied.
17 / 62
Virus protection
An executable may be available at lots of sites S
1
, S
2
, . . . , S
N
. Which
one can you trust?
Provide a safe way to get the hash h = H(X) of the correct
executable X.
Download an executable from anywhere, and check hash.
18 / 62
General collisionnding attacks
We discuss attacks on H : 0, 1
k
D 0, 1
n
that do no more than
compute H. Let D
1
, . . . , D
d
be some enumeration of the elements of D.
Adversary A
1
(K)
x
1
$
D; y H
K
(x
1
)
For i = 1, . . . , q do
If (H
K
(D
i
) = y x
1
,= D
i
) then
Return x
1
, D
i
Return FAIL
Adversary A
2
(K)
x
1
$
D; y H
K
(x
1
)
For i = 1, . . . , q do
x
2
$
D
If (H
K
(x
2
) = y x
1
,= x
2
) then
Return x
1
, x
2
Return FAIL
Now:
A
1
could take q = d = [D[ trials to succeed.
We expect A
2
to succeed in about 2
n
trials.
But this still means 2
160
trials to nd a SHA1 collision.
19 / 62
Birthday attacks
Let H : 0, 1
k
D 0, 1
n
be a family of functions with [D[ > 2
n
.
The qtrial birthday attack nds a collision with probability about
q
2
2
n+1
.
So a collision can be found in about q =
2
n+1
2
n/2
trials.
20 / 62
Recall Birthday Problem
for i = 1, . . . , q do y
i
$
0, 1
n
if i , j (i ,= j and y
i
= y
j
) then COLL true
Pr [COLL] = C(2
n
, q)
q
2
2
n+1
21 / 62
Birthday attack
Let H : 0, 1
k
D 0, 1
n
.
adversary A(K)
for i = 1, . . . , q do x
i
$
D ; y
i
H
K
(x
i
)
if i , j (i ,= j and y
i
= y
j
and x
i
,= x
j
) then return x
i
, x
j
else return FAIL
22 / 62
Analysis of birthday attack
Let H : 0, 1
k
D 0, 1
n
.
adversary A(K)
for i = 1, . . . , q do x
i
$
D ; y
i
H
K
(x
i
)
if i , j (i ,= j and y
i
= y
j
and x
i
,= x
j
) then return x
i
, x
j
else return FAIL
What is the probability that this attack nds a collision?
adversary A(K)
for i = 1, . . . , q do x
i
$
D ; y
i
H
K
(x
i
)
if i , j (i ,= j and y
i
= y
j
) then COLL true
We have dropped things that dont much aect the advantage and
focused on success probability. So we want to know what is
Pr [COLL] .
23 / 62
Analysis of birthday attack
Birthday
for i = 1, . . . , q do
y
i
$
0, 1
n
if i , j (i ,= j and y
i
= y
j
) then
COLL true
Pr [COLL] = C(2
n
, q)
Adversary A
for i = 1, . . . , q do
x
i
$
D ; y
i
H
K
(x
i
)
if i , j (i ,= j and y
i
= y
j
) then
COLL true
Pr [COLL] =?
Are the two collision probabilities the same?
24 / 62
Analysis of birthday attack
Birthday
for i = 1, . . . , q do
y
i
$
0, 1
n
if i , j (i ,= j and y
i
= y
j
) then
COLL true
Pr [COLL] = C(2
n
, q)
Adversary A
for i = 1, . . . , q do
x
i
$
D ; y
i
H
K
(x
i
)
if i , j (i ,= j and y
i
= y
j
) then
COLL true
Pr [COLL] =?
Are the two collision probabilities the same?
Not necessarily, because
on the left y
i
$
0, 1
n
on the right x
i
$
D ; y
i
H
K
(x
i
)
24 / 62
Analysis of birthday attack
Consider the following processes
Process 1
y
$
0, 1
n
return y
Process 2
x
$
D; y
$
H
K
(x)
return y
Process 1 certainly returns a random nbit string. Does Process 2?
25 / 62
Analysis of birthday attack
Process 1
y
$
0, 1
return y
Process 2
x
$
a,b,c,d ; y H
K
(x)
return y
Pr[y = 0] =
Pr[y = 1] =
Pr[y = 0] =
Pr[y = 1] =
26 / 62
Analysis of birthday attack
Process 1
y
$
0, 1
return y
Process 2
x
$
a,b,c,d ; y H
K
(x)
return y
Pr[y = 0] =
1
2
Pr[y = 1] =
1
2
Pr[y = 0] =
Pr[y = 1] =
26 / 62
Analysis of birthday attack
Process 1
y
$
0, 1
return y
Process 2
x
$
a,b,c,d ; y H
K
(x)
return y
Pr[y = 0] =
1
2
Pr[y = 1] =
1
2
Pr[y = 0] =
3
4
Pr[y = 1] =
1
4
26 / 62
Analysis of birthday attack
Process 1
y
$
0, 1
return y
Process 2
x
$
a,b,c,d ; y H
K
(x)
return y
Pr[y = 0] =
Pr[y = 1] =
Pr[y = 0] =
Pr[y = 1] =
27 / 62
Analysis of birthday attack
Process 1
y
$
0, 1
return y
Process 2
x
$
a,b,c,d ; y H
K
(x)
return y
Pr[y = 0] =
1
2
Pr[y = 1] =
1
2
Pr[y = 0] =
1
2
Pr[y = 1] =
1
2
The processes are the same if every range point has the same number of
preimages.
27 / 62
Analysis of birthday attack
We say that H : 0, 1
k
D 0, 1
n
is regular if every range point
has the same number of preimages under H
K
. That is if we let
H
1
K
(y) = x D : H
K
(x) = y
then H is regular if
[H
1
K
(y)[ =
[D[
2
n
for all K and y. In this case the following processes both result in a
random output
Process 1
y
$
0, 1
n
return y
Process 2
x
$
D; y
$
H
K
(x)
return y
28 / 62
Analysis of birthday attack
If H: 0, 1
k
D 0, 1
n
is regular then the birthday attack nds a
collision in about 2
n/2
trials.
29 / 62
Analysis of birthday attack
If H: 0, 1
k
D 0, 1
n
is regular then the birthday attack nds a
collision in about 2
n/2
trials.
If H is not regular, the attack may succeed sooner.
So we want functions to be close to regular.
It seems MD4,MD5,SHA1,RIPEMD,... have this property.
29 / 62
Birthday attack times
Function n T
B
MD4 128 2
64
MD5 128 2
64
SHA1 160 2
80
RIPEMD160 160 2
80
SHA256 256 2
128
T
B
is the number of trials to nd collisions via a birthday attack.
30 / 62
Compression functions
A compression function is a family h : 0, 1
k
0, 1
b+n
0, 1
n
of
hash functions whose inputs are of a xed size b + n, where b is called
the block size.
E.g. b = 512 and n = 160, in which case
h : 0, 1
k
0, 1
672
0, 1
160
h
K
v
x
h
K
(x  v)
31 / 62
The MD transform
Design principle: To build a CR hash function
H : 0, 1
k
D 0, 1
n
where D = 0, 1
2
64
:
First build a CR compression function
h : 0, 1
k
0, 1
b+n
0, 1
n
.
Appropriately iterate h to get H, using h to hash blockbyblock.
32 / 62
MD setup
Assume for simplicity that [M[ is a multiple of b. Let
M
b
be the number of bbit blocks in M, and write
M = M[1] . . . M[] where = M
b
.
i ) denote the bbit binary representation of i 0, . . . , 2
b
1.
D be the set of all strings of at most 2
b
1 blocks, so that
M
b
0, . . . , 2
b
1 for any M D, and thus M
b
can be
encoded as above.
33 / 62
MD transform
Given: Compression function h : 0, 1
k
0, 1
b+n
0, 1
n
.
Build: Hash function H : 0, 1
k
D 0, 1
n
.
Algorithm H
K
(M)
m M
b
; M[m + 1] m) ; V[0] 0
n
For i = 1, . . . , m + 1 do v[i ] h
K
(M[i ][[V[i 1])
Return V[m + 1]
h
K
0
n
2) M[2] M[1]
h
K
h
K
H
K
(M)
34 / 62
MD preserves CR
Assume
h is CR
H is built from h using MD
Then
H is CR too!
This means
No need to attack H! You wont nd a weakness in it unless h has
one
H is guaranteed to be secure assuming h is.
For this reason, MD is the design used in many current hash functions.
Newer hash functions use other iteration methods with analogous
properties.
35 / 62
MD preserves CR
Theorem: Let h : 0, 1
k
0, 1
b+n
0, 1
n
be a family of
functions and let H : 0, 1
k
D 0, 1
n
be obtained from h via the
MD transform. Then for any cradversary A
H
there exists a cradversary
A
h
such that
Adv
cr
H
(A
H
) Adv
cr
h
(A
h
)
and the running time of A
h
is that of A
H
plus the time for computing h
on the outputs of A
H
.
Implication:
h CR Adv
cr
H
(A
h
) small
Adv
cr
H
(A
H
) small
H CR
36 / 62
How A
h
works
Let (M
1
, M
2
) be the H
K
collision returned by A
H
. The A
h
will trace the
chains backwards to nd an h
k
collision.
37 / 62
Case 1: M
1

b
,= M
2

b
Let x
1
= 2)[[V
1
[2] and x
2
= 1)[[V
2
[1]. Then
h
K
(x
1
) = h
K
(x
2
) because H
K
(M
1
) = H
K
(M
2
).
But x
1
,= x
2
because 1) , = 2).
38 / 62
Case 2: M
1

b
= M
2

b
x
1
2)[[V
1
[2] ; x
2
2)[[V
2
[2]
If x
1
,= x
2
then return x
1
, x
2
39 / 62
Case 2: M
1

b
= M
2

b
x
1
2)[[V
1
[2] ; x
2
2)[[V
2
[2]
If x
1
,= x
2
then return x
1
, x
2
Else // V
1
[2] = V
2
[2]
39 / 62
Case 2: M
1

b
= M
2

b
x
1
2)[[V
1
[2] ; x
2
2)[[V
2
[2]
If x
1
,= x
2
then return x
1
, x
2
Else // V
1
[2] = V
2
[2]
x
1
M
1
[2][[V
1
[1] ; x
2
M
2
[2][[V
2
[1]
If x
1
,= x
2
then return x
1
, x
2
39 / 62
Case 2: M
1

b
= M
2

b
x
1
2)[[V
1
[2] ; x
2
2)[[V
2
[2]
If x
1
,= x
2
then return x
1
, x
2
Else // V
1
[2] = V
2
[2]
x
1
M
1
[2][[V
1
[1] ; x
2
M
2
[2][[V
2
[1]
If x
1
,= x
2
then return x
1
, x
2
Else // V
1
[1] = V
2
[1]
39 / 62
Case 2: M
1

b
= M
2

b
x
1
2)[[V
1
[2] ; x
2
2)[[V
2
[2]
If x
1
,= x
2
then return x
1
, x
2
Else // V
1
[2] = V
2
[2]
x
1
M
1
[2][[V
1
[1] ; x
2
M
2
[2][[V
2
[1]
If x
1
,= x
2
then return x
1
, x
2
Else // V
1
[1] = V
2
[1]
x
1
M
1
[1][[0
n
; x
2
M
2
[1][[0
n
Return x
1
, x
2
39 / 62
How are compression functions designed?
Let E : 0, 1
b
0, 1
n
0, 1
n
be a block cipher. Let us design
keyless compression function
h : 0, 1
b+n
0, 1
n
by
h(x[[v) = E
x
(v)
Is H collision resistant?
40 / 62
How are compression functions designed?
Let E : 0, 1
b
0, 1
n
0, 1
n
be a block cipher. Let us design
keyless compression function
h : 0, 1
b+n
0, 1
n
by
h(x[[v) = E
x
(v)
Is H collision resistant?
NO!
adversary A
Pick some x
1
, x
2
, v
1
with x
1
,= x
2
y E
x
1
(v
1
) ; v
2
E
1
x
2
(y)
return x
1
 v
1
, x
2
 v
2
Then
E
x
1
(v
1
) = y = E
x
2
(v
2
)
40 / 62
How are compression functions designed?
Let E : 0, 1
b
0, 1
n
0, 1
n
be a block cipher. Keyless
compression function
h : 0, 1
b+n
0, 1
n
may be designed as
h(x[[v) = E
x
(v) v
The compression function of SHA1 is underlain in this way by a block
cipher E : 0, 1
512
0, 1
160
0, 1
160
.
41 / 62
Cryptanalytic attacks
So far we have looked at attacks that do not attempt to exploit the
structure of H.
Can we do better than birthday if we do exploit the structure?
Ideally not, but functions have fallen short!
42 / 62
Cryptanalytic attacks against hash functions
When Against Time Who
1993,1996 md5 2
16
[dBBo,Do]
2005 RIPEMD 2
18
2004 SHA0 2
51
[JoCaLeJa]
2005 SHA0 2
40
[WaFeLaYu]
2005 SHA1 2
69
, 2
63
[WaYiYu,WaYaYa]
2009 SHA1 2
52
[MHP]
2005,2006 MD5 1 minute [WaFeLaYu,LeWadW,Kl]
md5 is the compression function of MD5
SHA0 is an earlier, weaker version of SHA1
43 / 62
Security of MD5
MD5 is used in 720 dierent places in Microsoft Windows OS.
What can current attacks do against MD5?
Find 2 randomlooking messages that only dier in 3 bits (boring)
Find two PDF documents whose hashes collide (more exciting)
Find two Win32 executables whose hashes collide (very exciting)
Break deployed cryptographic protocols (very exciting)
44 / 62
Finding collisions
How do attacks work in reality against MD5? Examples:
Find 2 randomlooking messages that only dier in 3 bits
Cochrans code for MD5:
http://www.cs.colorado.edu/
~
jrblack/md5toolkit.tar.gz
Works in a few minutes on laptop...try it!
Find 2 Win32 executables whose hashes collide
Swiss group:
http://www.win.tue.nl/hashclash/SoftIntCodeSign/
Takes 2 days on a Playstation 3
45 / 62
Status of SHA1
No collisions yet...
46 / 62
Status of SHA1
No collisions yet...
You can help nd the rst ever messages that collide under SHA1!
http://boinc.iaik.tugraz.at/
46 / 62
SHA3
National Institute for Standards and Technology (NIST) is holding a
worldwide competition to develop a new hash function standard.
Contest webpage:
http://csrc.nist.gov/groups/ST/hash/index.html
Requested parameters:
Design: Family of functions with 224, 256, 384, 512 bit output sizes
Compatibility: existing cryptographic standards
Security: CR, onewayness, nearcollision resistance, others...
Eciency: as fast or faster than SHA256
47 / 62
SHA3
Submissions: 64
Round 1: 51 Round 2: 14
The round 2 functions: BLAKE, Blue Midnight Wish, CubeHash,
ECHO, Fugue, Grostl, Hamsi, JH, Keccak, Lua, Shabal, SHAvite3,
SIMD, Skein.
Final round candidates to be announced in 2010 and winner in 2012.
http://ehash.iaik.tugraz.at/wiki/The_SHA3_Zoo
48 / 62
Onewayness
Let H : 0, 1
k
D 0, 1
n
be a family of functions.
We say that x
D is a preimage of y 0, 1
n
under H
K
if
H
K
(x
) = y.
Informally: H is oneway if given y and K it is hard to nd a preimage
of y under H
K
.
49 / 62
Password verication
Client A has a password PW and server stores PW = H(PW).
A sends PW to B (over a secure channel) and B checks that
H(PW) = PW
A
PW
PW
 B
PW
Server compromise results in attacker getting PW which should not
reveal PW as long as H is oneway, which we will see is a consequence
of collisionresistance.
But we will revisit this when we consider dictionary attacks!
50 / 62
Onewayness adversaries
Let H : 0, 1
k
D 0, 1
n
be a family of functions. A OW 
adversary I
gets input a key K
gets input some y = H
K
(x) D
Tries to compute a preimage of y under H
K
K
y
I x
51 / 62
Issues in formalizing onewayness
Suppose H
K
(0
n
) = 0
n
for all K. Then it is easy to invert H
K
at y = 0
n
because we know a preimage of 0
n
under H
K
: it is simply x
= 0
n
.
Should this mean H is not oneway?
Turns out what is useful is to ask that it be hard to nd a preimage of
the image of a random point.
52 / 62
Formal denition of onewayness
Let H : 0, 1
k
D 0, 1
n
be a family of functions with D nite,
and A a OWadversary.
Game OW
H
procedure Initialize
K
$
0, 1
k
;
x
$
D ; y H
K
(x)
return K, y
procedure Finalize(x
)
return (H
K
(x
) = y)
The owadvantage of A is
Adv
ow
H
(A) = Pr[OW
A
H
true].
53 / 62
Generic attacks on onewayness
For any H : 0, 1
k
D 0, 1
n
There is an attack that inverts H in about 2
n
trials
But the birthday attack does not apply.
54 / 62
Does CR imply OW?
Let H : 0, 1
k
D 0, 1
n
.
Given: Adversary A attacking onewayness of H, meaning A(K, y)
returns x
2
satisfying H
K
(x
2
) = y.
Want: Adversary B attacking collision resistance of H, meaning B(K)
returns x
1
, x
2
satisfying H
K
(x
1
) = H
K
(x
2
) and x
1
,= x
2
.
Adversary B(K)
x
1
$
D; y H
K
(x
1
); x
2
$
A(K, y)
return x
1
, x
2
A succeeds H
K
(x
2
) = y
H
K
(x
2
) = H
K
(x
1
)
B succeeds?
55 / 62
Does CR imply OW?
Let H : 0, 1
k
D 0, 1
n
.
Given: Adversary A attacking onewayness of H, meaning A(K, y)
returns x
2
satisfying H
K
(x
2
) = y.
Want: Adversary B attacking collision resistance of H, meaning B(K)
returns x
1
, x
2
satisfying H
K
(x
1
) = H
K
(x
2
) and x
1
,= x
2
.
Adversary B(K)
x
1
$
D; y H
K
(x
1
); x
2
$
A(K, y)
return x
1
, x
2
A succeeds H
K
(x
2
) = y
H
K
(x
2
) = H
K
(x
1
)
B succeeds?
Problem: May have x
1
= x
2
.
55 / 62
CR OW
Counter example: Let H : 0, 1
k
0, 1
n
0, 1
n
be dened by
H
K
(x) = x
Then
H is CR since it is impossible to nd x
1
,= x
2
with
H
K
(x
1
) = H
K
(x
2
).
But H is not oneway since the adversary A that given K, y returns
y has owadvantage 1.
56 / 62
Does CR imply OW?
Adversary B(K)
x
1
$
D; y H
K
(x
1
); x
2
$
A(K, y)
return x
1
, x
2
Inuition: If [D[ is suciently larger than 2
n
, meaning H is compressing,
then y is likely to have more than one preimage, and we are likely to
have x
2
,= x
1
.
In this case, H being CR will imply it is one way
57 / 62
CR OW for functions that compress
Theorem: Let H : 0, 1
k
D 0, 1
n
be a family of functions. Let A
be a owadversary with running time at most t. Then there is a
cradversary B such that
Adv
ow
H
(A) 2 Adv
cr
H
(B) +
2
n
[D[
.
Furthermore the running time of B is about that of A.
Implication: CR OW as long as 2
n
/[D[ is small.
58 / 62
Proof of Theorem
Adversary B(K)
x
1
$
D; y H
K
(x
1
); x
2
$
A(K, y)
return x
1
, x
2
Denition: x
1
is a sibling of x
2
under H
K
if x
1
, x
2
form a collision for H
K
.
For any K 0, 1
k
, let
S
K
= x D : [H
1
K
(H
K
(x))[ = 1
be the set of all domain points that have no siblings.
59 / 62
Advantage of B
Adversary B(K)
x
1
$
D; y H
K
(x
1
); x
2
$
A(K, y)
return x
1
, x
2
Then Adv
cr
H
(B)
= Pr [H
K
(x
2
) = y x
1
,= x
2
]
= Pr [H
K
(x
2
) = y x
1
,= x
2
x
1
/ S
K
]
= Pr [x
1
,= x
2
[ H
K
(x
2
) = y x
1
/ S
K
]
1
1
[
H
1
K
(y)
[
1
1
2
=
1
2
Pr [H
K
(x
2
) = y x
1
/ S
K
]
Because A has no information about x
1
, barring the fact that
H
K
(x
1
) = y.
60 / 62
Advantage of B
Adversary B(K)
x
1
$
D; y H
K
(x
1
); x
2
$
A(K, y)
return x
1
, x
2
Adv
cr
H
(B)
1
2
Pr [H
K
(x
2
) = y x
1
/ S
K
]
Fact: Pr
E F
Pr [E] Pr [F]
Proof: Pr
E F
1
,
2
, . . . ,
s
are in S
K
then H
K
(
1
), H
K
(
2
), . . . , H
K
(
s
) must be
distinct. So
[S
K
[ [0, 1
n
[ = 2
n
.
So
Pr [x
1
S
K
]
2
n
[D[
.
62 / 62