Predicting the variable-length polynomial hash #
In [BS23], Exercise 7.29, the adversary queries the empty message. Its Hxpoly
digest is the key, so squaring it gives the digest of the singleton-zero message. The same
argument works over every finite field. For prime fields the two stages have polynomial-time
certificates on binary residues.
Main results #
eval_predictionExperiment_xpolyHash: the explicit adversary wins with probability one.isPPT_xpolyPrediction: the two deterministic stages are polynomial time over prime fields.
theorem Cslib.Crypto.UHF.encPredictionGuess_message_polyTime {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → PredictionGuess M Y} :
Turing.MultiTapeTM.ComputableInPolyTime g✝ encIn✝ (encPredictionGuess encM encY) →
Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ✝) => (g✝ c).message) encIn✝ encM
theorem Cslib.Crypto.UHF.encPredictionGuess_message_length_le {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) (a : PredictionGuess M Y) :
@[simp]
theorem Cslib.Crypto.UHF.encPredictionGuess_apply {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) (a : PredictionGuess M Y) :
theorem Cslib.Crypto.UHF.encPredictionGuess_message_budget {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → PredictionGuess M Y} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encPredictionGuess encM encY) S✝ →
Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).message) encIn✝ encM S✝
theorem Cslib.Crypto.UHF.encPredictionGuess_digest_polyTime {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → PredictionGuess M Y} :
Turing.MultiTapeTM.ComputableInPolyTime g✝ encIn✝ (encPredictionGuess encM encY) →
Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ✝) => (g✝ c).digest) encIn✝ encY
theorem Cslib.Crypto.UHF.encPredictionGuess_message_deg {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) :
Turing.MultiTapeTM.ComputableInDegree PredictionGuess.message (encPredictionGuess encM encY) encM 1 1
theorem Cslib.Crypto.UHF.encPredictionGuess_digest_inO {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) :
Turing.MultiTapeTM.ComputableInO PredictionGuess.digest (encPredictionGuess encM encY) encY
(fun (a : PredictionGuess M Y) => ((encPredictionGuess encM encY) a).length) fun (a : PredictionGuess M Y) =>
((encPredictionGuess encM encY) a).length
theorem Cslib.Crypto.UHF.encPredictionGuess_mk_budget {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → M} {x1 : γ → Y} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn encM budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn encY budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { message := x0 x, digest := x1 x }) encIn
(encPredictionGuess encM encY) budget
theorem Cslib.Crypto.UHF.encPredictionGuess_digest_length_le {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) (a : PredictionGuess M Y) :
theorem Cslib.Crypto.UHF.encPredictionGuess_mk_deg {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) :
Turing.MultiTapeTM.ComputableInDegree (fun (p : M × Y) => { message := p.1, digest := p.2 })
(encPredictionGuessFields encM encY) (encPredictionGuess encM encY) 1 1
theorem Cslib.Crypto.UHF.encPredictionGuess_digest_deg {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) :
Turing.MultiTapeTM.ComputableInDegree PredictionGuess.digest (encPredictionGuess encM encY) encY 1 1
theorem Cslib.Crypto.UHF.encPredictionGuess_mk_polyTime {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → M} {x1 : γ → Y} (h0 : Turing.MultiTapeTM.ComputableInPolyTime x0 encIn encM) (h1 : Turing.MultiTapeTM.ComputableInPolyTime x1 encIn encY) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (x : γ) => { message := x0 x, digest := x1 x }) encIn
(encPredictionGuess encM encY)
theorem Cslib.Crypto.UHF.encPredictionGuess_digest_budget {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → PredictionGuess M Y} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encPredictionGuess encM encY) S✝ →
Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).digest) encIn✝ encY S✝
theorem Cslib.Crypto.UHF.encPredictionGuess_mk_inO {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → M} {T0 S0 : γ → ℕ} {x1 : γ → Y} {T1 S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn encM T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn encY T1 S1) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { message := x0 x, digest := x1 x }) encIn
(encPredictionGuess encM encY) (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x
theorem Cslib.Crypto.UHF.encPredictionGuess_fields_deg {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) :
Turing.MultiTapeTM.ComputableInDegree (fun (a : PredictionGuess M Y) => (a.message, a.digest))
(encPredictionGuess encM encY) (encPredictionGuessFields encM encY) 1 1
theorem Cslib.Crypto.UHF.encPredictionGuess_message_inO {M Y : Type} (encM : M ↪ List Bool) (encY : Y ↪ List Bool) :
Turing.MultiTapeTM.ComputableInO PredictionGuess.message (encPredictionGuess encM encY) encM
(fun (a : PredictionGuess M Y) => ((encPredictionGuess encM encY) a).length) fun (a : PredictionGuess M Y) =>
((encPredictionGuess encM encY) a).length
theorem Cslib.Crypto.UHF.eval_predictionExperiment_xpolyHash {F : Type} [Field F] [Fintype F] [DecidableEq F] {ℓ : ℕ} (hℓ : 1 ≤ ℓ) :
(ProbComp.eval
(predictionExperiment (fun (k : F) (m : { m : List F // m.length ≤ ℓ }) => Probability.xpolyHash k ↑m)
(xpolyPrediction hℓ)))
true = 1
Exercise 7.29 ([BS23], v0.6, printed p. 285).
When one-block messages are allowed, the adversary wins Attack Game 7.5 against Hxpoly
with probability one. The same program works over any finite field with a uniform key.
theorem Cslib.Crypto.UHF.isPPT_xpolyPrediction {p ℓ : ℕ} [Fact (Nat.Prime p)] (hℓ : 1 ≤ ℓ) :
TwoStage.IsPPT Turing.MultiTapeTM.encUnit (encXpolyMessage p ℓ) (Turing.MultiTapeTM.encZMod p)
(encPredictionGuess (encXpolyMessage p ℓ) (Turing.MultiTapeTM.encZMod p)) Turing.MultiTapeTM.encUnit fun (x : ℕ) =>
xpolyPrediction hℓ
The winning adversary's actual deterministic choice and guess stages are polynomial time for each prime modulus. The guess stage uses binary multiplication and remainder.