Pseudorandomness

Pseudorandomness is the property that an efficiently computable deterministic construction is indistinguishable from an ideal random object to every efficient adversary.

Purely deterministic computer programs cannot produce true randomness. They require entropy from physical events. Pseudorandom constructions expand a short true-random seed into values that look random to efficient adversaries.

PRFs and PRPs use a short secret key to select a deterministic efficient function. Both are secure when no efficient distinguisher can distinguish the keyed function from its ideal random object.

Distinguisher

A distinguisher DD is an algorithm that receives a value or oracle and outputs 1 bit to guess which of 2 distributions produced it.

A probabilistic polynomial-time (PPT) distinguisher uses random bits and runs in time polynomial in the security parameter nn.

Computational Indistinguishability

Distributions X={Xn}X = \{X_n\} and Y={Yn}Y = \{Y_n\} are computationally indistinguishable iff every PPT distinguisher DD has negligible advantage:

∣Pr⁡[D(Xn)=1]−Pr⁡[D(Yn)=1]∣\Big\lvert \Pr[D(X_n) = 1] - \Pr[D(Y_n) = 1] \Big\rvert
Here:
XnX_n
first distribution at security parameter nn
YnY_n
second distribution at security parameter nn
DD
PPT distinguisher
Pr⁡[D(Xn)=1]\Pr[D(X_n) = 1]

probability that DD outputs 11 for a sample from XnX_n

Pr⁡[D(Yn)=1]\Pr[D(Y_n) = 1]

probability that DD outputs 11 for a sample from YnY_n

nn
security parameter

Both probabilities include the random sample and the random choices made by DD. As nn increases, no efficient distinguisher gains a useful way to tell the 2 distributions apart.

Pseudorandom Generators

Also known as PRG. A function that stretches a short seed into a longer pseudorandom string. The output G(k)G(k) is computationally indistinguishable from a uniformly random m(n)m(n)-bit string when kk is chosen uniformly.

G:{0,1}n→{0,1}m(n)where m(n)>nG : \{0,1\}^n \to \{0,1\}^{m(n)}\quad \text{where } m(n) > n

Pseudorandom Functions

Also known as PRF. A PRF family is a set of efficiently computable functions {fk:{0,1}n→{0,1}n}k∈{0,1}n\{f_k : \{0,1\}^n \to \{0,1\}^n\}_{k \in \{0,1\}^n}, indexed by a key kk, that no efficient adversary can distinguish from a function chosen uniformly at random from all functions on {0,1}n\{0,1\}^n.

Key Space

The definition uses an nn-bit key, so the family has 2n2^n candidate keys. This is the number of selectable keyed functions before accounting for any distinct keys that happen to define the same function. It is much smaller than the 2n⋅2n2^{n \cdot 2^n} functions from nn bits to nn bits.

Security Game

A distinguisher DD is an efficient attacker program. It receives blackbox access to a hidden function. DD can query the blackbox for any input xx and receive the function’s output for xx.

The challenger secretly gives DD 1 of 2 possible oracles.

  • PRF oracle
    The challenger chooses k←{0,1}nk \leftarrow \{0,1\}^n uniformly and uses fkf_k. Once kk is chosen, fkf_k is deterministic.
  • Random oracle
    The challenger chooses a truly random function R:{0,1}n→{0,1}nR : \{0,1\}^n \to \{0,1\}^n. Every input has an independently chosen random output. Repeated queries for the same input produce the same output.

DD may make queries adaptively. Each new query may depend on earlier answers. The challenger never reveals kk or RR.

After making its queries, DD outputs 1 bit. Output 11 means that DD guesses the PRF oracle. Output 00 means that DD guesses the random oracle.

AdvPRF(D)=∣Pr⁡[Dfk=1]−Pr⁡[DR=1]∣\mathrm{Adv}_{\mathrm{PRF}}(D) = \left| \Pr[D^{f_k} = 1] - \Pr[D^{R} = 1] \right|

The first probability is the chance that DD says PRF when it receives fkf_k. The second is the chance that DD says PRF when it receives RR. The difference is DD‘s distinguishing advantage.

A family is a secure PRF iff AdvPRF(D)\mathrm{Adv}_{\mathrm{PRF}}(D) is negligible for every probabilistic polynomial-time (PPT) DD, over the random choice of kk or RR. fkf_k is pseudorandom because it looks like the truly random function RR to every efficient distinguisher.

  • The number of oracle queries DD may make is polynomial in nn, since DD itself runs in polynomial time.
  • DD never sees kk, only input-output pairs of the oracle it queries.

Construction from a Pseudorandom Generator

Write G0(k)G_0(k) and G1(k)G_1(k) for the first and second nn-bit halves of G(k)G(k).

The Goldreich-Goldwasser-Micali (GGM) construction builds a PRF from GG. To evaluate fk(x)f_k(x) for an nn-bit input x=x1x2⋯xnx = x_1 x_2 \cdots x_n, walk a binary tree of depth nn rooted at kk, taking the left half G0G_0 at each 00 bit of xx and the right half G1G_1 at each 11 bit.

fk(x1x2⋯xn)=Gxn(⋯Gx2(Gx1(k))⋯ )f_k(x_1 x_2 \cdots x_n) = G_{x_n}(\cdots G_{x_2}(G_{x_1}(k)) \cdots)
  • Every leaf of the tree corresponds to a distinct input xx, reached by a distinct sequence of nn PRG calls.
  • A secure PRG makes each level indistinguishable from random, so the composed function is indistinguishable from random overall.

This shows a PRF exists whenever a PRG does, and a PRG exists whenever a one-way function does.

Uses

  • Message authentication
    A MAC over a fixed-length message mm under key kk can be computed directly as fk(m)f_k(m).
  • Counter mode encryption
    CTR mode, in block encryption schemes, uses fkf_k evaluated at a counter as the keystream. Only the PRF property is needed, not the PRP’s invertibility.
  • Key derivation
    A single master key kk produces many independent-looking sub-keys fk(1),fk(2),…f_k(1), f_k(2), \ldots

Pseudorandom Permutations

Also known as PRP. A PRP family restricts each fkf_k to a bijection on {0,1}n\{0,1\}^n. It is indistinguishable from a permutation chosen uniformly at random from all permutations on {0,1}n\{0,1\}^n.

Different inputs of a PRP always have different outputs. A PRF allows repeated outputs. A PRP is bijective, so its inverse exists and is efficiently computable. A PRF need not be bijective. It need not have an inverse.

Block ciphers are designed to be PRP families. eke_k plays the role of fkf_k. dk=fk−1d_k = f_k^{-1} provides the reverse transformation.

Written by November 3, 2026 5 min read
Was this helpful?