Documentation

CslibFrontier.Crypto.Computational.PseudorandomGenerator.LFSR

No linear feedback shift register is a pseudorandom generator #

A family of linear feedback shift registers is a word function: on a seed of length n it runs the n-bit register with tap mask taps n for ℓ n clock cycles (Cslib.Crypto.PRG.LFSR.output). The tap masks are public: they depend only on the seed length.

Boneh and Shoup, Section 3.8, p. 75 observe that a single LFSR is insecure as a generator, because n consecutive output bits determine all later ones. This file states that for uniform probabilistic polynomial-time distinguishers. The distinguisher runs the generator on the first n bits of a word and accepts when it reproduces bit n. On words of the output length it is the test built from Cslib.Crypto.PRG.LFSR.predictor, which accepts every output word and a uniform word with probability 1 / 2. It is a polynomial-time program whenever the generator is, so the theorem that no LFSR family is a pseudorandom generator has no hypothesis. Every seed is allowed, including the all-zero seed that [BS23] excludes.

Main definitions #

Main results #

References #

def Cslib.Crypto.PRG.LFSR.wordGenerator (taps : ℕ → List Bool) (ℓ : ℕ → ℕ) (seed : List Bool) :

The LFSR family as a word function: on a seed of length n it runs the n-bit register with the public tap mask taps n for ℓ n clock cycles.

@[simp]
theorem Cslib.Crypto.PRG.LFSR.length_wordGenerator (taps : ℕ → List Bool) (ℓ : ℕ → ℕ) (seed : List Bool) :
(wordGenerator taps ℓ seed).length = ℓ seed.length
theorem Cslib.Crypto.PRG.LFSR.wordFamily_wordGenerator (taps : ℕ → List Bool) (ℓ : ℕ → ℕ) (n : ℕ) :
wordFamily (wordGenerator taps ℓ) ℓ n = generator (taps n) n (ℓ n)

The finite family of the word generator is the typed generator at each seed length.

The distinguisher that uses the generator as a black box: run the register on the first n bits of the word and accept exactly when it reproduces bit n.

theorem Cslib.Crypto.PRG.LFSR.eval_rerunDistinguisher_ofFn (taps : ℕ → List Bool) {ℓ : ℕ → ℕ} {n : ℕ} (hℓ : n < ℓ n) (bits : BitString (ℓ n)) :
(rerunDistinguisher taps ℓ n (List.ofFn bits)).eval = predictionTest ⟨n, hℓ⟩ (predictor (taps n) n n) bits

On words of the output length, re-running the register is the test of Attack Game 3.1 built from the predictor for position n.

The tests built from the predictor for position n are realized by one uniform polynomial-time program when the generator runs in polynomial time.

No LFSR family is a pseudorandom generator Boneh and Shoup, Section 3.8, p. 75. No hypothesis on the tap masks is needed: when the generator runs in polynomial time, re-running it on the first n bits of a word is a polynomial-time test, and it is the test built from the predictor, with advantage 1 / 2.

For a polynomial-time LFSR family with output length ℓ n > n, the output on a uniform seed is not computationally indistinguishable from a uniform word.