Pseudo-random Generators

Let us think of an experiment with an efficient distinguisher that plays the following two games:

  1. A game where challenger gives the distinguisher a uniformly random chosen value; the distinguisher wins if it can find that this value was actually uniformly randomly generated:
sequenceDiagram
	actor D
  actor chal

  Note over chal: pick uniformly random y_unif

  chal ->> D: y_unif

  Note over D: compute b' #8712; {0, 1}

  Note over D,chal: "D" wins if b' = 1

  1. A game where challenger gives the distinguisher a pseudo-randomly generated value, with a uniformly random chosen seed; the distinguisher wins if it can find that this value was actually pseudo-randomly generated:
sequenceDiagram
	actor D
  actor chal

  Note over chal: pick uniformly random s
  Note over chal: y_psd = G(s)

  chal ->> D: y_psd

  Note over D: compute b' #8712; {0, 1}

  Note over D,chal: "D" wins if b' = 0

With these two games, we would like to see:

Notice that this is the statement we made in semantic security. Also notice that the seed of pseudo-random generator ( in ) is assumed to be uniformly random. If the seed is known, you can easily guess which number will be generated.

A more formal definition

Let be a polynomial and let be a deterministic polynomial-time algorithm such that for any and any input , the result of is a string of length . We say that is a pseudo-random generator (PRG) if the followings hold:

  1. Expansion: For every it holds that . This is called the expansion factor of .
  2. Pseudorandomness: For every efficient (i.e. probabilistic polynomial time) distinguisher there is a negligible function such that:

where is chosen uniformly random from and is chosen uniformly random from .

PRG-Based Encryption: One-time Pad Example

Consider a scheme and a PRG , .

Theorem: is a secure PRG is a secure encryption scheme against a 1-message eavesdropper.

Proof: If efficient who breaks , then we construct efficient who breaks ; as in, would be able to distinguish wheter a given value is pseudo-random or uniformly random with non-negligible advantage.

sequenceDiagram
	actor chal
  actor B
  actor A

  alt uniform ("R")
  rect rgb(220, 220, 240)
  Note over chal: r #8712; {0, 1}^n'
  end
  else pseudo-random ("PR")
  rect rgb(240, 220, 220)
  Note over chal: s #8712; {0, 1}^n
  Note over chal: r = G(s)
  end
  end

  chal ->> B: 1^n, r

  B ->> A: 1^n

  Note over B: b #8712; {0, 1}

  A ->> B: m_0, m_1

  Note over B: c = r #8853; m_b

  B ->> A: c

  A ->> B: b'

  alt b = b'
  rect rgb(220, 220, 240)
  Note over B: output "R"
  end
  else b #8800; b'
  rect rgb(240, 220, 220)
  Note over B: output "PR"
  end
  end

Looking at 's game:

where is either negligible or non-negligible, we do not know yet :)

Looking at 's game:

Since if and only if :

  • is equal to . We know this from One-time Pad.
  • is equal to probability, and for player would need to lose. So what is the probability .

Our expression for 's game is then:

At this point, we were able to connect formally that the probability wins it's game is equal to the probability wins it's game. If were to have a non-negligible advantage in guessing , then would have a non-negligible difference between the result of its games. However, we had assumed that is a pseudo-random generator so should not have a non-negligible difference!

Therefore, must have a negligible difference ( is negligible) and thus has negligible advantage. is indeed a secure scheme (against a 1-message eavesdropper, which is a very puny weak defense but hey its something). Q.E.D.

Pseudo-random Functions

Denote the set of all function that map as . Note that this a HUGE set, with the size .

Now, let be an efficiently computable function. Define . Here, we refer to as key. Assume that is length preserving : is only defined if , in which case . Notice that choosing is then equivalent to choosing the function . In other words, defines a distribution over functions in .

We define that is a pseudo-random function if for a uniform key is indistinguishable from a uniform function . More formally, for all distinguishers :

where for some .

It is easy to think of an interactive proof where the distinguisher keeps querying to get in one scenario, and in the other; if it can't distinguish the difference after polynomially many such queries, our dear is a pseudo-random function! Also note that given a PRF , we can immediately obtain a PRG . For example:

where is concatenation.

Pseudo-random Permutations

Let be a length-preserving keyed function. Then, is a keyed-permutation if:

  • is a bijection for every , meaning that is invertible.
  • is efficiently computable, where .

Essentially, a PRF with and bijection is a PRP.