Docsity

Applied Cryptography: Block Ciphers, Functions and Permutations | CS 6260, Study notes of Cryptography and System Security

Toggle sidebar
bg1
CS 6260
Applied Cryptography
Alexandra (Sasha) Boldyreva
Block ciphers, pseudorandom
functions and permutations
1
Building blocks for symmetric encryption.
Examples: DES, 3DES, AES...
•A block cipher is a function family E:{0,1}k"{0,1}n!{0,1}n,
where k-key length, n-input and output lengths are the
parameters
•Notation: for every K󲰉{0,1}k EK(M)=E(K,M)
•For every K󲰉{0,1}k, EK(!) is a permutation (one-to-one and
onto function). For every C󲰉{0,1}n there is a single M󲰉{0,1}n
s.t. C=EK(M)
•Thus each block cipher has an inverse for every key: EK-1(!)
s.t. EK(EK-1(M))=C for all M,C󲰉{0,1}n
•For every K󲰉{0,1}k, EK(!),EK-1(!):{0,1}n!{0,1}n
Block ciphers
M! EK !C
2
DES
•Key length k=56, input and output length n=64
•1973. NBS (National Bureau of Standards) announced a
search for a data protection algorithm to be standardized
•1974. IBM submits a design based on “Lucifer” algorithm
•1975. The proposed DES is published
•1976. DES approved as a federal standard
•DES is highly efficient: #2.5!107 DES computations per
second
3
Security of block ciphers
•Any block cipher E is subject to exhaustive key-search:
given (M1,C1=E(K,M1),...,(Mq,Cq=E(K,Mq)) an adversary
can recover K (or another key consistent with the given
pairs) as follows:
EKSE((M1,C1),...(Mq,Cq))
For i=1,...,2k do
if E(Ti,M1)=C1 then //Ti is i-th k-bit string//
if E(Ti,Mj)=Cj for all 2!j!q then return Ti EndIf
EndIf
EndFor
4
pf3
pf4
pf5

Partial preview of the text

Download Applied Cryptography: Block Ciphers, Functions and Permutations | CS 6260 and more Study notes Cryptography and System Security in PDF only on Docsity!

CS 6260

Applied Cryptography

Alexandra (Sasha) Boldyreva

Block ciphers, pseudorandom

functions and permutations

1

Building blocks for symmetric encryption.

Examples: DES, 3DES, AES...

A block cipher is a function family E:{0,1}

k

n

n

where k-key length, n-input and output lengths are the

parameters

• Notation: for every K {0,1}

k

E

K

(M)=E(K,M)

• For every K {0,1}

k

, E

K

(!) is a permutation (one-to-one and

onto function). For every C {0,1}

n

there is a single M {0,1}

n

s.t. C=E

K

(M)

• Thus each block cipher has an inverse for every key: E

K

s.t. E

K

(E

K

(M))=C for all M,C {0,1}

n

For every K {0,1}

k

, E

K

(!),E

K

n

n

Block ciphers

M! E

K

!C

2

DES

• Key length k=56, input and output length n=

1973. NBS (National Bureau of Standards) announced a

search for a data protection algorithm to be standardized

1974. IBM submits a design based on “Lucifer” algorithm

1975. The proposed DES is published

• 1976. DES approved as a federal standard

DES is highly efficient: #2.5! 10

DES computations per

second

3

Security of block ciphers

• Any block cipher E is subject to exhaustive key-search:

given (M1,C1=E(K,M1),...,(Mq,Cq=E(K,Mq)) an adversary

can recover K (or another key consistent with the given

pairs) as follows:

EKS

E

((M1,C1),...(Mq,Cq))

For i=1,...,

k

do

if E(Ti,M1)=C1 then //Ti is i-th k-bit string//

if E(Ti,Mj)=Cj for all 2!j!q then return Ti EndIf

EndIf

EndFor

4

Security of block ciphers

Exhaustive key search takes 2

k block cipher computations in the worst case.

On the average:

DES has a property that , this speeds

up exhaustive search by a factor of 2

For DES (k=56) exhaustive search takes

2 55 /2!2.5! 10 7 that is about 23 years

Thus, no block cipher is perfectly secure. It is always possible for an attacker to recover the key. A good block cipher, however, is designed to make this task computationally prohibitive. How long does exhaustive key-search take? Since q is small we can neglect the difference in running time between the two versions of the attack above, and focus for simplicity on the first attack. In the worst case, it uses 2 k computations of the block cipher. However it could be less since one could get lucky. For example if the target key is in the first half of the search space, only 2 k− 1 computations would be used. So a better measure is how long it takes on the average. This is 2 k

i= i · Pr[K = T i

] =

2 k

i= i

k

k

2 k

i= i =

k

k ( 2 k

  • 1 )

k

  • 1

k− 1 computations of the block cipher. This is because the target key is chosen at random, so with probability 1 / 2 k equals T i , and in that case the attack uses i E-computations to find it. Thus to make key-recovery by exhaustive search computationally prohibitive, one must make the key-length k of the block cipher large enough. Let’s look at DES. We noted above that there is VLSI chip that can compute it at the rate of 1 .6 Gbits/sec. How long would key-recovery via exhaustive search i 2 2 i q q i irly small vaue of q, say somewhat more than k/n, is enough that this attack usually return the target key itself. For DES, q = 2 is enough. hus, no block cipher is perfectly secure. It is always possible for an attacker cover the key. A good block cipher, however, is designed to make this task putationally prohibitive. ow long does exhaustive key-search take? Since q is small we can neglect the rence in running time between the two versions of the attack above, and focus implicity on the first attack. In the worst case, it uses 2 k computations of the k cipher. However it could be less since one could get lucky. For example if the et key is in the first half of the search space, only 2 k− 1 computations would be

. So a better measure is how long it takes on the average. This is

1 i · Pr[K = T i

] =

2 k

i= i

k

k

2 k

i= i =

k

k ( 2 k

  • 1 )

k

  • 1

k− 1 putations of the block cipher. This is because the target key is chosen at random, ith probability 1 / 2 k equals T i , and in that case the attack uses i E-computations nd it. hus to make key-recovery by exhaustive search computationally prohibitive, must make the key-length k of the block cipher large enough. et’s look at DES. We noted above that there is VLSI chip that can compute the rate of 1 .6 Gbits/sec. How long would key-recovery via exhaustive search

not enough either. As we see more usages of ciphers, we build up a longer and longer

list of security properties SP 1 , SP 2 , SP 3 ,... that are necessary for the security of some block cipher based application. Such a long list of necessary but not sufficient properties is no way to treat security. What we need is one single “MASTER” property of a block cipher which, if met, guarantees security of lots of natural usages of the cipher. Such a property is that the block cipher be a pseudorandom permutation (PRF), a notion explored in another chapter.

  1. 7 Problems

Problem 2.1 Show that for all K ∈ { 0 , 1 }

56

and all x ∈ { 0 , 1 }

64

DES

K

(x) = DES

K

(x).

This is called the key-complementation property of DES. Problem 2.2 Explain how to use the key-complementation property of DES to speed up exhaustive key search by about a factor of two. Explain any assumptions that you make. Problem 2.3 Find a key K such that DES

K

(·) = DES

− 1 K

(·). Such a key is some-

times called a “weak” key. Problem 2.4 As with AES, suppose we are working in the finite field with 2

8

elements, representing field points using the irreducible polynomial m(x) = x

8

+

x

4

+ x

3

+ x + 1. Compute the byte that is the result of multiplying bytes:

{e1} · { 05 } Problem 2.5 For AES, we have given two different descriptions of mix-cols: one using matric multiplication (in GF( 2

8

)) and one based on multiplying by a fixed

polynomial c(x) modulo a second fixed polynomial, d(x) = x

4

+ 1. Show that these

two methods are equivalent.

5 Security of DES

There are more sophisticated attacks known:

differential cryptoanalysis: finds the key given about 2

47 chosen plaintexts and the corresponding ciphertexts

linear cryptoanalysis: finds the key given about 2

42 known plaintext and ciphertext pairs

  • These attacks require too many data, hence exhaustive key

search is the best known attack. And it can be mounted in

parallel!

  • A machine for DES exhaustive key search was built for

$250,000. It finds the key in about 56 hours on average.

A new block cipher was needed....

Triple-DES: 3DES(K1||K2,M)=DES(K2, DES

(K1, DES(K2,M)).

  • 3DES’s keys are 112-bit long. Good, but needs 3 DES

computations

6 Advanced Encryption Standard (AES)

1998. NIST announced a search for a new block cipher.

15 algorithms from different countries were submitted

2001. NIST announces the winner: an algorithm Rijndael,

designed by Joan Daemen and Vincent Rijmen from Belgium.

  • AES: block length n=128, key length k is variable: 128, 192

or 256 bits.

  • Exhaustive key search is believed infeasible

7 Limitations of key-recovery based security

A classical approach to block cipher security: key recovery should be infeasible.

I.e. given (M1,E(K,M1),...,Mq,E(K,Mq)), where K is chosen at random and M1,...Mq are chosen at random (or by an adversary), the adversary cannot compute K in time t with probability ".

Necessary, but is it sufficient?

Consider E’(K,M1||M2)=E(K,M1)||M2 for some “good” E. Key recovery is hard for E’ as well, but it does not look secure.

Q. What property of a block cipher as a building block would ensure various security properties of different constructions? 8

“Black box” access

g(!)

global array T

If T[X] is not defined then

T[X] {0,1}

L EnIf

Return Y=T[X]

X

Y

Note that for any X"{0,1}

l

and Y"{0,1}

L

Pr[g(X)=Y]=

-L

$

←

1

13

Random permutations

• Perm(l) is the set of all permutations on {0,1}

l

• Q. How large is the key space?

A.

• We are interested in a random instance $ Perm(l)

$(X"{0,1}

l

global array T, S; S#

If T[X] is not defined then

T[X] {0,1}

l

  • ; S S {T[X]} EndIf

Return T[X]

l!

$

←

1

$

←

1

14

“Black box” access

$(!)

global array T, S; S#

If T[X] is not defined then

T[X] {0,1}

l

  • ; S S {T[X]} EndIf

Return Y=T[X]

X

Y

For any X"{0,1}

l

and Y"{0,1}

l

Pr[$(X)=Y]=

- l

$

←

1

15

Random functions vs permutations

f-random function

permutation

4 PSEUDORANDOM FUNCTIONS

The answer on any point is random and independent of the answers on other points.

It is this “dynamic” view that we suggest the reader have in mind when thinking

about random functions or random permutations.

One must remember that the term “random function” is misleading. It might

lead one to think that certain functions are “random” and others are not. (For

example, maybe the constant function that always returns 0

L

on any input is not

random, but a function with many different range values is random.) This is not

right. The randomness of the function refers to the way it was chosen, not to an

attribute of the selected function itself. When you choose a function at random, the

constant function is just as likely to appear as any other function. It makes no sense

to talk of the randomness of an individual function; the term “random function”

just means a function chosen at random.

Example 3.3 Let’s do some simple probabilistic computations to understand ran-

dom functions. In all of the following, the probability is taken over a random choice

of f from Func(!,L), meaning that we have executed the operation f

$

← Func(!,L).

1. Fix X ∈ { 0 , 1 }

!

and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X) = Y ] = 2

−L

Notice that the probability doesn’t depend on !. Nor does it depend on the

values of X, Y.

2. Fix X

1

, X

2

!

and Y

1

, Y

2

L

, and assume X

1

= X

2

. Then

Pr [f (X

1

) = Y

1

| f (X

2

) = Y

2

] = 2

−L

The above is a conditional probability, and says that even if we know the value

of f on X

1

, its value on a different point X

2

is equally likely to be any L-bit

string.

3. Fix X

1

, X

2

!

and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X

1

) = Y and f (X

2

) = Y ] =

− 2 L

if X

1

= X

2

−L

if X

1

= X

2

4. Fix X

1

, X

2

!

and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X

1

) ⊕ f (X

2

) = Y ] =

−L

if X

1

= X

2

0 if X

1

= X

2

and Y #= 0

L

1 if X

1

= X

2

and Y = 0

L

5. Suppose l ≤ L and let τ : { 0 , 1 }

L

l

denote the function that on input

Y ∈ { 0 , 1 }

L

returns the first l bits of Y. Fix distinct X

1

, X

2

!

, Y

1

L

and Z

2

l

. Then:

Pr [τ (f (X

2

)) = Z

2

| f (X

1

) = Y

1

] = 2

−l

4 PSEUDORANDOM FUNCTIONS

The answer on any point is random and independent of the answers on other points.

It is this “dynamic” view that we suggest the reader have in mind when thinking

about random functions or random permutations.

One must remember that the term “random function” is misleading. It might

lead one to think that certain functions are “random” and others are not. (For

example, maybe the constant function that always returns 0

L on any input is not

random, but a function with many different range values is random.) This is not

right. The randomness of the function refers to the way it was chosen, not to an

attribute of the selected function itself. When you choose a function at random, the

constant function is just as likely to appear as any other function. It makes no sense

to talk of the randomness of an individual function; the term “random function”

just means a function chosen at random.

Example 3.3 Let’s do some simple probabilistic computations to understand ran-

dom functions. In all of the following, the probability is taken over a random choice

of f from Func(!,L), meaning that we have executed the operation f

$ ← Func(!,L).

  1. Fix X ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X) = Y ] = 2

−L .

Notice that the probability doesn’t depend on !. Nor does it depend on the

values of X, Y.

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y 1 , Y 2 ∈ { 0 , 1 }

L , and assume X 1

= X 2

. Then

Pr [f (X 1 ) = Y 1 | f (X 2 ) = Y 2 ] = 2

−L .

The above is a conditional probability, and says that even if we know the value

of f on X 1 , its value on a different point X 2 is equally likely to be any L-bit

string.

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X 1 ) = Y and f (X 2 ) = Y ] =

{

2

− 2 L if X 1 #= X 2

2

−L if X 1 = X 2

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X 1 ) ⊕ f (X 2 ) = Y ] =

  

  

2

−L if X 1

= X 2

0 if X 1 = X 2 and Y #= 0

L

1 if X 1 = X 2 and Y = 0

L

  1. Suppose l ≤ L and let τ : { 0 , 1 }

L → { 0 , 1 }

l denote the function that on input

Y ∈ { 0 , 1 }

L returns the first l bits of Y. Fix distinct X 1 , X 2 ∈ { 0 , 1 }

! , Y 1 ∈

4 PSEUDORANDOM FUNCTIONS

The answer on any point is random and independent of the answers on other points.

It is this “dynamic” view that we suggest the reader have in mind when thinking

about random functions or random permutations.

One must remember that the term “random function” is misleading. It might

lead one to think that certain functions are “random” and others are not. (For

example, maybe the constant function that always returns 0

L on any input is not

random, but a function with many different range values is random.) This is not

right. The randomness of the function refers to the way it was chosen, not to an

attribute of the selected function itself. When you choose a function at random, the

constant function is just as likely to appear as any other function. It makes no sense

to talk of the randomness of an individual function; the term “random function”

just means a function chosen at random.

Example 3.3 Let’s do some simple probabilistic computations to understand ran-

dom functions. In all of the following, the probability is taken over a random choice

of f from Func(!,L), meaning that we have executed the operation f

$

← Func(!,L).

  1. Fix X ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X) = Y ] = 2

−L

.

Notice that the probability doesn’t depend on !. Nor does it depend on the

values of X, Y.

  1. Fix X 1

, X

2

! and Y 1

, Y

2

L , and assume X 1

= X

2

. Then

Pr [f (X 1

) = Y

1 | f (X 2

) = Y

2

] = 2

−L

.

The above is a conditional probability, and says that even if we know the value

of f on X 1 , its value on a different point X 2 is equally likely to be any L-bit

string.

  1. Fix X 1

, X

2

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X 1 ) = Y and f (X 2

) = Y ] =

− 2 L if X 1

= X

2

−L if X 1

= X

2

  1. Fix X 1

, X

2

! and Y ∈ { 0 , 1 }

L

. Then:

−L if X 1

= X

2

4 PSEUDORANDOM FUNCTIONS

The answer on any point is random and independent of the answers on other points.

It is this “dynamic” view that we suggest the reader have in mind when thinking

about random functions or random permutations.

One must remember that the term “random function” is misleading. It might

lead one to think that certain functions are “random” and others are not. (For

example, maybe the constant function that always returns 0

L on any input is not

random, but a function with many different range values is random.) This is not

right. The randomness of the function refers to the way it was chosen, not to an

attribute of the selected function itself. When you choose a function at random, the

constant function is just as likely to appear as any other function. It makes no sense

to talk of the randomness of an individual function; the term “random function”

just means a function chosen at random.

Example 3.3 Let’s do some simple probabilistic computations to understand ran-

dom functions. In all of the following, the probability is taken over a random choice

of f from Func(!,L), meaning that we have executed the operation f

$

← Func(!,L).

  1. Fix X ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X) = Y ] = 2

−L

.

Notice that the probability doesn’t depend on !. Nor does it depend on the

values of X, Y.

  1. Fix X 1

, X

2

! and Y 1

, Y

2

L , and assume X 1

= X

2

. Then

Pr [f (X 1

) = Y

1

| f (X 2

) = Y

2

] = 2

−L .

The above is a conditional probability, and says that even if we know the value

of f on X 1 , its value on a different point X 2 is equally likely to be any L-bit

string.

  1. Fix X 1

, X

2

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X 1

) = Y and f (X 2

) = Y ] =

− 2 L if X 1

= X

2

−L if X 1

= X

2

4 PSEUDORANDOM FUNCTIONS

The answer on any point is random and independent of the answers on other points.

It is this “dynamic” view that we suggest the reader have in mind when thinking

about random functions or random permutations.

One must remember that the term “random function” is misleading. It might

lead one to think that certain functions are “random” and others are not. (For

example, maybe the constant function that always returns 0

L on any input is not

random, but a function with many different range values is random.) This is not

right. The randomness of the function refers to the way it was chosen, not to an

attribute of the selected function itself. When you choose a function at random, the

constant function is just as likely to appear as any other function. It makes no sense

to talk of the randomness of an individual function; the term “random function”

just means a function chosen at random.

Example 3.3 Let’s do some simple probabilistic computations to understand ran-

dom functions. In all of the following, the probability is taken over a random choice

of f from Func(!,L), meaning that we have executed the operation f

$ ← Func(!,L).

  1. Fix X ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X) = Y ] = 2

−L .

Notice that the probability doesn’t depend on !. Nor does it depend on the

values of X, Y.

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y 1 , Y 2 ∈ { 0 , 1 }

L , and assume X 1

= X 2

. Then

Pr [f (X 1 ) = Y 1 | f (X 2 ) = Y 2 ] = 2

−L .

The above is a conditional probability, and says that even if we know the value

of f on X 1 , its value on a different point X 2 is equally likely to be any L-bit

string.

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X 1 ) = Y and f (X 2 ) = Y ] =

{

2

− 2 L if X 1

= X 2

2

−L if X 1 = X 2

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X 1 ) ⊕ f (X 2 ) = Y ] =

  

  

2

−L if X 1

= X 2

0 if X 1 = X 2 and Y #= 0

L

1 if X 1 = X 2 and Y = 0

L

  1. Suppose l ≤ L and let τ : { 0 , 1 }

L → { 0 , 1 }

l denote the function that on input

Y ∈ { 0 , 1 }

L returns the first l bits of Y. Fix distinct X 1 , X 2 ∈ { 0 , 1 }

! , Y 1 ∈

{ 0 , 1 }

L and Z 2 ∈ { 0 , 1 }

l

. Then:

4 PSEUDORANDOM FUNCTIONS

The answer on any point is random and independent of the answers on other points.

It is this “dynamic” view that we suggest the reader have in mind when thinking

about random functions or random permutations.

One must remember that the term “random function” is misleading. It might

lead one to think that certain functions are “random” and others are not. (For

example, maybe the constant function that always returns 0

L on any input is not

random, but a function with many different range values is random.) This is not

right. The randomness of the function refers to the way it was chosen, not to an

attribute of the selected function itself. When you choose a function at random, the

constant function is just as likely to appear as any other function. It makes no sense

to talk of the randomness of an individual function; the term “random function”

just means a function chosen at random.

Example 3.3 Let’s do some simple probabilistic computations to understand ran-

dom functions. In all of the following, the probability is taken over a random choice

of f from Func(!,L), meaning that we have executed the operation f

$ ← Func(!,L).

  1. Fix X ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X) = Y ] = 2

−L .

Notice that the probability doesn’t depend on !. Nor does it depend on the

values of X, Y.

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y 1 , Y 2 ∈ { 0 , 1 }

L , and assume X 1

= X 2

. Then

Pr [f (X 1 ) = Y 1 | f (X 2 ) = Y 2 ] = 2

−L .

The above is a conditional probability, and says that even if we know the value

of f on X 1 , its value on a different point X 2 is equally likely to be any L-bit

string.

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X 1 ) = Y and f (X 2 ) = Y ] =

{

2

− 2 L if X 1

= X 2

2

−L if X 1 = X 2

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X 1 ) ⊕ f (X 2 ) = Y ] =

  

  

2

−L if X 1

= X 2

0 if X 1 = X 2 and Y #= 0

L

1 if X 1 = X 2 and Y = 0

L

  1. Suppose l ≤ L and let τ : { 0 , 1 }

L → { 0 , 1 }

l denote the function that on input

Y ∈ { 0 , 1 }

L returns the first l bits of Y. Fix distinct X 1 , X 2 ∈ { 0 , 1 }

! , Y 1 ∈

{ 0 , 1 }

L and Z 2 ∈ { 0 , 1 }

l

. Then:

Pr [τ (f (X 2 )) = Z 2 | f (X 1 ) = Y 1 ] = 2

−l .

4 PSEUDORANDOM FUNCTIONS

The answer on any point is random and independent of the answers on other points.

It is this “dynamic” view that we suggest the reader have in mind when thinking

about random functions or random permutations.

One must remember that the term “random function” is misleading. It might

lead one to think that certain functions are “random” and others are not. (For

example, maybe the constant function that always returns 0

L on any input is not

random, but a function with many different range values is random.) This is not

right. The randomness of the function refers to the way it was chosen, not to an

attribute of the selected function itself. When you choose a function at random, the

constant function is just as likely to appear as any other function. It makes no sense

to talk of the randomness of an individual function; the term “random function”

just means a function chosen at random.

Example 3.3 Let’s do some simple probabilistic computations to understand ran-

dom functions. In all of the following, the probability is taken over a random choice

of f from Func(!,L), meaning that we have executed the operation f

$

← Func(!,L).

  1. Fix X ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X) = Y ] = 2

−L .

Notice that the probability doesn’t depend on !. Nor does it depend on the

values of X, Y.

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y 1 , Y 2 ∈ { 0 , 1 }

L , and assume X 1

= X 2

. Then

Pr [f (X 1 ) = Y 1 | f (X 2 ) = Y 2 ] = 2

−L .

The above is a conditional probability, and says that even if we know the value

of f on X 1 , its value on a different point X 2 is equally likely to be any L-bit

string.

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X 1 ) = Y and f (X 2 ) = Y ] =

{

2

− 2 L if X 1

= X 2

2

−L if X 1 = X 2

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X 1 ) ⊕ f (X 2 ) = Y ] =

  

  

2

−L if X 1

= X 2

0 if X 1 = X 2 and Y #= 0

L

1 if X 1 = X 2 and Y = 0

L

  1. Suppose l ≤ L and let τ : { 0 , 1 }

L → { 0 , 1 }

l denote the function that on input

Y ∈ { 0 , 1 }

L returns the first l bits of Y. Fix distinct X 1 , X 2 ∈ { 0 , 1 }

! , Y 1 ∈

{ 0 , 1 }

L and Z 2 ∈ { 0 , 1 }

l

. Then:

Pr [τ (f (X 2 )) = Z 2 | f (X 1 ) = Y 1 ] = 2

−l .

4 PSEUDORANDOM FUNCTIONS

The answer on any point is random and independent of the answers on other points.

It is this “dynamic” view that we suggest the reader have in mind when thinking

about random functions or random permutations.

One must remember that the term “random function” is misleading. It might

lead one to think that certain functions are “random” and others are not. (For

example, maybe the constant function that always returns 0

L on any input is not

random, but a function with many different range values is random.) This is not

right. The randomness of the function refers to the way it was chosen, not to an

attribute of the selected function itself. When you choose a function at random, the

constant function is just as likely to appear as any other function. It makes no sense

to talk of the randomness of an individual function; the term “random function”

just means a function chosen at random.

Example 3.3 Let’s do some simple probabilistic computations to understand ran-

dom functions. In all of the following, the probability is taken over a random choice

of f from Func(!,L), meaning that we have executed the operation f

$ ← Func(!,L).

  1. Fix X ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X) = Y ] = 2

−L .

Notice that the probability doesn’t depend on !. Nor does it depend on the

values of X, Y.

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y 1 , Y 2 ∈ { 0 , 1 }

L , and assume X 1

= X 2

. Then

Pr [f (X 1 ) = Y 1 | f (X 2 ) = Y 2 ] = 2

−L .

The above is a conditional probability, and says that even if we know the value

of f on X 1 , its value on a different point X 2 is equally likely to be any L-bit

string.

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X 1 ) = Y and f (X 2 ) = Y ] =

{

2

− 2 L if X 1

= X 2

2

−L if X 1 = X 2

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X 1 ) ⊕ f (X 2 ) = Y ] =

  

  

2

−L if X 1

= X 2

0 if X 1 = X 2 and Y #= 0

L

1 if X 1 = X 2 and Y = 0

L

  1. Suppose l ≤ L and let τ : { 0 , 1 }

L → { 0 , 1 }

l denote the function that on input

Y ∈ { 0 , 1 }

L returns the first l bits of Y. Fix distinct X 1 , X 2 ∈ { 0 , 1 }

! , Y 1 ∈

{ 0 , 1 }

L and Z 2 ∈ { 0 , 1 }

l

. Then:

Pr [τ (f (X 2 )) = Z 2 | f (X 1 ) = Y 1 ] = 2

−l .

4 PSEUDORANDOM FUNCTIONS

The answer on any point is random and independent of the answers on other points.

It is this “dynamic” view that we suggest the reader have in mind when thinking

about random functions or random permutations.

One must remember that the term “random function” is misleading. It might

lead one to think that certain functions are “random” and others are not. (For

example, maybe the constant function that always returns 0

L on any input is not

random, but a function with many different range values is random.) This is not

right. The randomness of the function refers to the way it was chosen, not to an

attribute of the selected function itself. When you choose a function at random, the

constant function is just as likely to appear as any other function. It makes no sense

to talk of the randomness of an individual function; the term “random function”

just means a function chosen at random.

Example 3.3 Let’s do some simple probabilistic computations to understand ran-

dom functions. In all of the following, the probability is taken over a random choice

of f from Func(!,L), meaning that we have executed the operation f

$ ← Func(!,L).

  1. Fix X ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X) = Y ] = 2

−L .

Notice that the probability doesn’t depend on !. Nor does it depend on the

values of X, Y.

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y 1 , Y 2 ∈ { 0 , 1 }

L , and assume X 1

= X 2

. Then

Pr [f (X 1 ) = Y 1 | f (X 2 ) = Y 2 ] = 2

−L .

The above is a conditional probability, and says that even if we know the value

of f on X 1 , its value on a different point X 2 is equally likely to be any L-bit

string.

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X 1 ) = Y and f (X 2 ) = Y ] =

{

2

− 2 L if X 1

= X 2

2

−L if X 1 = X 2

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [f (X 1 ) ⊕ f (X 2 ) = Y ] =

  

  

2

−L if X 1

= X 2

0 if X 1 = X 2 and Y #= 0

L

1 if X 1 = X 2 and Y = 0

L

  1. Suppose l ≤ L and let τ : { 0 , 1 }

L → { 0 , 1 }

l denote the function that on input

Y ∈ { 0 , 1 }

L returns the first l bits of Y. Fix distinct X 1 , X 2 ∈ { 0 , 1 }

! , Y 1 ∈

{ 0 , 1 }

L and Z 2 ∈ { 0 , 1 }

l

. Then:

Pr [τ (f (X 2 )) = Z 2 | f (X 1 ) = Y 1 ] = 2

−l .

6 PSEUDORANDOM FUNCTIONS

if T [X] is not defined

then Y

$ ← D − S ; T [X] ← Y ; S ← S ∪ {T [X]}

fi

return T [X]

The answer on any point is random, but not independent of the answers on other

points, since it is distinct from those.

Example 3.5 Random permutations are somewhat harder to work with than ran-

dom functions, due to the lack of independence between values on different points.

Let’s look at some probabilistic computations involving them. In all of the following,

the probability is taken over a random choice of π from Perm("), meaning that we

have executed the operation π

$ ← Perm(").

  1. Fix X, Y ∈ { 0 , 1 }

!

. Then:

Pr [π(X) = Y ] = 2

−! .

This is the same as if π had been selected at random from Func(",") rather than

from Perm("). However, the similarity vanishes when more than one point is to

be considered.

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y 1 , Y 2 ∈ { 0 , 1 }

L , and assume X 1 % = X 2

. Then

Pr [π(X 1 ) = Y 1 | π(X 2 ) = Y 2 ] =

1

2 ! − 1

if Y 1 % = Y 2

0 if Y 1 = Y 2

The above is a conditional probability, and says that if we know the value of π

on X 1 , its value on a different point X 2 is equally likely to be any L-bit string

other than π(X 1 ). So there are 2

! − 1 choices for π(X 2 ), all equally likely, if

Y 1 % = Y 2 .

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [π(X 1 ) = Y and π(X 2 ) = Y ] =

{

0 if X 1 % = X 2

2

−! if X 1 = X 2

This is true because a permutation can never map distinct X 1 and X 2 to the

same point.

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

!

. Then:

Pr [π(X 1 ) ⊕ π(X 2 ) = Y ] =

      

      

1

2 ! − 1

if X 1 %= X 2 and Y %= 0

!

0 if X 1 % = X 2 and Y = 0

!

0 if X 1 = X 2 and Y %= 0

!

1 if X 1 = X 2 and Y = 0

!

6 PSEUDORANDOM FUNCTIONS

if T [X] is not defined

then Y

$ ← D − S ; T [X] ← Y ; S ← S ∪ {T [X]}

fi

return T [X]

The answer on any point is random, but not independent of the answers on other

points, since it is distinct from those.

Example 3.5 Random permutations are somewhat harder to work with than ran-

dom functions, due to the lack of independence between values on different points.

Let’s look at some probabilistic computations involving them. In all of the following,

the probability is taken over a random choice of π from Perm("), meaning that we

have executed the operation π

$ ← Perm(").

  1. Fix X, Y ∈ { 0 , 1 }

!

. Then:

Pr [π(X) = Y ] = 2

−! .

This is the same as if π had been selected at random from Func(",") rather than

from Perm("). However, the similarity vanishes when more than one point is to

be considered.

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y 1 , Y 2 ∈ { 0 , 1 }

L , and assume X 1 % = X 2

. Then

Pr [π(X 1 ) = Y 1 | π(X 2 ) = Y 2 ] =

1

2 ! − 1

if Y 1 % = Y 2

0 if Y 1 = Y 2

The above is a conditional probability, and says that if we know the value of π

on X 1 , its value on a different point X 2 is equally likely to be any L-bit string

other than π(X 1 ). So there are 2

! − 1 choices for π(X 2 ), all equally likely, if

Y 1 % = Y 2 .

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [π(X 1 ) = Y and π(X 2 ) = Y ] =

{

0 if X 1 % = X 2

2

−! if X 1 = X 2

This is true because a permutation can never map distinct X 1 and X 2 to the

same point.

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

!

. Then:

Pr [π(X 1 ) ⊕ π(X 2 ) = Y ] =

      

      

1

2

! − 1

if X 1 % = X 2 and Y %= 0

!

0 if X 1 % = X 2 and Y = 0

!

0 if X 1 = X 2 and Y %= 0

!

1 if X 1 = X 2 and Y = 0

!

In the case X 1 % = X 2 and Y %= 0

! this is computed as follows:

Pr [π(X 1 ) ⊕ π(X 2 ) = Y ]

6 PSEUDORANDOM FUNCTIONS

if T [X] is not defined

then Y

$ ← D − S ; T [X] ← Y ; S ← S ∪ {T [X]}

fi

return T [X]

The answer on any point is random, but not independent of the answers on other

points, since it is distinct from those.

Example 3.5 Random permutations are somewhat harder to work with than ran-

dom functions, due to the lack of independence between values on different points.

Let’s look at some probabilistic computations involving them. In all of the following,

the probability is taken over a random choice of π from Perm("), meaning that we

have executed the operation π

$ ← Perm(").

  1. Fix X, Y ∈ { 0 , 1 }

!

. Then:

Pr [π(X) = Y ] = 2

−! .

This is the same as if π had been selected at random from Func(",") rather than

from Perm("). However, the similarity vanishes when more than one point is to

be considered.

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y 1 , Y 2 ∈ { 0 , 1 }

L , and assume X 1 % = X 2

. Then

Pr [π(X 1 ) = Y 1 | π(X 2 ) = Y 2 ] =

1

2 ! − 1

if Y 1 %= Y 2

0 if Y 1 = Y 2

The above is a conditional probability, and says that if we know the value of π

on X 1 , its value on a different point X 2 is equally likely to be any L-bit string

other than π(X 1 ). So there are 2

! − 1 choices for π(X 2 ), all equally likely, if

Y 1 % = Y 2 .

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

L

. Then:

Pr [π(X 1 ) = Y and π(X 2 ) = Y ] =

{

0 if X 1 % = X 2

2

−! if X 1 = X 2

This is true because a permutation can never map distinct X 1 and X 2 to the

same point.

  1. Fix X 1 , X 2 ∈ { 0 , 1 }

! and Y ∈ { 0 , 1 }

!

. Then:

Pr [π(X 1 ) ⊕ π(X 2 ) = Y ] =

      

      

1

2 ! − 1

if X 1 % = X 2 and Y %= 0

!

0 if X 1 % = X 2 and Y = 0

!

0 if X 1 = X 2 and Y %= 0

!

1 if X 1 = X 2 and Y = 0

!

In the case X 1 %= X 2 and Y %= 0

! this is computed as follows:

Pr [π(X 1 ) ⊕ π(X 2 ) = Y ]

l = L

1

6 PSEUDORANDOM FUNCTIO

if T [X] is not defined

then Y

$

← D − S ; T [X] ← Y ; S ← S ∪ {T [X]}

fi

return T [X]

The answer on any point is random, but not independent of the answers on ot

points, since it is distinct from those.

Example 3.5 Random permutations are somewhat harder to work with than r

dom functions, due to the lack of independence between values on different poin

Let’s look at some probabilistic computations involving them. In all of the followi

the probability is taken over a random choice of π from Perm("), meaning that

have executed the operation π

$

← Perm(").

1. Fix X, Y ∈ { 0 , 1 }

!

. Then:

Pr [π(X) = Y ] = 2

−!

This is the same as if π had been selected at random from Func(",") rather th

from Perm("). However, the similarity vanishes when more than one point is

be considered.

2. Fix X

1

, X

2

!

and Y

1

, Y

2

L

, and assume X

1

= X

2

. Then

Pr [π(X

1

) = Y

1

| π(X

2

) = Y

2

] =

!

if Y

1

= Y

2

0 if Y

1

= Y

2

The above is a conditional probability, and says that if we know the value o

on X

1

, its value on a different point X

2

is equally likely to be any L-bit str

other than π(X

1

). So there are 2

!

− 1 choices for π(X

2

), all equally likely

Y

1

= Y

2

3. Fix X

1

, X

2

!

and Y ∈ { 0 , 1 }

L

. Then:

0 if X

1

= X

2

16

Pseudorandom functions (PRFs)

  • Informally, a function family F is a PRF if the input-output

behavior of its random instance is computationally

indistinguishable from that of a random function.

17

Def. Fix a function family F: Keys(F) " Dom(F)! Range(F)

F is a secure PRF if for any adversary with “reasonable”

resources its prf-advantage is “small”.

PRFs

The prf-advantage of an adversary A is

Experiment Experiment

g Func(Dom(F),Range(F))

A

g

!

b

Return b

K Keys(F)

F K

!

b

Return b

A

Bellare and Rogaway 9

Experiment Exp

prf- 1

F

(A)

K

$ ← K

b

$

← A

F K

Return b

Experiment Exp

prf- 0

F

(A)

g

$ ← Func(D,R)

b

$

← A

g

Return b

The prf-advantage of A is defined as

Adv

prf

F

(A) = Pr

[

Exp

prf- 1

F

(A) = 1

]

− Pr

[

Exp

prf- 0

F

(A) = 1

]

.

It should be noted that the family F is public. The adversary A, and anyone else,

knows the description of the family and is capable, given values K, X, of comput-

ing F (K, X).

The worlds are captured by what we call experiments. The first experiment picks

a random instance F K of family F and then runs adversary A with oracle g = F K .

Adversary A interacts with its oracle, querying it and getting back answers, and

eventually outputs a “guess” bit. The experiment returns the same bit. The second

experiment picks a random function g: D → R and runs A with this as oracle, again

returning A’s guess bit. Each experiment has a certain probability of returning 1.

The probability is taken over the random choices made in the experiment. Thus,

for the first experiment, the probability is over the choice of K and any random

choices that A might make, for A is allowed to be a randomized algorithm. In the

second experiment, the probability is over the random choice of g and any random

choices that A makes. These two probabilities should be evaluated separately; the

two experiments are completely different.

To see how well A does at determining which world it is in, we look at the

difference in the probabilities that the two experiments return 1. If A is doing a

good job at telling which world it is in, it would return 1 more often in the first

experiment than in the second. So the difference is a measure of how well A is doing.

We call this measure the prf-advantage of A. Think of it as the probability that A

“breaks” the scheme F , with “break” interpreted in a specific, technical way based

on the definition.

Different adversaries will have different advantages. There are two reasons why

one adversary may achieve a greater advantage than another. One is that it is more

“clever” in the questions it asks and the way it processes the replies to determine

its output. The other is simply that it asks more questions, or spends more time

processing the replies. Indeed, we expect that as an adversary sees more and more

input-output examples of g, or spends more computing time, its ability to tell which

world it is in should go up.

The “security” of family F as a pseudorandom function must thus be thought

of as depending on the resources allowed to the attacker. We may want to want to

know, for any given resource limitations, what is the prf-advantage achieved by the

most “clever” adversary amongst all those who are restricted to the given resource

limits.

The choice of resources to consider can vary. One resource of interest is the

time-complexity t of A. Another resource of interest is the number of queries q

Bellare and Rogaway 9

Experiment Exp

prf- 1

F

(A)

K

$ ← K

b

$ ← A

F K

Return b

Experiment Exp

prf- 0

F

(A)

g

$ ← Func(D,R)

b

$ ← A

g

Return b

The prf-advantage of A is defined as

Adv

prf

F

(A) = Pr

[

Exp

prf- 1

F

(A) = 1

]

− Pr

[

Exp

prf- 0

F

(A) = 1

]

.

It should be noted that the family F is public. The adversary A, and anyone else,

knows the description of the family and is capable, given values K, X, of comput-

ing F (K, X).

The worlds are captured by what we call experiments. The first experiment picks

a random instance F K of family F and then runs adversary A with oracle g = F K .

Adversary A interacts with its oracle, querying it and getting back answers, and

eventually outputs a “guess” bit. The experiment returns the same bit. The second

experiment picks a random function g: D → R and runs A with this as oracle, again

returning A’s guess bit. Each experiment has a certain probability of returning 1.

The probability is taken over the random choices made in the experiment. Thus,

for the first experiment, the probability is over the choice of K and any random

choices that A might make, for A is allowed to be a randomized algorithm. In the

second experiment, the probability is over the random choice of g and any random

choices that A makes. These two probabilities should be evaluated separately; the

two experiments are completely different.

To see how well A does at determining which world it is in, we look at the

difference in the probabilities that the two experiments return 1. If A is doing a

good job at telling which world it is in, it would return 1 more often in the first

experiment than in the second. So the difference is a measure of how well A is doing.

We call this measure the prf-advantage of A. Think of it as the probability that A

“breaks” the scheme F , with “break” interpreted in a specific, technical way based

on the definition.

Different adversaries will have different advantages. There are two reasons why

one adversary may achieve a greater advantage than another. One is that it is more

“clever” in the questions it asks and the way it processes the replies to determine

its output. The other is simply that it asks more questions, or spends more time

processing the replies. Indeed, we expect that as an adversary sees more and more

input-output examples of g, or spends more computing time, its ability to tell which

world it is in should go up.

The “security” of family F as a pseudorandom function must thus be thought

of as depending on the resources allowed to the attacker. We may want to want to

know, for any given resource limitations, what is the prf-advantage achieved by the

most “clever” adversary amongst all those who are restricted to the given resource

limits.

The choice of resources to consider can vary. One resource of interest is the

time-complexity t of A. Another resource of interest is the number of queries q

Bellare and Rogaway 9

Experiment Exp

prf- 1

F

(A)

K

$

← K

b

$

← A

F K

Return b

Experiment Exp

prf- 0

F

(A)

g

$

← Func(D,R)

b

$

← A

g

Return b

The prf-advantage of A is defined as

Adv

prf

F

(A) = Pr

[

Exp

prf- 1

F

(A) = 1

]

− Pr

[

Exp

prf- 0

F

(A) = 1

]

It should be noted that the family F is public. The adversary A, and anyone else,

knows the description of the family and is capable, given values K, X, of comput-

ing F (K, X).

The worlds are captured by what we call experiments. The first experiment picks

a random instance F

K

of family F and then runs adversary A with oracle g = F

K

Adversary A interacts with its oracle, querying it and getting back answers, and

eventually outputs a “guess” bit. The experiment returns the same bit. The second

experiment picks a random function g: D → R and runs A with this as oracle, again

returning A’s guess bit. Each experiment has a certain probability of returning 1.

The probability is taken over the random choices made in the experiment. Thus,

for the first experiment, the probability is over the choice of K and any random

choices that A might make, for A is allowed to be a randomized algorithm. In the

second experiment, the probability is over the random choice of g and any random

choices that A makes. These two probabilities should be evaluated separately; the

two experiments are completely different.

To see how well A does at determining which world it is in, we look at the

difference in the probabilities that the two experiments return 1. If A is doing a

good job at telling which world it is in, it would return 1 more often in the first

experiment than in the second. So the difference is a measure of how well A is doing.

We call this measure the prf-advantage of A. Think of it as the probability that A

“breaks” the scheme F , with “break” interpreted in a specific, technical way based

on the definition.

Different adversaries will have different advantages. There are two reasons why

one adversary may achieve a greater advantage than another. One is that it is more

“clever” in the questions it asks and the way it processes the replies to determine

its output. The other is simply that it asks more questions, or spends more time

processing the replies. Indeed, we expect that as an adversary sees more and more

input-output examples of g, or spends more computing time, its ability to tell which

world it is in should go up.

The “security” of family F as a pseudorandom function must thus be thought

of as depending on the resources allowed to the attacker. We may want to want to

know, for any given resource limitations, what is the prf-advantage achieved by the

most “clever” adversary amongst all those who are restricted to the given resource

limits.

The choice of resources to consider can vary. One resource of interest is the

Bellare and Rogaway 9

Experiment Exp

prf- 1

F

(A)

K

$

← K

b

$

← A

F K

Return b

Experiment Exp

prf- 0

F

(A)

g

$

← Func(D,R)

b

$

← A

g

Return b

The prf-advantage of A is defined as

Adv

prf

F

(A) = Pr

[

Exp

prf- 1

F

(A) = 1

]

− Pr

[

Exp

prf- 0

F

(A) = 1

]

It should be noted that the family F is public. The adversary A, and anyone else,

knows the description of the family and is capable, given values K, X, of comput-

ing F (K, X).

The worlds are captured by what we call experiments. The first experiment picks

a random instance F K of family F and then runs adversary A with oracle g = F K

Adversary A interacts with its oracle, querying it and getting back answers, and

eventually outputs a “guess” bit. The experiment returns the same bit. The second

experiment picks a random function g: D → R and runs A with this as oracle, again

returning A’s guess bit. Each experiment has a certain probability of returning 1.

The probability is taken over the random choices made in the experiment. Thus,

for the first experiment, the probability is over the choice of K and any random

choices that A might make, for A is allowed to be a randomized algorithm. In the

second experiment, the probability is over the random choice of g and any random

choices that A makes. These two probabilities should be evaluated separately; the

two experiments are completely different.

To see how well A does at determining which world it is in, we look at the

difference in the probabilities that the two experiments return 1. If A is doing a

good job at telling which world it is in, it would return 1 more often in the first

experiment than in the second. So the difference is a measure of how well A is doing.

We call this measure the prf-advantage of A. Think of it as the probability that A

“breaks” the scheme F , with “break” interpreted in a specific, technical way based

on the definition.

Different adversaries will have different advantages. There are two reasons why

one adversary may achieve a greater advantage than another. One is that it is more

“clever” in the questions it asks and the way it processes the replies to determine

its output. The other is simply that it asks more questions, or spends more time

processing the replies. Indeed, we expect that as an adversary sees more and more

input-output examples of g, or spends more computing time, its ability to tell which

world it is in should go up.

The “security” of family F as a pseudorandom function must thus be thought

of as depending on the resources allowed to the attacker. We may want to want to

know, for any given resource limitations, what is the prf-advantage achieved by the

most “clever” adversary amongst all those who are restricted to the given resource

limits.

The choice of resources to consider can vary. One resource of interest is the

time-complexity t of A. Another resource of interest is the number of queries q

Bellare and Rogaway

Experiment Exp

prf- 1

F

(A)

K

$

← K

b

$

← A

F K

Return b

Experiment Exp

prf- 0

F

(A)

g

$

← Func(D,R)

b

$

← A

g

Return b

The prf-advantage of A is defined as

Adv

prf

F

(A) = Pr

[

Exp

prf- 1

F

(A) = 1

]

− Pr

[

Exp

prf- 0

F

(A) = 1

]

It should be noted that the family F is public. The adversary A, and

knows the description of the family and is capable, given values K, X,

ing F (K, X).

The worlds are captured by what we call experiments. The first expe

a random instance F K

of family F and then runs adversary A with ora

Adversary A interacts with its oracle, querying it and getting back a

eventually outputs a “guess” bit. The experiment returns the same bit.

experiment picks a random function g: D → R and runs A with this as o

returning A’s guess bit. Each experiment has a certain probability of

The probability is taken over the random choices made in the experim

for the first experiment, the probability is over the choice of K and

choices that A might make, for A is allowed to be a randomized algori

second experiment, the probability is over the random choice of g and

choices that A makes. These two probabilities should be evaluated sep

two experiments are completely different.

To see how well A does at determining which world it is in, we

difference in the probabilities that the two experiments return 1. If A

good job at telling which world it is in, it would return 1 more often

experiment than in the second. So the difference is a measure of how wel

We call this measure the prf-advantage of A. Think of it as the probab

“breaks” the scheme F , with “break” interpreted in a specific, technica

on the definition.

Different adversaries will have different advantages. There are two

one adversary may achieve a greater advantage than another. One is th

“clever” in the questions it asks and the way it processes the replies t

its output. The other is simply that it asks more questions, or spend

processing the replies. Indeed, we expect that as an adversary sees mo

input-output examples of g, or spends more computing time, its ability t

world it is in should go up.

The “security” of family F as a pseudorandom function must thus

of as depending on the resources allowed to the attacker. We may wan

know, for any given resource limitations, what is the prf-advantage ach

most “clever” adversary amongst all those who are restricted to the giv

limits.

The choice of resources to consider can vary. One resource of int

time-complexity t of A. Another resource of interest is the number

18

Def. Fix a function family F: Keys(F) " Dom(F)! Range(F)

F is a secure PRF if for any adversary with “reasonable”

resources its prf-advantage is “small”.

PRFs

The prf-advantage of an adversary A is

Bellare and Rogaway 9

Experiment Exp

prf- 1

F

(A)

K

$

← K

b

$

← A

F K

Return b

Experiment Exp

prf- 0

F

(A)

g

$

← Func(D,R)

b

$

← A

g

Return b

The prf-advantage of A is defined as

Adv

prf

F

(A) = Pr

[

Exp

prf- 1

F

(A) = 1

]

− Pr

[

Exp

prf- 0

F

(A) = 1

]

It should be noted that the family F is public. The adversary A, and anyone else,

knows the description of the family and is capable, given values K, X, of comput-

ing F (K, X).

The worlds are captured by what we call experiments. The first experiment picks

a random instance F

K

of family F and then runs adversary A with oracle g = F

K

Adversary A interacts with its oracle, querying it and getting back answers, and

eventually outputs a “guess” bit. The experiment returns the same bit. The second

experiment picks a random function g: D → R and runs A with this as oracle, again

returning A’s guess bit. Each experiment has a certain probability of returning 1.

The probability is taken over the random choices made in the experiment. Thus,

for the first experiment, the probability is over the choice of K and any random

Bellare and Rogaway 9

Experiment Exp

prf- 1

F

(A)

K

$

← K

b

$

← A

F K

Return b

Experiment Exp

prf- 0

F

(A)

g

$

← Func(D,R)

b

$

← A

g

Return b

The prf-advantage of A is defined as

Adv

prf

F

(A) = Pr

[

Exp

prf- 1

F

(A) = 1

]

− Pr

[

Exp

prf- 0

F

(A) = 1

]

.

It should be noted that the family F is public. The adversary A, and anyone else,

knows the description of the family and is capable, given values K, X, of comput-

ing F (K, X).

The worlds are captured by what we call experiments. The first experiment picks

a random instance F K of family F and then runs adversary A with oracle g = F K .

Adversary A interacts with its oracle, querying it and getting back answers, and

eventually outputs a “guess” bit. The experiment returns the same bit. The second

experiment picks a random function g: D → R and runs A with this as oracle, again

returning A’s guess bit. Each experiment has a certain probability of returning 1.

The probability is taken over the random choices made in the experiment. Thus,

19

Resources of an adversary

Time-complexity is measured in some fixed RAM model of

computation and includes the maximum of the running-times

of A in the experiments, plus the size of the code for A.

The number of queries A makes.

  • The total length of all queries.

20

Want a “master” property that a block cipher be PRP-CPA or

PRP-CCA secure.

Conjectures:

DES and AES are PRP-CCA (thus also PRP-CPA) secure.

  • For any B running time t and making q queries

Modeling block ciphers security property of block ciphers under which natural usages of block ciphers could be proven secure. We suggest that this master property is that the block cipher be a secure PRP, under either CPA or CCA. We cannot prove that specific block ciphers have this property. The best we can do is assume they do, and then go on to use them. For quantitative security assessments, we would make specific conjectures about the advantage functions of various block ciphers. For example we might conjecture something like: Adv prp-cpa DES

(A

t,q ) ≤ c 1

t/T DES

55

  • c 2

q

40 for any adversary A t,q that runs in time at most t and asks at most q 64 -bit oracle queries. Here T DES is the time to do one DES computation on our fixed RAM model of computation, and c 1 , c 2 are some constants depending only on this model. In other words, we are conjecturing that the best attacks are either exhaustive key search or linear cryptanalysis. We might be bolder with regard to AES and conjecture something like Adv prp-cpa AES

(B

t,q ) ≤ c 1

t/T AES

128

  • c 2

q

128

for any adversary B t,q that runs in time at most t and asks at most q 128 -bit oracle queries. We could also make similar conjectures regarding the strength of block ciphers as PRPs under CCA rather than CPA. More interesting is Adv prf DES (t, q). Here we cannot do better than assume that Adv prf DES

(A

t,q ) ≤ c 1

t/T DES

55

q 2

64 Adv prf AES

(B

t,q ) ≤ c 1

t/T AES

128

q 2

128

for any adversaries A t,q

, B

t,q running in time at most t and making at most q oracle queries. This is due to the birthday attack discussed later. The second term in each formula arises simply because the object under consideration is a family of permutations. We stress that these are all conjectures. There could exist highly effective attacks that break DES or AES as a PRF without recovering the key. So far, we do not know of any such attacks, but the amount of cryptanalytic effort that has focused on this goal is small. Certainly, to assume that a block cipher is a PRF is a much stronger assumption than that it is secure against key recovery. Nonetheless, the motivation and arguments we have outlined in favor of the PRF assumption stay, and our view is that if a block cipher is broken as a PRF then it should be considered insecure, and a replacement should be sought. assessments, we would make specific conjectures about the advantage functions of various block ciphers. For example we might conjecture something like: Adv prp-cpa DES (A t,q ) ≤ c 1 · t/T DES 2 55

  • c 2 · q 2 40 for any adversary A t,q that runs in time at most t and asks at most q 64 -bit oracle queries. Here T DES is the time to do one DES computation on our fixed RAM model of computation, and c 1 , c 2 are some constants depending only on this model. In other words, we are conjecturing that the best attacks are either exhaustive key search or linear cryptanalysis. We might be bolder with regard to AES and conjecture something like Adv prp-cpa AES (B t,q ) ≤ c 1 · t/T AES 2 128
  • c 2 · q 2 128 . for any adversary B t,q that runs in time at most t and asks at most q 128 -bit oracle queries. We could also make similar conjectures regarding the strength of block ciphers as PRPs under CCA rather than CPA. More interesting is Adv prf DES (t, q). Here we cannot do better than assume that Adv prf DES (A t,q ) ≤ c 1 · t/T DES 2 55

q 2 2 64 Adv prf AES (B t,q ) ≤ c 1 · t/T AES 2 128

q 2 2 128 . for any adversaries A t,q , B t,q running in time at most t and making at most q oracle queries. This is due to the birthday attack discussed later. The second term in each formula arises simply because the object under consideration is a family of permutations. We stress that these are all conjectures. There could exist highly effective attacks that break DES or AES as a PRF without recovering the key. So far, we do not know of any such attacks, but the amount of cryptanalytic effort that has focused on this goal is small. Certainly, to assume that a block cipher is a PRF is a much stronger assumption than that it is secure against key recovery. Nonetheless, the motivation and arguments we have outlined in favor of the PRF assumption stay, and our view is that if a block cipher is broken as a PRF then it should be considered insecure, and a replacement should be sought. 25 The “birthday” attack

Theorem. For any block cipher E with domain and range

{0,1} l and any A that makes q queries s.t.

Lemma. If we throw (at random) q balls into N$q bins and

if then the probability of a collision Appendix ??, and then come back to the following. This tells us that an instance of a block cipher random function based on seeing a number of input-o proximately 2

!/ 2

. This has important consequences fo

based protocols. Proposition 3.16 Let E: { 0 , 1 }

k

× { 0 , 1 }

!

!

Suppose q satisfies 2 ≤ q ≤ 2

(!+1)/ 2

. Then there is an a

queries and having running time about that to do q co Adv

prf E

(A) ≥ 0. 3 ·

q(q − 1 2

!

Proof of Proposition 3.16: Adversary A is given a

and works like this: Adversary A

g

for i = 1 ,... , q do

Let x

i

be the i-th l-bit string in lexicographic orde

y

i

← g(x

i

)

if y

1

,... , y

q

are all distinct then return 1 , else ret

Let us now justify Equation ( 3 .5). Letting N = 2

l

, we

Pr [ Exp prf- 1

E

(A) = 1

] = 1 Pr [ Exp prf- 0

E

(A) = 1

] = 1 − C Here C(N, q), as defined in Appendix ??, is the proba or more balls in the experiment of randomly throwing justify these claims shortly, but first let us use them t get Adv

prf E

(A) = Pr

[ Exp prf- 1

E

(A) = 1

] − Pr = 1 − [1 − C(N, q)] = C(N, q) ≥ 0. 3 · q(q − 1 ) 2

l

.

The last line is by Proposition ??. It remains to justif Equation ( 3 .6) is clear because in World 1 , g = E

K

for

family of permutations, g is a permutation, and thus y

1

Appendix ??, and then come back to the following.

This tells us that an instance of a block cipher can be distinguished from a random function based on seeing a number of input-output examples which is ap- proximately 2

!/ 2

. This has important consequences for the security of block cipher

based protocols. Proposition 3.16 Let E: { 0 , 1 }

k

× { 0 , 1 }

!

!

be a family of permutations.

Suppose q satisfies 2 ≤ q ≤ 2

(!+1)/ 2

. Then there is an adversary A, making q oracle

queries and having running time about that to do q computations of E, such that Adv

prf E

(A) ≥ 0. 3 ·

q(q − 1 ) 2

!

. ( 3 .5)

Proof of Proposition 3.16: Adversary A is given an oracle g: { 0 , 1 }

!

!

and works like this:

Adversary A

g

for i = 1 ,... , q do

Let x

i

be the i-th l-bit string in lexicographic order

y

i

← g(x

i

)

if y

1

,... , y

q

are all distinct then return 1 , else return 0

Let us now justify Equation ( 3 .5). Letting N = 2

l

, we claim that

Pr

[

Exp

prf- 1

E

(A) = 1

]

= 1 ( 3 .6)

Pr

[

Exp

prf- 0

E

(A) = 1

]

= 1 − C(N, q). ( 3 .7)

Here C(N, q), as defined in Appendix ??, is the probability that some bin gets two or more balls in the experiment of randomly throwing q balls into N bins. We will justify these claims shortly, but first let us use them to conclude. Subtracting, we get Adv

prf E

(A) = Pr

[

Exp

prf- 1

E

(A) = 1

]

− Pr

[

Exp

prf- 0

E

(A) = 1

]

= 1 − [1 − C(N, q)]

= C(N, q) ≥ 0. 3 · q(q − 1 ) 2

l

.

The last line is by Proposition ??. It remains to justify Equations ( 3 .6) and ( 3 .7). Equation ( 3 .6) is clear because in World 1 , g = E

K

for some key K, and since E is a

family of permutations, g is a permutation, and thus y

1

,... , y

q

are all distinct. Now,

already quite high, around 1 / 2. This fact can seem surprising when first heard. The reason it is true is that the collision probability C(N, q) grows roughly proportional to q

2

/N. This is the fact to

remember. The following gives a more exact rendering, providing both upper and lower bounds on this probability. Theorem A.1 [Birthday bound] Let C(N, q) denote the probability of at least one collision when we throw q ≥ 1 balls at random into N ≥ q buckets. Then C(N, q) ≤ q(q − 1 ) 2 N and C(N, q) ≥ 1 − e

−q(q− 1 )/ 2 N

.

Also if 1 ≤ q ≤ √ 2 N then C(N, q) ≥ 0. 3 · q(q − 1 ) N . 1 already quite high, around 1 / 2. This fact can seem surprising when first heard. The reason it is true is that the collision probability C(N, q) grows roughly proportional to q

2

/N. This is the fact to

remember. The following gives a more exact rendering, providing both upper and lower bounds on this probability. Theorem A.1 [Birthday bound] Let C(N, q) denote the probability of at least one collision when we throw q ≥ 1 balls at random into N ≥ q buckets. Then C(N, q) ≤ q(q − 1 ) 2 N and C(N, q) ≥ 1 − e

−q(q− 1 )/ 2 N

.

Also if 1 ≤ q ≤ √ 2 N then C(N, q) ≥ 0. 3 · q(q − 1 ) N . 1

26 Proof of the Lemma 1 − C(N, q) = 1 · N − 1 N · N − 2 N

...

N − q + 1 N = ( 1 − 1 N ) · ( 1 − 2 N ) ·... ( 1 − q − 1 N ) // Using that ≤ e − 1 N ·... e − q− 1 N = e − q(q−1) N // Using that 1 − e −x ≥ ( 1 − e − 1 )x q(q − 1 ) 2 N ≤ 1

if

≤ 1 − ( 1 − 1 e ) · q(q − 1 ) 2 N C(N, q) ≥ ( 1 − 1 e ) · q(q − 1 ) 2 N ≥ 0. 3 · q(q − 1 ) N

Thus

A.1: Let C i be the event that the i-th ball collides with one Then Pr [C i ] is at most (i − 1 )/N , since when the i-th ball is at most i − 1 different occupied slots and the i-th ball is equally of them. Now (N, q) = Pr [C 1 ∨ C 2 ∨ · · · ∨ C q ] ≤ Pr [C 1 ] + Pr [C 2 ] + · · · + Pr [C q ] ≤ 0 N

1 N

  • · · · + q − 1 N = q(q − 1 ) 2 N . er bound. For the lower bound we let D i be the event that fter having thrown in the i-th ball. If there is no collision after en they must all be occupying different slots, so the probability throwing in the (i + 1 )-st ball is exactly (N − i)/N. That is, Pr [D i+ | D i ] = N − i N = 1 − i N .
  1. The probability of no collision at the end of the game can a 1 − C(N, q) = Pr [D q ] = Pr [D q | D q− 1 ] · Pr [D q− 1 ] . . . . . . = q− 1

i= Pr [D i+ | D i ] = q− 1

i=

1 − i N

. So we can use the inequality 1 − x ≤ e −x for each term of the is means the above is not more than −i/N = e − 1 /N − 2 /N −···−(q− 1 )/N = e −q(q− 1 )/ 2 N . 27 Proof of the Theorem

Adversary A

g For i=1,..q do y i #g() EndFor If y i ,...y q are all distinct return 1, else return 0 EndIf

Bellare and Rogaway 23 the birthday paradox. If you are not familiar with this, you may want to look at Appendix ??, and then come back to the following. This tells us that an instance of a block cipher can be distinguished from a random function based on seeing a number of input-output examples which is ap- proximately 2 !/ 2

. This has important consequences for the security of block cipher

based protocols. Proposition 3.16 Let E: { 0 , 1 } k × { 0 , 1 } ! → { 0 , 1 } ! be a family of permutations. Suppose q satisfies 2 ≤ q ≤ 2 (!+1)/ 2

. Then there is an adversary A, making q oracle

queries and having running time about that to do q computations of E, such that Adv prf E (A) ≥ 0. 3 · q(q − 1 ) 2 !

. ( 3 .5)

Proof of Proposition 3.16: Adversary A is given an oracle g: { 0 , 1 } ! → { 0 , 1 } ! and works like this: Adversary A g for i = 1 ,... , q do Let x i be the i-th l-bit string in lexicographic order y i ← g(x i ) if y 1 ,... , y q are all distinct then return 1 , else return 0 Let us now justify Equation ( 3 .5). Letting N = 2 l , we claim that Pr [ Exp prf- 1 E (A) = 1 ] = 1 ( 3 .6) Pr [ Exp prf- 0 E (A) = 1 ] = 1 − C(N, q). ( 3 .7) Here C(N, q), as defined in Appendix ??, is the probability that some bin gets two or more balls in the experiment of randomly throwing q balls into N bins. We will justify these claims shortly, but first let us use them to conclude. Subtracting, we get Adv prf E (A) = Pr [ Exp prf- 1 E (A) = 1 ] − Pr [ Exp prf- 0 E (A) = 1 ] = 1 − [1 − C(N, q)] = C(N, q) ≥ 0. 3 · q(q − 1 ) 2 l . The last line is by Proposition ??. It remains to justify Equations ( 3 .6) and ( 3 .7). Equation ( 3 .6) is clear because in World 1 , g = E K for some key K, and since E is a family of permutations, g is a permutation, and thus y 1 ,... , y q are all distinct. Now, i-th l -bit string 28