Post · 8 min read· pp. 565–568

CS276 Lecture 16: Pseudorandom Permutations

Scribed by Anupam Prakash

Summary

Today we finish the analysis of a construction of a pseudorandom permutation (block cipher) given a pseudorandom function.

1. The Luby-Rackoff Construction

Recall that if F:{0,1}m→{0,1}m{F:\{ 0,1 \}^m \rightarrow \{ 0,1 \}^m} is a function, then we define the Feistel permutation DF:{0,1}2m→{0,1}2m{D_F: \{ 0,1 \}^{2m} \rightarrow \{ 0,1 \}^{2m}} associated with F{F} as

DF(x,y):=y,x⊕F(y)     (1)\displaystyle D_F(x,y) := y, x\oplus F(y) \ \ \ \ \ (1)

Let F:{0,1}k×{0,1}m→{0,1}m{F: \{ 0,1 \}^k \times \{ 0,1 \}^m \rightarrow \{ 0,1 \}^m} be a pseudorandom function, we define the following function P:{0,1}4k×{0,1}2m→{0,1}2m{P: \{ 0,1 \}^{4k} \times \{ 0,1 \}^{2m} \rightarrow \{ 0,1 \}^{2m}}: given a key K‾(K1,…,K4){\overline K (K_1,\ldots,K_4)} and an input x{x},

PK‾(x):=DFK4(DFK3(DFK2(DFK1(x))))     (2)\displaystyle P_{\overline K} (x) := D_{F_{K_4}} ( D_{F_{K_3}} ( D_{F_{K_2}} (D_{F_{K_1}} (x ))))\ \ \ \ \ (2)

If F‾=F1,F2,F3,F4{\overline F = F_1,F_2,F_3,F_4} are four functions, then PF‾{P_{\overline F}} is the same as the above construction but using the functions Fi{F_i}:

PF‾(x):=DF4(DF3(DF2(DF1(x))))     (3)\displaystyle P_{\overline F} (x) := D_{F_{4}} ( D_{F_{3}} ( D_{F_{2}} (D_{F_{1}} (x ))))\ \ \ \ \ (3)

If A{A} is an oracle algorithm, we define as S(A){S(A)} the probabilistic process in which we run a simulation of A{A} in which we reply to each query with a random answer.

2. Today’s Proof

The proof of the following result is what was missing from yesterday’s analysis.

Lemma 1 For every non-repeating algorithm A{A} of complexity ≤t{\leq t} we have

*

∣PF‾[APR‾,PR‾−1()=1]−P[S(A)=1]∣\displaystyle \left| \mathop{\mathbb P}_{\overline {F} } [ A^{P_{\overline{R}}, P^{-1} _{\overline{R}} } () =1 ] - \mathop{\mathbb P} [ S(A) = 1] \right|

≤t22⋅22m+t22m\displaystyle \leq \frac{t^2}{ 2\cdot 2^{2m}} + \frac {t^2}{ 2^{m}}
*

Proof: The transcript of A{A}‘s computation consists of all the oracle queries made by A{A}. The notation (x,y,0){(x,y,0)} represents a query to the π{\pi} oracle at point x{x} while (x,y,1){(x,y,1)} is a query made to the π−1{\pi^{-1}} oracle at y{y}. The set T{T} consists of all valid transcripts for computations where the output of A{A} is 1 while T′⊂T{T^{'} \subset T} consists of transcripts in T{T} consistent with π{\pi} being a permutation.

We write the difference in the probability of A{A} outputting 1 when given oracles (PR‾,PR‾−1){(P_{\overline{R}}, P_{\overline{R}}^{-1})} and when given a random oracle as in S(A){S(A)} as a sum over transcripts in T{T}.

∣PF‾[APR‾,PR‾−1()=1]−P[S(A)=1]∣=∣∑τ∈T(PF‾[APR‾,PR‾−1()←τ]−P[S(A)←τ])∣     (4)\displaystyle \begin{array}{c} \left| \mathop{\mathbb P}_{\overline {F} } [ A^{P_{\overline{R}}, P^{-1} _{\overline{R}} } () =1 ] - \mathop{\mathbb P} [ S(A) = 1] \right| \\ = \left| \sum_{\tau \in T} \left(\mathop{\mathbb P}_{\overline {F} } [ A^{P_{\overline{R}}, P^{-1} _{\overline{R}} } () \leftarrow \tau ] - \mathop{\mathbb P} [ S(A) \leftarrow \tau]\right) \right| \end{array} \ \ \ \ \ (4)

We split the sum over T{T} into a sum over T′{T^{'}} and T∖T′{T\setminus T^{'}} and bound both the terms individually. We first handle the simpler case of the sum over T∖T′{T\setminus T^{'}}.

∣∑τ∈T∖T′(PF‾[APR‾,PR‾−1()←τ]−P[S(A)←τ])∣=∣∑τ∈T∖T′(P[S(A)←τ])∣≤t22.22m     (5)\displaystyle \begin{array}{rcl} && \displaystyle \left| \sum_{\tau \in T\setminus T^{'}} \left(\mathop{\mathbb P}_{\overline {F} } [ A^{P_{\overline{R}}, P^{-1} _{\overline{R}} } () \leftarrow \tau ] - \mathop{\mathbb P} [ S(A) \leftarrow \tau] \right) \right| \\ & =& \displaystyle \left| \sum_{\tau \in T\setminus T^{'}} \left(\mathop{\mathbb P} [ S(A) \leftarrow \tau] \right) \right| \\ & \leq & \displaystyle \frac{t^{2}}{2.2^{2m}} \end{array} \ \ \ \ \ (5)

The first equality holds as a transcript obtained by running A{A} using the oracle (PR‾,PR‾−1){(P_{\overline{R}}, P_{\overline{R}}^{-1})} is always consistent with a permutation. The transcript generated by querying an oracle is inconsistent with a permutation iff. points x,y{x,y} with f(x)=f(y){f(x)=f(y)} are queried. S(A){S(A)} makes at most t{t} queries to an oracle that answers every query with an independently chosen random string from {0,1}2m{\{ 0, 1\}^{2m}}. The probability of having a repetition is at most (∑i=1t−1i)/22m≤t2/22m+1{(\sum_{i=1}^{t-1} i)/2^{2m} \leq t^{2}/2^{2m+1}}.

Bounding the sum over transcripts in T′{T^{'}} will require looking into the workings of the construction. Fix a transcript τ∈T′{\tau \in T^{'}} given by (xi,yi,bi),1≤i≤q{(x_{i}, y_{i}, b_{i}), 1\leq i \leq q}, with the number of queries q≤t{q \leq t}. Each xi{x_{i}} can be written as (Li0,Ri0){(L_{i}^{0}, R_{i}^{0})} for strings Li0,Ri0{L_{i}^{0}, R_{i}^{0}} of length m{m} corresponding to the left and right parts of xi{x_{i}}. The string xi{x_{i}} goes through 4{4} iterations of D{D} using the function Fk,1≤k≤4{F_{k}, 1\leq k\leq 4} for the k{k}th iteration. The output of the construction after iteration k{k}, 0≤k≤4{0 \leq k \leq 4} for input xi{x_{i}} is denoted by (Lik,Rik){(L_{i}^{k}, R_{i}^{k})}.

Functions F1,F4{F_{1},F_{4}} are said to be good for the transcript τ{\tau} if the multisets {R11,R21,⋯ ,Rq1}{\{R^{1}_{1}, R^{1}_{2}, \cdots, R^{1}_{q}\}} and {L13,L23,⋯ ,Lq3}{\{L^{3}_{1}, L^{3}_{2}, \cdots, L^{3}_{q}\}} do not contain any repetitions. We bound the probability of F1{F_{1}} being bad for τ{\tau} by analyzing what happens when Ri1=Rj1{R^{1}_{i}=R^{1}_{j}} for some i,j{i,j}:

Ri1=Li0⊕F1(Ri0)\displaystyle R^{1}_{i} = L^{0}_{i} \oplus F_{1}( R^{0}_{i})

Rj1=Lj0⊕F1(Rj0)\displaystyle R^{1}_{j} = L^{0}_{j} \oplus F_{1}( R^{0}_{j})

0=Li0⊕Lj0⊕F1(Ri0)⊕F1(Rj0)     (6)\displaystyle 0 = L^{0}_{i} \oplus L^{0}_{j} \oplus F_{1}( R^{0}_{i}) \oplus F_{1}( R^{0}_{j}) \ \ \ \ \ (6)

The algorithm A{A} does not repeat queries so we have (Li0,Ri0)≠(Lj0,Rj0){(L_{i}^{0}, R_{i}^{0}) \neq (L_{j}^{0}, R_{j}^{0})}. We observe that Ri0≠Rj0{R_{i}^{0} \neq R_{j}^{0}} as equality together with equation (6) above would yield xi=xj{x_{i}=x_{j}}. This shows that equation (6) holds only if F1(Rj0)=s⊕F1(Ri0){F_{1}( R^{0}_{j})= s \oplus F_{1}( R^{0}_{i}) }, for a fixed s{s} and distinct strings Ri0{R^{0}_{i}} and Rj0{R^{0}_{j}}. This happens with probability 1/2m{1/2^{m}} as the function F1{F_{1}} takes values from {0,1}m{\{ 0, 1\}^{m}} independently and uniformly at random. Applying the union bound for all pairs i,j{i,j},

PrF1[∃i,j∈[q],    Ri1=Rj1]≤t22m+1     (7)\displaystyle Pr_{F_{1}}[ \exists i,j \in [q], \; \; R^{1}_{i}=R^{1}_{j} ] \leq \frac{t^{2}}{2^{m+1}} \ \ \ \ \ (7)

We use a similar argument to bound the probability of F4{F_{4}} being bad. If Li3=Lj3{L^{3}_{i}=L^{3}_{j}} for some i,j{i,j} we would have:

Li3=Ri4⊕F4(Li4)Lj3=Rj4⊕F4(Lj4)\displaystyle \begin{array}{rcl} L^{3}_{i} &=& R^{4}_{i} \oplus F_{4}( L^{4}_{i}) \\ L^{3}_{j} &=& R^{4}_{j} \oplus F_{4}( L^{4}_{j}) \end{array}

0=Ri4⊕Rj4⊕F4(Li4)⊕F4(Lj4)     (8)\displaystyle 0 = R^{4}_{i} \oplus R^{4}_{j} \oplus F_{4}( L^{4}_{i}) \oplus F_{4}( L^{4}_{j}) \ \ \ \ \ (8)

The algorithm A{A} does not repeat queries so we have (Li4,Ri4)≠(Lj4,Rj4){(L_{i}^{4}, R_{i}^{4}) \neq (L_{j}^{4}, R_{j}^{4})}. We observe that Li4≠Lj4{L_{i}^{4} \neq L_{j}^{4}} as equality together with equation (8) above would yield yi=yj{y_{i}=y_{j}}. This shows that equation (8) holds only if F4(Lj4)=s′⊕F4(Li4){F_{4}( L^{4}_{j})= s^{'} \oplus F_{4}( L^{4}_{i}) }, for a fixed string s′{s^{'}} and distinct strings Li4{L^{4}_{i}} and Lj4{L^{4}_{j}}. This happens with probability 1/2m{1/2^{m}} as the function F4{F_{4}} takes values from {0,1}m{\{ 0, 1\}^{m}} independently and uniformly at random. Applying the union bound for all pairs i,j{i,j},

PrF4[∃i,j∈[q],    Li3=Lj3]≤t22m+1     (9)\displaystyle Pr_{F_{4}}[ \exists i,j\in [q], \; \; L^{3}_{i}=L^{3}_{j} ] \leq \frac{t^{2}}{2^{m+1}} \ \ \ \ \ (9)

Equations (7) and (9) together imply that

PrF1,F4[F1,F4 not good for transcript τ]≤t22m     (10)\displaystyle Pr_{F_{1}, F_{4}}[ F_{1}, F_{4} \text{ not good for transcript } \tau ] \leq \frac{t^{2}}{2^{m}} \ \ \ \ \ (10)

Continuing the analysis, we fix good functions F1{F_{1}}, F4{F_{4}} and the transcript τ{\tau}. We will show that the probability of obtaining τ{\tau} as a transcript in this case is the same as the probability of obtaining τ{\tau} for a run of S(A){S(A)}. Let τ=(xi,yi,bi),1≤i≤q≤t{\tau= (x_{i}, y_{i}, b_{i}), 1 \leq i \leq q \leq t}. We calculate the probability of obtaining yi{y_{i}} on query xi{x_{i}} over the choice of F2{F_{2}} and F3{F_{3}} .

The values of the input xi{x_{i}} are in bijection with pairs (Li1,Ri1){(L_{i}^{1}, R_{i}^{1})} while the values of the output yi{y_{i}} are in bijection with pairs (Li3,Ri3){(L_{i}^{3}, R_{i}^{3})}, after fixing F1{F_{1}} and F4{F_{4}}. We have the relations (from (1)(3)):

Li3=Ri2=Li1⊕F2(Ri1)Ri3=Li2⊕F3(Ri2)=Ri1⊕F3(Li3)\displaystyle \begin{array}{rcl} L_{i}^{3} = R_{i}^{2} = L_{i}^{1} \oplus F_{2}( R_{i}^{1} ) \\ R_{i}^{3} = L_{i}^{2} \oplus F_{3}( R_{i}^{2}) = R_{i}^{1} \oplus F_{3}( L_{i}^{3} ) \end{array}

These relations imply that (xi,yi){(x_{i}, y_{i})} can be an input output pair if and only if we have F2(Ri1),F3(Li3)=(Li3⊕Li1,Ri3⊕Ri1){F_{2}( R_{i}^{1}), F_{3}( L_{i}^{3})= (L_{i}^{3} \oplus L_{i}^{1}, R_{i}^{3} \oplus R_{i}^{1})}. Since F2{F_{2}} and F3{F_{3}} are random functions with range {0,1}m{\{0,1\}^{m}}, the pair (xi,yi){(x_{i}, y_{i})} occurs with probability 2−2m{2^{-2m}}. The values Ri1{R^{1}_{i}} and Li3,(i∈[q]){L^{3}_{i}, (i \in [q])} are distinct because the functions F1{F_{1}} and F4{F_{4}} are good. This makes the occurrence of (xi,yi){(x_{i}, y_{i})} independent from the occurrence of (xj,yj){(x_{j}, y_{j})} for i≠j{i \neq j}. We conclude that the probability of obtaining the transcript τ{\tau} equals 2−2mq{2^{-2mq}}.

The probability of obtaining transcript τ{\tau} equals 2−2mq{2^{-2mq}} in the simulation S(A){S(A)} as every query is answered by an independent random number from {0,1}2m{\{0,1\}^{2m}}. Hence,

∣∑τ∈T′(PF‾[APR‾,PR‾−1()←τ]−P[S(A)←τ])∣≤∣∑τ∈T′PF2,F3[APR‾,PR‾−1()←τ∣F1,F4 not good for τ]∣≤t22m∣∑τ∈T′PF2,F3[APR‾,PR‾−1()←τ]∣≤t22m     (11)\displaystyle \begin{array}{rcl} && \displaystyle \left| \sum_{\tau \in T^{'}} \left(\mathop{\mathbb P}_{\overline {F} } [ A^{P_{\overline{R}}, P^{-1} _{\overline{R}} } () \leftarrow \tau ] - \mathop{\mathbb P} [ S(A) \leftarrow \tau] \right) \right| \\ &\leq & \displaystyle \left| \sum_{\tau \in T^{'}} \mathop{\mathbb P}_{F_{2}, F_{3} } \left[ A^{P_{\overline{R}}, P^{-1} _{\overline{R}} } () \leftarrow \tau | F_{1}, F_{4} \text { not good for } \tau \right] \right| \\ & \leq & \displaystyle \frac{t^{2}}{2^{m}} \left | \sum_{\tau \in T^{'}} \mathop{\mathbb P}_{F_{2}, F_{3} } [ A^{P_{\overline{R}}, P^{-1} _{\overline{R}} } () \leftarrow \tau] \right | \\ & \leq & \displaystyle \frac{t^{2}}{2^{m}} \end{array} \ \ \ \ \ (11)

The statement of the lemma follows by adding equations (5) and (11) and using the triangle inequality. □\Box

This concludes the analysis of the Luby-Rackoff scheme for constructing pseudorandom permutations from a family of pseudorandom functions.