🎉 从330转为WashU帮助手册啦!

CSE442
模块
Cse442t L15

Lecture 15

Random Function

F:{0,1}n{0,1}nF:\{0,1\}^n\to \{0,1\}^n

For each x{0,1}nx\in \{0,1\}^n, there are 2n2^n possible values for F(x)F(x).

pick y=F(x){0,1}ny=F(x)\gets \{0,1\}^n independently at random. (nn bits)

This generates n2nn\cdot 2^n random bits to specify FF.

Equivalent description of FF

# initialized empty list L
L=collections.defaultdict(int)
# initialize n bits constant
n=10
def F(x):
    """ simulation of random function
    param:
        x: n bits
    return:
        y: n bits
    """
    if L[x] is not None:
        return L[x]
    else:
        # y is a random n-bit string
        y=random.randbits(n)
        L[x]=y
        return y

However, this is not a good random function since two communicator may not agree on the same FF.

Pseudorandom Function

f:{0,1}n{0,1}nf:\{0,1\}^n\to \{0,1\}^n

Oracle Access (for function gg)

OgO_g is a p.p.t. that given x{0,1}nx\in \{0,1\}^n outputs g(x)g(x).

The distinguisher DD is given oracle access to OgO_g and outputs 11 if gg is random and 00 otherwise. It can make polynomially many queries.

Oracle indistinguishability

{Fn}\{F_n\} and {Gn}\{G_n\} are sequence of distribution on functions

f:{0,1}l1(n){0,1}l2(n)f:\{0,1\}^{l_1(n)}\to \{0,1\}^{l_2(n)}

that are computationally indistinguishable

{fn}{gn}\{f_n\}\sim \{g_n\}

if for all p.p.t. DD (with oracle access to FnF_n and GnG_n),

P[fFn:Df(1n)=1]P[gGn:Dg(1n)=1]<ϵ(n)\left|P[f\gets F_n:D^f(1^n)=1]-P[g\gets G_n:D^g(1^n)=1]\right|< \epsilon(n)

where ϵ(n)\epsilon(n) is negligible.

Under this property, we still have:

  • Closure properties. under efficient procedures.
  • Prediction lemma.
  • Hybrid lemma.

Pseudorandom Function Family

Definition: {fs:{0,1}{0.1}S{0,1}P\{f_s:\{0,1\}^\{0.1\}^{|S|}\to \{0,1\}^P t0s{0,1}n}t_0s\in \{0,1\}^n\} is a pseudorandom function family if {fs}s{0,1}n\{f_s\}_{s\in \{0,1\}^n} are oracle indistinguishable.

  • It is easy to compute for every x{0,1}Sx\in \{0,1\}^{|S|}.
  • {s{0,1}n}n{FRFn,F}\{s \gets\{0,1\}^n\}_n\approx \{F\gets RF_n,F\} is indistinguishable from the uniform distribution over {0,1}P\{0,1\}^P.
    • RR is truly random function.

Example:

For s{0,1}ns\in \{0,1\}^n, define fs:xssf_s:\overline{x}\mapsto s\cdot \overline{s}.

D\mathcal{D} gives oracle access to g(0n)=y0g(0^n)=\overline{y_0}, g(1n)=y1g(1^n)=\overline{y_1}. If y0+y1=1n\overline{y_0}+\overline{y_1}=1^n, then D\mathcal{D} outputs 11 otherwise 00.

def O_g(x):
    pass
 
def D():
    # bit_stream(0,n) is a n-bit string of 0s
    y0=O_g(bit_stream(0,n))
    y1=O_g(bit_stream(1,n))
    if y0+y1==bit_stream(1,n):
        return 1
    else:
        return 0

If g=fsg=f_s, then DD returns s+s+1n=1n\overline{s}+\overline{s}+1^n =1^n.

P[fsDfs(1n)=1]=1P[f_s\gets D^{f_s}(1^n)=1]=1 P[FRFn,DF(1n)=1]=12nP[F\gets RF^n,D^F(1^n)=1]=\frac{1}{2^n}

Theorem PRG exists then PRF family exists.

Proof:

Let g:{0,1}n{0,1}2ng:\{0,1\}^n\to \{0,1\}^{2n} be a PRG.

g(x)=[g0(x)][g1(x)]g(\overline{x})=[g_0(\overline{x})] [g_1(\overline{x})]

Then we choose a random s{0,1}ns\in \{0,1\}^n (initial seed) and define x{0,1}n\overline{x}\gets \{0,1\}^n, x=x1xn\overline{x}=x_1\cdots x_n.

fs(x)=fs(x1xn)=gxn((gx2(gx1(s))))f_s(\overline{x})=f_s(x_1\cdots x_n)=g_{x_n}(\dots (g_{x_2}(g_{x_1}(s))))
s=random.randbits(n)
 
#????
 
def g(x):
    if x[0]==0:
        return g(f_s(x[1:]))
    else:
        return g(f_s(x[1:]))
 
def f_s(x):
    return g(x)
 

Suppose g:{0,1}3{0,1}6g:\{0,1\}^3\to \{0,1\}^6 is a PRG.

xxfs(x)f_s(x)
000110011
001010010
010001001
011000110
100100000
101110110
110000111
111001110

Suppose the initial seed is 011011, then the constructed function tree goes as follows:

Example:

fs(110)=g0(g1(g1(s)))=g0(g1(110))=g0(111)=001\begin{aligned} f_s(110)&=g_0(g_1(g_1(s)))\\ &=g_0(g_1(110))\\ &=g_0(111)\\ &=001 \end{aligned} fs(010)=g0(g1(g0(s)))=g0(g1(000))=g0(001)=010\begin{aligned} f_s(010)&=g_0(g_1(g_0(s)))\\ &=g_0(g_1(000))\\ &=g_0(001)\\ &=010 \end{aligned}

Assume that DD distinguishes fsf_s and FRFnF\gets RF_n with non-negligible probability.

By hybrid argument, there exists a hybrid HiH_i such that DD distinguishes HiH_i and Hi+1H_{i+1} with non-negligible probability.

For H0H_0,

EOP