Post · 14 min read· pp. 540–546

CS 276 Lecture 11: One-Way Functions

Summary

Today we begin a tour of the theory of one-way functions and pseudorandomness.

The highlight of the theory is a proof that if one-way functions exist (with good asymptotic security) then pseudorandom permutations exist (with good asymptotic security). We have seen that pseudorandom permutations suffice to do encryption and authentication with extravagantly high levels of security (respectively, CCA security and existential unforgeability under chosen message attack), and it is easy to see that if one-way functions do not exist, then every encryption and authentication scheme suffers from a total break.

Thus the conclusion is a strong “dichotomy” result, saying that either cryptography is fundamentally impossible, or extravagantly high security is possible.

Unfortunately the proof of this result involves a rather inefficient reduction, so the concrete parameters for which the dichotomy holds are rather unrealistic. (One would probably end up with a system requiring gigabyte-long keys and days of processing time for each encryption, with the guarantee that if it is not CCA secure then every 128-bit key scheme suffers a total break.) Nonetheless it is one of the great unifying achievements of the asymptotic theory, and it remains possible that a more effective proof will be found.

In this lecture and the next few ones we shall prove the weaker statement that if one-way permutations exist then pseudorandom permutations exist. This will be done in a series of four steps each involving reasonable concrete bounds. A number of combinatorial and number-theoretic problems which are believed to be intractable give us highly plausible candidate one-way permutations. Overall, we can show that if any of those well-defined and well-understood problems are hard, then we can get secure encryption and authentication with schemes that are slow but not entirely impractical. If, for example, solving discrete log with a modulus of the order of 21,000{2^{1,000}} is hard, then there is a CCA-secure encryption scheme requiring a 4,000{4,000}-bit key and fast enough to carry email, instant messages and probably voice communication. (Though probably too slow to encrypt disk access or video playback.)

1. One-way Functions and One-way Permutations

A one-way function f{f} is a function such that, for a random x{x}, it is hard to find a pre-image of f(x){f(x)}.

Definition 1 (One-way Function) A function f:{0,1}n→{0,1}m{f: \{ 0,1 \}^n \rightarrow \{ 0,1 \}^m} is (t,ϵ){(t,\epsilon)}-one way if for every algorithm A{A} of complexity ≤t{\leq t} we have

Px∼{0,1}n[A(f(x))=x′:f(x)=f(x′)]≤ϵ\displaystyle \mathop{\mathbb P}_{x \sim \{ 0,1 \}^n} [ A(f(x)) = x' : f(x) = f(x') ] \leq \epsilon

In the asymptotic theory, one is interested in one-way functions that are defined for all input lengths and are efficiently computable. Recall that a function ν:N→R{\nu: {\mathbb N} \rightarrow {\mathbb R}} is called negligible if for every polynomial p{p} we have lim⁡n→∞ν(n)/p(n)=0{\lim_{n\rightarrow\infty} \nu(n)/p(n) = 0}.

Definition 2 (One-way Function — Asymptotic Definition) A function f:{0,1}∗→{0,1}∗{f: \{ 0,1 \}^* \rightarrow \{ 0,1 \}^*} is one-way if

1. f{f} is polynomial time computable and 2. for every polynomial p(){p()} there is a negligible function ν{\nu} such that for all large enough n{n} the function fn(x):=(n,f(x)){f_n(x) := (n,f(x))} is (t(n),ν(n)){(t(n),\nu(n))}-one way.

Example 1 (Subset Sum) On input x∈{0,1}n{x\in \{ 0,1 \}^n}, where n=k⋅(k+1){n=k\cdot (k+1)}, SSk(x){SS_k(x)} parses x{x} as a sequence of k{k} integers, each k{k}-bit long, plus a subset I⊆{1,…,k}{I \subseteq \{1,\ldots,k\}}.

*The output is

SSk(x1,…,xk,I):=x1,…,xk,∑i∈Ixi\displaystyle SS_k(x_1,\ldots,x_k,I) := x_1,\ldots,x_k,\sum_{i\in I} x_i
*

Some variants of subset-sum have been broken, but it is plausible that SSk{SS_k} is a (t,ϵ){(t,\epsilon)}-one way function with t{t} and 1/ϵ{1/\epsilon} super-polynomial in k{k}, maybe even as large as 2kΩ(1){2^{k^{\Omega(1)}}}.

Exercise 1 Let f:{0,1}n→{0,1}m{f: \{ 0,1 \}^n \rightarrow \{ 0,1 \}^m} be a (t,ϵ){(t,\epsilon)}-secure one-way function. Show that

tϵ≤O((m+n)⋅2n)\displaystyle \frac t {\epsilon} \leq O( (m+n) \cdot 2^n )

Definition 3 (One-way Permutation) If f:{0,1}n→{0,1}n{f:\{ 0,1 \}^n \rightarrow \{ 0,1 \}^n} is a bijective (t,ϵ){(t,\epsilon)}-one way function, then we call f{f} a (t,ϵ){(t,\epsilon)}–one-way permutation.

If f{f} is an (asymptotic) one-way function, and for every n{n} f{f} is a bijection from {0,1}n{\{ 0,1 \}^n} into {0,1}n{\{ 0,1 \}^n}, then we say that f{f} is an (asymptotic) one-way permutation.

There is a non-trivial general attack against one-way permutations.

Exercise 2 Let f:{0,1}n→{0,1}m{f: \{ 0,1 \}^n \rightarrow \{ 0,1 \}^m} be a (t,ϵ){(t,\epsilon)}-secure one-way permutation. Show that

t2ϵ≤O((m+n)2⋅2n)\displaystyle \frac {t^2} {\epsilon} \leq O( (m+n)^2 \cdot 2^n )

This means that we should generally expect the input length of a secure one-way permutation to be at least 200 bits or so. (Stronger attacks than the generic one are known for the candidates that we shall consider, and their input length is usually 1000 bits or more.)

Example 2 (Modular Exponentiation) Let p{p} be a prime, and Zp∗{{\mathbb Z}^*_p} be the group whose elements are {1,…,p−1}{\{ 1,\ldots,p-1\}} and whose operation is multiplication  mod p{\bmod p}. It is a fact (which we shall not prove) that Zp∗{{\mathbb Z}^*_p} is cyclic, meaning that there is an element g{g} such that the mapping

*

EXPg,p(x):=gx mod p\displaystyle EXP_{g,p} (x) := g^x \bmod p

is a permutation on Zp∗{{\mathbb Z}^*_p}. Such an element g{g} is called a generator, and in fact most elements of Zp∗{{\mathbb Z}^*_p} are generators. EXPg,p{EXP_{g,p}} is conjectured to be one-way for most choices of p{p} and g{g}.

The problem of inverting EXPg,p{EXP_{g,p}} is called the discrete logarithm problem.*

The best known algorithm for the discrete logarithm is conjectured to run in time 2O((logp)1/3){2^{O((log p)^{1/3})}}. It is plausible that for most p{p} and most g{g} the discrete logarithm is a (t,ϵ){(t,\epsilon)} one way permutation with t{t} and ϵ−1{\epsilon^{-1}} of the order of 2(log⁡p)Ω(1){2^{(\log p)^{\Omega(1)}}}.

Problems like exponentiation do not fit well in the asymptotic definition, because of the extra parameters g,p{g,p}. (Technically, they do not fit our definitions at all because the input is an element of Zp∗{{\mathbb Z}^*_p} instead of a bit string, but this is a fairly trivial issue of data representation.) This leads to the definition of family of one-way functions (and permutations).

2. A Preview of What is Ahead

Our proof that a pseudorandom permutation can be constructed from any one-way permutation will proceed via the following steps:

  1. We shall prove that for any one-way permutation f{f} we can construct a hard-core predicate P{P}, that is a predicate P{P} such that P(x){P(x)} is easy to compute given x{x}, but it is hard to compute given f(x){f(x)}.
  2. From a one-way function with a hard-core predicate, we shall show how to construct a pseudorandom generator with one-bit expansion, mapping ℓ{\ell} bits into ℓ+1{\ell+1}.
  3. From a pseudorandom generator with one-bit expansion, we shall show how to get generators with essentially arbitrary expansion.
  4. From a length-doubling generator mapping ℓ{\ell} bits into 2ℓ{2\ell}, we shall show how to get pseudorandom functions.
  5. For a pseudorandom function, we shall show how to get pseudorandom permutations.

3. Hard-Core Predicate

Definition 4 (Hard-Core Predicate) A boolean function P:{0,1}n→{0,1}{P: \{ 0,1 \}^n \rightarrow \{ 0,1 \}} is (t,ϵ){(t,\epsilon)}-hard core for a permutation f:{0,1}n→{0,1}n{f: \{ 0,1 \}^n \rightarrow \{ 0,1 \}^n} if for every algorithm A{A} of complexity ≤t{\leq t}

Px∼{0,1}n[A(f(x))=P(x)]≤12+ϵ\displaystyle \mathop{\mathbb P}_{x\sim \{ 0,1 \}^n} [ A(f(x)) = P(x) ] \leq \frac 12 + \epsilon

Note that only one-way permutations can have efficiently computable hard-core predicates.

Exercise 3 Suppose that P{P} is a (t,ϵ){(t,\epsilon)}-hard core predicate for a permutation f:{0,1}n→{0,1}n{f:\{ 0,1 \}^n \rightarrow \{ 0,1 \}^n}, and P{P} is computable in time r{r}. Show that f{f} is (t−r,2ϵ){(t-r,2\epsilon)}-one way.

It is known that if Expg,p{Exp_{g,p}} is one-way, then every bit of x{x} is hard-core.

Our first theorem will be that a random XOR is hard-core for every one-way permutation.

We will use the following notation for “inner product” modulo 2:

⟨x,r⟩:=∑ixiri mod 2     (1)\displaystyle \langle x,r\rangle := \sum_i x_ir_i \bmod 2 \ \ \ \ \ (1)

Theorem 5 (Goldreich and Levin) Suppose that A{A} is an algorithm of complexity t{t} such that

*

Px,r[A(f(x),r)=⟨x,r⟩]≥12+ϵ     (2)\displaystyle \mathop{\mathbb P}_{x,r} [ A(f(x),r) = \langle x,r \rangle ] \geq \frac 12 + \epsilon \ \ \ \ \ (2)

Then there is an algorithm A′{A'} of complexity at most O(tϵ−4nO(1)){O(t \epsilon^{-4} n^{O(1)})} such that

Px[A′(f(x))=x]≥Ω(ϵ)\displaystyle \mathop{\mathbb P}_{x} [ A'(f(x)) = x ] \geq \Omega(\epsilon)
*

We begin by establishing the following weaker result.

Theorem 6 (Goldreich and Levin — Weak Version) Suppose that A{A} is an algorithm of complexity t{t} such that

*

Px,r[A(f(x),r)=⟨x,r⟩]≥1516     (3)\displaystyle \mathop{\mathbb P}_{x,r} [ A(f(x),r) = \langle x,r \rangle ] \geq \frac {15}{16} \ \ \ \ \ (3)

Then there is an algorithm A′{A'} of complexity at most O(tnlog⁡n+n2log⁡n){O(t n \log n + n^2 \log n)} such that

Px[A′(f(x))=x]≥13\displaystyle \mathop{\mathbb P}_{x} [ A'(f(x)) = x ] \geq \frac 13
*

Before getting into the proof of Theorem 6, it is useful to think of the “super-weak” version of the Goldreich-Levin theorem, in which the right-hand-side in (3) is 1. Then inverting f{f} is very easy. Call ei∈{0,1}n{e_i \in \{ 0,1 \}^n} the vector that has 1{1} in the i{i}-th position and zeroes everywhere else, thus ⟨x,ei⟩=xi{\langle x,e_i \rangle = x_i}. Now, given y=f(x){y=f(x)} and an algorithm A{A} for which the right-hand-side of (3) is 1, we have xi=A(y,ei){x_i = A(y,e_i)} for every i{i}, and so we can compute x{x} given f(x){f(x)} via n{n} invocations of A{A}. In order to prove the Goldreich-Levin theorem we will do something similar, but we will have to deal with the fact that we only have an algorithm that approximately computes inner products.

We derive the Weak Goldreich-Levin Theorem from the following reconstruction algorithm.

Lemma 7 (Goldreich-Levin Algorithm — Weak Version) There is an algorithm GLW{GLW} that given oracle access to a function H:{0,1}n→{0,1}n{H: \{ 0,1 \}^n \rightarrow \{ 0,1 \}^n} such that, for some x∈{0,1}n{x\in \{ 0,1 \}^n},

Pr∼{0,1}n[H(r)=⟨x,r⟩]≥78\displaystyle \mathop{\mathbb P}_{r \sim \{ 0,1 \}^n } [ H(r) = \langle x,r \rangle ] \geq \frac 78

runs in time O(n2log⁡n){O(n^2 \log n)}, makes O(log⁡n){O(\log n)} queries into H{H}, and with 1−o(1){1-o(1)} probability outputs x{x}.

Before proving Lemma 7, we need to state the following version of the Chernoff Bound.

Lemma 8 (Chernoff Bound) Let X1,…,Xn{X_1,\ldots,X_n} be mutually independent 0/1{0/1} random variables. Then, for every ϵ>0{\epsilon >0}, we have

P[∑i=1nXi>E∑i=1nXi+ϵn]≤e−2ϵ2n     (4)\displaystyle \mathop{\mathbb P} \left[ \sum_{i=1}^n X_i > \mathop{\mathbb E} \sum_{i=1}^n X_i + \epsilon n \right] \leq e^{-2\epsilon^2 n} \ \ \ \ \ (4)

Proof: We only give a sketch. Let Yi:=Xi−EXi{Y_i := X_i - \mathop{\mathbb E} X_i}. Then we want to prove that

P[∑iYi>ϵn]≤e−2ϵ2n\displaystyle \mathop{\mathbb P} \left[ \sum_i Y_i > \epsilon n \right] \leq e^{-2\epsilon^2 n }

For every fixed λ{\lambda}, Markov’s inequality gives us

P[∑iYi>ϵn]=P[eλ∑iYi>eλϵn]≤Eeλ∑iYieλϵn\displaystyle \begin{array}{rcl} \mathop{\mathbb P} \left[ \sum_i Y_i > \epsilon n\right ] & = & \mathop{\mathbb P} \left[ e^{\lambda \sum_i Y_i } > e^{\lambda \epsilon n}\right ]\\ & \leq & \frac{\mathop{\mathbb E} e^{\lambda \sum_i Y_i} }{e^{\lambda \epsilon n} } \end{array}

We can use independence to write

Eeλ∑iYi=∏iEeλYi\displaystyle \mathop{\mathbb E} e^{\lambda \sum_i Y_i} = \prod_i \mathop{\mathbb E} e^{\lambda Y_i}

and some calculus shows that for every Yi{Y_i} we have

EeλYi≤eλ2/8\displaystyle \mathop{\mathbb E} e^{\lambda Y_i} \leq e^{\lambda^2/8}

So we get

P[∑iYi>ϵn]≤eλ2n/8−λϵn     (5)\displaystyle \mathop{\mathbb P} \left[ \sum_i Y_i > \epsilon n \right] \leq e^{\lambda^2n/8 - \lambda \epsilon n} \ \ \ \ \ (5)

Equation (5) holds for every λ>0{\lambda >0}, and in particular for λ:=4ϵ{\lambda := 4\epsilon} giving us

P[∑iYi>ϵn]≤e−2ϵ2n\displaystyle \mathop{\mathbb P}\left [ \sum_i Y_i > \epsilon n \right ] \leq e^{-2\epsilon^2 n}

as desired. □\Box

We can proceed with the design and the analysis of the algorithm of Lemma 7.

Proof: [Of Lemma 7] The idea of the algorithm is that we would like to compute ⟨x,ei⟩{\langle x, e_i \rangle} for i=1,…,n{i=1,\ldots,n}, but we cannot do so by simply evaluating H(ei){H(e_i)}, because it is entirely possible that H{H} is incorrect on those inputs. If, however, we were just interested in computing ⟨x,r⟩{\langle x,r \rangle} for a random r{r}, then we would be in good shape, because H(r){H(r)} would be correct with resonably large probability. We thus want to reduce the task of computing ⟨x,y⟩{\langle x,y\rangle} on a specific y{y}, to the task of computing ⟨x,r⟩{\langle x,r\rangle} for a random r{r}. We can do so by observing the following identity: for every y{y} and every r{r}, we have

⟨x,y⟩=⟨x,r+y⟩−⟨x,r⟩\displaystyle \langle x,y \rangle = \langle x, r + y \rangle - \langle x, r\rangle

where all operations are mod 2. (And bit-wise, when involving vectors.) So, in order to compute ⟨x,y⟩{\langle x,y \rangle} we can pick a random r{r}, and then compute H(r+y)−H(r){H(r+y) - H(r)}. If r{r} is uniformly distributed, then H(r+y){H(r+y)} and H(r){H(r)} are uniformly distributed, and we have

Pr∼{0,1}n[H(r+y)−H(r)=⟨x,y⟩]≥Pr∼{0,1}n[H(r+y)=⟨x,r+y⟩∧H(r)=⟨x,r⟩]=1−Pr∼{0,1}n[H(r+y)≠⟨x,r+y⟩∨H(r)≠⟨x,r⟩]≥1−Pr∼{0,1}n[H(r+y)≠⟨x,r+y⟩]−Pr∼{0,1}n[H(r)≠⟨x,r⟩]≥34\displaystyle \begin{array}{rcl} && \mathop{\mathbb P}_{r\sim \{ 0,1 \}^n} [ H(r+y) - H(r) = \langle x,y \rangle ] \\ & \geq & \mathop{\mathbb P}_{r\sim \{ 0,1 \}^n} [ H(r+y) = \langle x,r+y \rangle \wedge H(r) = \langle x,r \rangle ] \\ & = & 1 - \mathop{\mathbb P}_{r\sim \{ 0,1 \}^n} [ H(r+y) \neq \langle x,r+y \rangle \vee H(r) \neq \langle x,r \rangle ] \\ & \geq & 1 - \mathop{\mathbb P}_{r\sim \{ 0,1 \}^n} [ H(r+y) \neq \langle x,r+y \rangle ] - \mathop{\mathbb P}_{r\sim \{ 0,1 \}^n} [ H(r) \neq \langle x,r \rangle ]\\ & \geq & \frac 34 \end{array}

Suppose now that we pick independently several random vectors r1,…,rk{r_1,\ldots,r_k}, and that we compute Yj:=H(rj+y)−H(rj){Y_j := H(r_j + y) - H(r_j)} for j=1,…,k{j=1,\ldots,k} and we take the majority value of the Yj{Y_j} as our estimate for ⟨x,y⟩{\langle x,y\rangle}. By the above analysis, each Yj{Y_j} equals ⟨x,y⟩{\langle x,y\rangle} with probability at least 3/4{3/4}; furthermore, the events Yj=⟨x,y⟩{Y_j =\langle x,y\rangle} are mutually independent. We can then invoke the Chernoff bound to deduce that the probability that the majority value is wrong is at most e−k/8{e^{-k/8}}. (If the majority vote of the Yj{Y_j} is wrong, it means that at least k/2{k/2} or the Yj{Y_j} are wrong, even though the expected number of wrong ones is at most k/4{k/4}, implying a deviation of k/4{k/4} from the expectation; we can invoke the Chernoff bound with ϵ=1/4{\epsilon=1/4}.) The algorithm GLW is thus as follows:

  • Algorithm GLW
  • for i:=1{i:=1} to n{n}
    • for j:=1{j:=1} to 16log⁡n{16 \log n}
      • pick a random rj∈{0,1}n{r_j \in \{ 0,1 \}^n}
    • xi:=majority{H(rj+ei)−H(ei):j=1,…,16log⁡n}{x_i := {\rm majority} \{H(r_j + e_i) - H(e_i) : j = 1,\ldots,16\log n \}}
  • return x{x}

For every i{i}, the probability fails to compute ⟨x,ei⟩=xi{\langle x, e_i \rangle = x_i} is at most e−2log⁡n=1/n2{e^{-2\log n} = 1/n^2}. So the probability that the algorithm fails to return x{x} is at most 1/n=o(1){1/n = o(1)}. The algorithm takes time O(n2log⁡n){O(n^2 \log n)} and makes 32nlog⁡n{32 n \log n} oracle queries into H{H}. □\Box

In order to derive Theorem 6 from Lemma 7 we will need the following variant of Markov’s inequality.

Lemma 9 Let X{X} be a discrete bounded non-negative random variable ranging over [0,1]{[0,1]}. Then for every 0≤t≤EX{0 \leq t \leq \mathop{\mathbb E} X},

P[X≥t]≥EX−t1−t     (6)\displaystyle \mathop{\mathbb P} [ X \geq t ] \geq \frac{ \mathop{\mathbb E} X - t} { 1-t} \ \ \ \ \ (6)

Proof: Let R{R} be the set of values taken by X{X} with non-zero probability. Then

EX=∑v∈Rv⋅P[X=v]=∑v∈R:v<tv⋅P[X=v]+∑v∈R:v≥tv⋅P[X=v]≤∑v∈R:v<tt⋅P[X=v]+∑v∈R:v≥t1⋅P[X=v]=t⋅P[X<t]+P[X≥t]=t−t⋅P[X≥t]+P[X≥t]\displaystyle \begin{array}{rcl} \mathop{\mathbb E} X & = & \sum_{v\in R} v \cdot \mathop{\mathbb P} [X=v]\\ & = & \sum_{v\in R: v< t} v \cdot \mathop{\mathbb P} [X=v] + \sum_{v\in R: v\geq t} v \cdot \mathop{\mathbb P} [X=v] \\ & \leq & \sum_{v\in R: v< t} t \cdot \mathop{\mathbb P} [X=v] + \sum_{v\in R: v\geq t} 1 \cdot \mathop{\mathbb P} [X=v] \\ & = & t \cdot \mathop{\mathbb P} [ X < t] + \mathop{\mathbb P} [ X \geq t] \\ & = & t - t \cdot \mathop{\mathbb P} [ X \geq t] + \mathop{\mathbb P} [ X \geq t] \end{array}

So we have P[X≥t]⋅(1−t)≥EX−t{\mathop{\mathbb P} [ X \geq t] \cdot (1-t) \geq \mathop{\mathbb E} X - t}. □\Box

We can now prove Theorem 6.

Proof: [Of Theorem 6] The assumption of the Theorem can be rewritten as

Ex[Pr[A(f(x),r)=⟨x,r⟩]]≥1516\displaystyle \mathop{\mathbb E}_x \left[ \mathop{\mathbb P}_r [A(f(x),r) = \langle x,r \rangle ] \right ] \geq \frac {15}{16}

From Lemma 9 we have

Px[Pr[A(f(x),r)=⟨x,r⟩]≥78]≥12\displaystyle \mathop{\mathbb P}_x \left[ \mathop{\mathbb P}_r [A(f(x),r) = \langle x,r \rangle ] \geq \frac 78 \right] \geq \frac 12

Call an x{x} “good” if it satisfies Pr[A(f(x),r)=⟨x,r⟩]{\mathop{\mathbb P}_r [ A(f(x),r) = \langle x,r \rangle]}.

The inverter A′{A'}, on input y=f(x){y=f(x)}, runs the algorithm GLW using the oracle A′(y,⋅){A'(y,\cdot)}. If x{x} is good, then the algorithm finds x{x} with probability at least 1−o(1){1-o(1)}. At least half of the choices of x{x} are good, so overall the algorithm inverts f(){f()} on at least a .5−o(1)>1/3{.5 - o(1) > 1/3} fraction of inputs. The running time of the algorithm if O(n2log⁡n){O(n^2 \log n)} plus the cost of 32nlog⁡n{32 n \log n} calls to A(y,⋅){A(y,\cdot)}, each costing time t{t}. □\Box