Universal and $\text{universal}_2$ projective hash functions over prime-order groups #
This module formalizes the universal and $\text{universal}_2$ projective hash families over a
PrimeOrderGroupFamily from
Boneh and Shoup, Sections 12.5.1–12.5.2, printed pp. 484–488, which form the
algebraic core of the Cramer–Shoup public-key encryption scheme (Section 12.5.3 and Exercise 12.27).
Groups are written additively as ZMod (F.order d)-modules (matching DiscreteLog,
DiffieHellman, and ElGamal), so the book's $v^\sigma w^\tau$ is
$\sigma \bullet v + \tau \bullet w$.
Source Statements ([BS23], Sections 12.5.1–12.5.2, printed pp. 485–488) #
Verbatim from [BS23], Section 12.5.1 (printed p. 485):
The function $f := f_{\sigma, \tau}$ is indexed by randomly chosen $\sigma, \tau \in \mathbb{Z}_q$, and is defined as follows: $$f_{\sigma, \tau} : \mathbb{G}^2 \to \mathbb{G}, \quad (v, w) \mapsto v^\sigma w^\tau. \quad (12.13)$$ The auxiliary information $h$ that defines $f$ on $L_u$ is $$h := f(g, u) = g^\sigma u^\tau. \quad (12.14)$$ … Lemma 12.5. Suppose $\sigma$ and $\tau$ are uniformly and independently distributed over $\mathbb{Z}_q$. Then for all $u, v, w, h, z \in \mathbb{G}$, if $(u, v, w)$ is not a DH-triple, then $$\Pr[g^\sigma u^\tau = h \land v^\sigma w^\tau = z] = \frac{1}{q^2}.$$
Verbatim from [BS23], Section 12.5.2 (printed pp. 487–488):
We define a new function $f' := f'_{\sigma_1, \tau_1, \sigma_2, \tau_2}$, indexed by randomly chosen $\sigma_1, \tau_1, \sigma_2, \tau_2 \in \mathbb{Z}_q$, as follows $$f'_{\sigma_1, \tau_1, \sigma_2, \tau_2} : \mathbb{G}^2 \times \mathbb{Z}_q \to \mathbb{G}, \quad (v, w, \rho) \mapsto f_{\sigma_1, \tau_1}(v, w) \cdot f_{\sigma_2, \tau_2}(v, w)^\rho = v^{\sigma_1 + \rho \sigma_2} w^{\tau_1 + \rho \tau_2}. \quad (12.16)$$ The auxiliary information that defines $f'$ on $L_u \times \mathbb{Z}_q$ is $h' := (h_1, h_2)$, where $h_i$ is the auxiliary information that defines $f_{\sigma_i, \tau_i}$ on $L_u$; that is $$h_i := f_{\sigma_i, \tau_i}(g, u) = g^{\sigma_i} u^{\tau_i} \quad \text{for } i = 1, 2. \quad (12.17)$$ … Lemma 12.7. Suppose $\sigma_1, \tau_1, \sigma_2, \tau_2$ are uniformly and independently distributed over $\mathbb{Z}_q$. Then for all $u, v, w, \hat{v}, \hat{w}, h_1, h_2, z, \hat{z} \in \mathbb{G}$ and all $\rho, \hat{\rho} \in \mathbb{Z}_q$, if $(u, v, w)$ and $(u, \hat{v}, \hat{w})$ are not DH-triples, and $\rho \ne \hat{\rho}$, then $$\Pr[g^{\sigma_1} u^{\tau_1} = h_1 \land g^{\sigma_2} u^{\tau_2} = h_2 \land v^{\sigma_1 + \rho_1 \sigma_2} w^{\tau_1 + \rho_1 \tau_2} = z \land \hat{v}^{\sigma_1 + \rho_2 \sigma_2} \hat{w}^{\tau_1 + \rho_2 \tau_2} = \hat{z}] = \frac{1}{q^4}.$$ … Lemma 12.8. In Attack Game 12.5, for any adversary $\mathcal{A}$ that outputs at most $Q$ tuples, the probability that it wins is at most $Q/q$.
Attack Game 12.5 itself is not formalized as a standalone game here; instead, this module proves
the explicit change-of-variables equivalences (projHashFiberChangeEquiv,
projHash2FiberChangeEquiv), the single-tuple 1 / q hit law (uniform_projHash2_fiber_apply),
and the finite-list Q / q union bound (uniform_projHash2_fiber_any_le) on the τ₂-fiber given
δ₁ = σ₁ + α * τ₁, δ₂ = σ₂ + α * τ₂, and ξ = τ₁ + ρ * τ₂ (where (h₁, h₂, z) and all DH
queries depend only on (δ₁, δ₂, ξ)). The adaptive decryption-oracle reduction for Cramer–Shoup
using these ingredients is carried by Complexity/Crypto/Computational/CramerShoup.lean (PR 2).
Main definitions #
Cslib.Crypto.ProjectiveHash.projHash,Cslib.Crypto.ProjectiveHash.projHashAux: universal projective hash evaluation(12.13)and public projection(12.14).Cslib.Crypto.ProjectiveHash.projHashFiberChangeEquiv,Cslib.Crypto.ProjectiveHash.projHashEquiv: fiber change-of-variables(δ, τ) ↦ (δ - α * τ, τ)and 2×2 linear equivalence onZMod q × ZMod qunderlying Lemma 12.5 whenγ ≠ α * β.Cslib.Crypto.ProjectiveHash.projHash2,Cslib.Crypto.ProjectiveHash.projHash2Aux: $\text{universal}_2$ projective hash evaluation(12.16)and public projection pair(12.17).Cslib.Crypto.ProjectiveHash.projHash2FiberChangeEquiv,Cslib.Crypto.ProjectiveHash.projHash2Equiv: 4-tuple fiber change-of-variables((δ₁, δ₂), (ξ, τ₂)) ↦ ((δ₁ - α * (ξ - ρ * τ₂), ξ - ρ * τ₂), (δ₂ - α * τ₂, τ₂))and 4×4 linear equivalence on(ZMod q × ZMod q) × (ZMod q × ZMod q)underlying Lemma 12.7 whenγ ≠ α * β,γ' ≠ α * β', andρ' ≠ ρ.
Main results #
Cslib.Crypto.ProjectiveHash.projHash_smul_generator,Cslib.Crypto.ProjectiveHash.projHash2_smul_generator: projective evaluation on Diffie–Hellman triples(β • g, β • u) ∈ L_uvia the public projectionshand(h₁, h₂).Cslib.Crypto.ProjectiveHash.projHash_bijective_of_ne,Cslib.Crypto.ProjectiveHash.uniform_projHash_apply_of_ne,Cslib.Crypto.ProjectiveHash.uniform_projHash_fiber,Cslib.Crypto.ProjectiveHash.uniform_projHash_fiber_add: Lemma 12.5 bijection and1 / q ^ 2joint point mass, together with conditional uniform masking on non-DH triples as a consequence of Lemma 12.5 underprojHashFiberChangeEquiv.Cslib.Crypto.ProjectiveHash.projHash2_fiber_eq,Cslib.Crypto.ProjectiveHash.projHash2_bijective_of_ne,Cslib.Crypto.ProjectiveHash.uniform_projHash2_apply_of_ne,Cslib.Crypto.ProjectiveHash.projHash2_fiber_bijective_of_ne,Cslib.Crypto.ProjectiveHash.uniform_projHash2_fiber_apply,Cslib.Crypto.ProjectiveHash.uniform_projHash2_fiber_any_le: Lemma 12.7 4-tuple bijection and1 / q ^ 4joint point mass, and the single-tuple1 / qandQ-tupleQ / qunion-bound ingredients of Lemma 12.8 (via Lemma 12.7) on theτ₂-fiber ofprojHash2FiberChangeEquivfor non-DH triples withρ' ≠ ρ.
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, Sections 12.5.1–12.5.2 (printed pp. 484–488).
Universal projective hash evaluation f_{σ,τ}(v, w) = σ • v + τ • w
([BS23], Section 12.5.1, equation (12.13), printed p. 485).
Instances For
Auxiliary public projection h = f_{σ,τ}(g, u) = σ • g + τ • u
([BS23], Section 12.5.1, equation (12.14), printed p. 485).
Instances For
Projective property of projHash on $L_u$ ([BS23], Section 12.5.1, printed
p. 485): on any Diffie–Hellman pair (v, w) = (β • g, β • u), f_{σ,τ}(v, w) = β • h.
Explicit generator-exponent form of projHashAux on u = α • g.
Explicit generator-exponent form of projHash on (v, w) = (β • g, γ • g).
On the fiber σ = δ - α * τ where projHashAux F d σ τ (α • g) = δ • g, evaluating projHash
on (β • g, γ • g) gives (β * δ + (γ - α * β) * τ) • g.
On the fiber σ = δ - α * τ, the auxiliary projection projHashAux is independent of τ and
equals δ • g.
The fiber change-of-variables (δ, τ) ↦ (δ - α * τ, τ) on ZMod (F.order d) × ZMod (F.order d)
under which projHashAux F d σ τ (α • g) = δ • g depends only on δ.
Instances For
Explicit 2×2 linear equivalence (σ, τ) ↦ (σ + α * τ, β * p.1 + γ * p.2) on
ZMod (F.order d) × ZMod (F.order d) when γ ≠ α * β ([BS23], proof of Lemma 12.5,
printed pp. 485–486).
Instances For
Lemma 12.5 bijection ([BS23], Section 12.5.1, printed p. 485): when γ ≠ α * β,
the map (σ, τ) ↦ (projHashAux F d σ τ (α • g), projHash F d σ τ (β • g) (γ • g)) is a bijection
from ZMod (F.order d) × ZMod (F.order d) to F.Carrier d × F.Carrier d.
Lemma 12.5 (1 / q ^ 2 joint point mass) ([BS23], Section 12.5.1,
printed p. 485): under uniform (σ, τ) : ZMod (F.order d) × ZMod (F.order d), for any non-DH
triple γ ≠ α * β and any h, z : F.Carrier d, the joint pair
(projHashAux F d σ τ (α • g), projHash F d σ τ (β • g) (γ • g)) equals (h, z) with
probability ((F.order d : ℝ≥0∞) ^ 2)⁻¹.
Consequence of Lemma 12.5 (conditional uniformity on the τ-fiber)
([BS23], Section 12.5.1, printed p. 485): under the change of variables
projHashFiberChangeEquiv (σ = δ - α * τ, so h = δ • g), for any fixed δ and uniform
τ : ZMod (F.order d), projHash F d (δ - α * τ) τ (β • g) (γ • g) has the same distribution as
ζ • g for a uniform ζ : ZMod (F.order d) whenever γ ≠ α * β.
One-time group mask via projHash on a non-DH triple: fixing δ = σ + α * τ, for any
message m : F.Carrier d and any non-DH triple γ ≠ α * β, masking m by
projHash F d (δ - α * τ) τ (β • g) (γ • g) + m under uniform τ has the same distribution as
ζ • g for uniform ζ : ZMod (F.order d) (and is therefore independent of m).
$\text{Universal}_2$ projective hash evaluation
f'_{σ₁,τ₁,σ₂,τ₂}(v, w, ρ) = (σ₁ + ρ * σ₂) • v + (τ₁ + ρ * τ₂) • w
([BS23], Section 12.5.2, equation (12.16), printed p. 487).
Instances For
Auxiliary public projection pair (h₁, h₂) = (σ₁ • g + τ₁ • u, σ₂ • g + τ₂ • u)
([BS23], Section 12.5.2, equation (12.17), printed p. 487).
Instances For
projHash2 decomposes as f_{σ₁,τ₁}(v, w) + ρ • f_{σ₂,τ₂}(v, w) ([BS23],
equation (12.16), printed p. 487).
Projective property of projHash2 on $L_u$ ([BS23], Section 12.5.2, printed
p. 487): on any Diffie–Hellman pair (v, w) = (β • g, β • u),
f'(v, w, ρ) = β • (h₁ + ρ • h₂).
Explicit generator-exponent form of projHash2 on (v, w) = (β • g, γ • g).
On the fiber σ₁ = δ₁ - α * τ₁ and σ₂ = δ₂ - α * τ₂ (where (h₁, h₂) = (δ₁ • g, δ₂ • g)),
evaluating projHash2 on (β • g, γ • g, ρ) gives
(β * (δ₁ + ρ * δ₂) + (γ - α * β) * (τ₁ + ρ * τ₂)) • g.
On a Diffie–Hellman triple γ = α * β, projHash2 on the fiber σ₁ = δ₁ - α * τ₁,
σ₂ = δ₂ - α * τ₂ equals (β * (δ₁ + ρ * δ₂)) • g, independent of (τ₁, τ₂).
On the fiber σ₁ = δ₁ - α * τ₁ and σ₂ = δ₂ - α * τ₂, projHash2Aux is (δ₁ • g, δ₂ • g).
The 4-tuple fiber change-of-variables
((δ₁, δ₂), (ξ, τ₂)) ↦ ((δ₁ - α * (ξ - ρ * τ₂), ξ - ρ * τ₂), (δ₂ - α * τ₂, τ₂))
on (ZMod (F.order d) × ZMod (F.order d)) × (ZMod (F.order d) × ZMod (F.order d)), under which
(h₁, h₂), the challenge tag on (β • g, γ • g, ρ), and all Diffie–Hellman queries depend only
on (δ₁, δ₂, ξ) and are independent of τ₂.
Instances For
Further conditioning on ξ = τ₁ + ρ * τ₂ (so τ₁ = ξ - ρ * τ₂) makes the challenge tag on
(β • g, γ • g, ρ) equal to (β * (δ₁ + ρ * δ₂) + (γ - α * β) * ξ) • g, independent of τ₂.
Further conditioning on ξ = τ₁ + ρ * τ₂ (so τ₁ = ξ - ρ * τ₂), a query on
(β' • g, γ' • g, ρ') evaluates to
(β' * (δ₁ + ρ' * δ₂) + (γ' - α * β') * ξ + (γ' - α * β') * (ρ' - ρ) * τ₂) • g.
The affine bijection
τ₂ ↦ (β' * (δ₁ + ρ' * δ₂) + (γ' - α * β') * ξ) + ((γ' - α * β') * (ρ' - ρ)) * τ₂
on ZMod (F.order d) when γ' ≠ α * β' and ρ' ≠ ρ.
Instances For
Single-tuple ingredient of Lemma 12.8 via Lemma 12.7 (bijection on the τ₂-fiber)
([BS23], Section 12.5.2, printed pp. 487–488): under the change of variables
projHash2FiberChangeEquiv, for any γ' ≠ α * β' and ρ' ≠ ρ, the map
τ₂ ↦ projHash2 F d (δ₁ - α * (ξ - ρ * τ₂)) (ξ - ρ * τ₂) (δ₂ - α * τ₂) τ₂ ρ' (β' • g) (γ' • g)
is a bijection from ZMod (F.order d) to F.Carrier d.
Single-tuple ingredient of Lemma 12.8 via Lemma 12.7 (1 / q hit law on the τ₂-fiber)
([BS23], Section 12.5.2, printed pp. 487–488): under projHash2FiberChangeEquiv, fixing
δ₁ = σ₁ + α * τ₁, δ₂ = σ₂ + α * τ₂, and ξ = τ₁ + ρ * τ₂ (which completely determine
(h₁, h₂), the challenge tag z, and all DH queries), as τ₂ varies uniformly over
ZMod (F.order d), the tag on any non-DH query (β' • g, γ' • g, ρ') hits any target
z' : F.Carrier d with probability (F.order d : ℝ≥0∞)⁻¹ whenever γ' ≠ α * β' and ρ' ≠ ρ.
Finite-list Q / q union-bound ingredient of Lemma 12.8 on the τ₂-fiber
([BS23], Section 12.5.2, printed p. 488): for any list queries of candidate tuples
(β', γ', ρ', z') all satisfying γ' ≠ α * β' and ρ' ≠ ρ, and any fixed δ₁, δ₂, ξ : ZMod q,
the probability over uniform τ₂ : ZMod (F.order d) that at least one tuple in queries has tag
z' is at most (queries.length : ℝ≥0∞) / (F.order d : ℝ≥0∞).
Explicit 4-tuple linear equivalence
(σ₁, τ₁, σ₂, τ₂) ↦ ((σ₁ + α * τ₁, σ₂ + α * τ₂), (z, z'))
on (ZMod (F.order d) × ZMod (F.order d)) × (ZMod (F.order d) × ZMod (F.order d)) when
γ ≠ α * β, γ' ≠ α * β', and ρ' ≠ ρ ([BS23], proof of Lemma 12.7, printed p. 487).
Instances For
Lemma 12.7 (universal₂ projective hash 4-tuple bijection)
([BS23], Section 12.5.2, printed pp. 487–488): for any non-DH triples γ ≠ α * β and
γ' ≠ α * β' and any distinct tags ρ' ≠ ρ, the evaluation map
((σ₁, τ₁), (σ₂, τ₂)) ↦ ((h₁, h₂), (f'(v, w, ρ), f'(v', w', ρ'))) is a bijection from
(ZMod (F.order d) × ZMod (F.order d)) × (ZMod (F.order d) × ZMod (F.order d)) to
(F.Carrier d × F.Carrier d) × (F.Carrier d × F.Carrier d).
Lemma 12.7 (1 / q ^ 4 joint 4-tuple point mass) ([BS23], Section 12.5.2,
printed pp. 487–488): under uniform ((σ₁, τ₁), (σ₂, τ₂)), for any non-DH triples γ ≠ α * β and
γ' ≠ α * β', any distinct tags ρ' ≠ ρ, and any h₁, h₂, z, z' : F.Carrier d, the 4-tuple
((h₁, h₂), (z, z')) has probability ((F.order d : ℝ≥0∞) ^ 4)⁻¹.