Documentation

CslibFrontier.Crypto.Computational.SIS.Ajtai

Ajtai's hash function and collision finding #

Ajtai's function ajtaiHash A x = A x mod q on integer vectors is linear, so two distinct inputs with the same hash differ by a nonzero kernel vector of A. When both inputs lie in [0, β]^m the difference is a short integer solution with bound β (IsAjtaiCollision.isSolution_sub); when both lie in [-β, β]^m it is one with bound 2 * β (isSolution_sub_of_abs_le). No primality assumption on q is needed.

ajtaiCollisionExperiment q β F draws a uniform A ∈ ℤ_q^{n×m}, and the typed finder F wins when it returns a collision in [0, β]^m. The SIS solver collisionToSIS F returns the difference of F's pair, and ajtaiAdvantage_le_sisAdvantage bounds the collision-finding advantage by its SIS advantage for every modulus, dimension, bound and finder.

Ajtai's hash family of [GGH96], Section 3, hashes a string s ∈ {0,1}^m, here a word of length m, to A s mod q under a uniform key A (ajtaiSetup, ajtaiWordHash). Their Theorem 2, that the family is collision resistant when SIS is hard, is SIS.collisionResistantForOn_ajtaiWordHash. For a SIS parameter family P with bound at least 1 and with P.m computable in polynomial time, SIS P gives CollisionResistantForOn for the family against uniform strict PPT finders. The reduction ajtaiWordCollisionToSIS is collisionToSIS applied to the finder's words read as 0/1 vectors, and isPPT_ajtaiWordCollisionToSIS proves it efficient from the finder's certificate. SIS is assumed; its worst-case hardness ([Ajt96], Theorem 1) is not formalized.

Main definitions #

Main results #

References #

def Cslib.Crypto.ajtaiHash {n m q : ℕ} (A : Matrix (Fin n) (Fin m) (ZMod q)) (x : Fin m → ℤ) :
Fin n → ZMod q

Ajtai's linear hash function x ↦ A x mod q on integer vectors. Its kernel is the lattice Λ(ν, q) of [Ajt96] ("The definition of the random class", p. 4), where ν lists the columns of A.

theorem Cslib.Crypto.ajtaiHash_sub {n m q : ℕ} (A : Matrix (Fin n) (Fin m) (ZMod q)) (x y : Fin m → ℤ) :
ajtaiHash A (x - y) = ajtaiHash A x - ajtaiHash A y

Ajtai's hash function is additive.

theorem Cslib.Crypto.isSolution_sub_of_abs_le {n m q : ℕ} {A : Matrix (Fin n) (Fin m) (ZMod q)} {β : ℕ} {x y : Fin m → ℤ} (hxy : x ≠ y) (hx : ∀ (i : Fin m), |x i| ≤ ↑β) (hy : ∀ (i : Fin m), |y i| ≤ ↑β) (h : ajtaiHash A x = ajtaiHash A y) :
SIS.IsSolution A (2 * β) (x - y)

Distinct inputs in [-β, β]^m with the same Ajtai hash differ by a short integer solution with bound 2 * β.

def Cslib.Crypto.IsAjtaiCollision {n m q : ℕ} (A : Matrix (Fin n) (Fin m) (ZMod q)) (β : ℕ) (x y : Fin m → ℤ) :

(x, y) is a collision of Ajtai's hash function for A in [0, β]^m: distinct inputs in [0, β]^m with the same hash.

Instances For
    @[instance_reducible]
    instance Cslib.Crypto.instDecidableIsAjtaiCollision {n m q : ℕ} (A : Matrix (Fin n) (Fin m) (ZMod q)) (β : ℕ) (x y : Fin m → ℤ) :
    theorem Cslib.Crypto.IsAjtaiCollision.isSolution_sub {n m q : ℕ} {A : Matrix (Fin n) (Fin m) (ZMod q)} {β : ℕ} {x y : Fin m → ℤ} (h : IsAjtaiCollision A β x y) :
    SIS.IsSolution A β (x - y)

    A collision in [0, β]^m differs by a short integer solution with bound β.

    def Cslib.Crypto.collisionToSIS {n m q : ℕ} (F : Matrix (Fin n) (Fin m) (ZMod q) → ProbComp ((Fin m → ℤ) × (Fin m → ℤ))) (A : Matrix (Fin n) (Fin m) (ZMod q)) :
    ProbComp (Fin m → ℤ)

    The SIS solver built from a collision finder: run the finder and return the difference of its pair.

    noncomputable def Cslib.Crypto.ajtaiCollisionExperiment {n m : ℕ} (q : ℕ) [NeZero q] (β : ℕ) (F : Matrix (Fin n) (Fin m) (ZMod q) → ProbComp ((Fin m → ℤ) × (Fin m → ℤ))) :

    The Ajtai collision-finding experiment for modulus q, dimensions n × m and box [0, β]^m: the challenger draws a uniform A ∈ ℤ_q^{n×m}; the finder wins when it returns a collision of ajtaiHash A in the box.

    noncomputable def Cslib.Crypto.ajtaiAdvantage {n m : ℕ} (q : ℕ) [NeZero q] (β : ℕ) (F : Matrix (Fin n) (Fin m) (ZMod q) → ProbComp ((Fin m → ℤ) × (Fin m → ℤ))) :

    The collision-finding advantage of F: its success probability in ajtaiCollisionExperiment.

    theorem Cslib.Crypto.ajtaiAdvantage_le_sisAdvantage {n m : ℕ} (q : ℕ) [NeZero q] (β : ℕ) (F : Matrix (Fin n) (Fin m) (ZMod q) → ProbComp ((Fin m → ℤ) × (Fin m → ℤ))) :

    Every typed collision finder's advantage is at most the SIS advantage of collisionToSIS, for every nonzero modulus, dimension and bound. This is the concrete step of [GGH96], Theorem 2, for inputs in [0, β]^m instead of {0,1}^m: the difference of a collision in [0, β]^m is a SIS solution with bound β.

    Ajtai's hash family on words #

    def Cslib.Crypto.binaryVec (m : ℕ) (s : List Bool) :
    Fin m → ℤ

    The word s read as a 0/1 integer vector of length m: coordinate i is bit i of BitString.ofList m s, which pads short words with false and ignores bits beyond m.

    theorem Cslib.Crypto.binaryVec_injOn {m : ℕ} {s₁ s₂ : List Bool} (h₁ : s₁.length = m) (h₂ : s₂.length = m) (h : binaryVec m s₁ = binaryVec m s₂) :
    s₁ = s₂

    Words of length m are determined by their 0/1 vectors.

    noncomputable def Cslib.Crypto.ajtaiSetup (P : SISParams) (κ : ℕ) :

    The key law of Ajtai's hash family at security parameter κ: a uniform matrix A ∈ ℤ_q^{n×m}, for the dimensions and modulus that P assigns to κ, returned as the SIS input ⟨κ, A⟩ ([GGH96], Section 3, p. 4).

    def Cslib.Crypto.ajtaiWordHash (P : SISParams) (d : P.Input) (s : List Bool) :
    Fin (P.n d.secParam) → ZMod (P.q d.secParam)

    Ajtai's hash family on words ([GGH96], Section 3, p. 4). The key d is a SIS input ⟨κ, A⟩, and the word s hashes to A s mod q, where s is read as a 0/1 vector of length m = P.m κ (binaryVec). On the words of length m, the source's message space {0,1}^m, this is the source's h_A(s) = A s mod q.

    The SIS solver built from a collision finder for ajtaiWordHash. It gives the finder κ and the key ⟨κ, A⟩, reads both returned words as 0/1 vectors, and returns their difference (collisionToSIS). This is the reduction in the proof of [GGH96], Theorem 2 (p. 5).

    At one security parameter κ with P.β κ ≥ 1, a collision finder's success probability against ajtaiWordHash on the words of length P.m κ is at most the SIS advantage of ajtaiWordCollisionToSIS. This is the concrete step of [GGH96], Theorem 2; it goes through the typed bound ajtaiAdvantage_le_sisAdvantage.

    Ajtai's hash family is collision resistant under SIS ([GGH96], Theorem 2, p. 4). Let P be a SIS parameter family whose column count P.m is computable in polynomial time and whose bound P.β is at least 1. If SIS P holds, then no uniform strict PPT finder that is given κ and the key ⟨κ, A⟩, for a uniform A ∈ ℤ_q^{n×m}, finds two distinct words of length m with the same hash A s mod q, except with negligible probability. This is collision resistance in the standard model, CollisionResistantForOn ([BS23], Definition 8.2 and Attack Game 8.1), with digests typed in ℤ_q^n.

    The proof applies SIS P to ajtaiWordCollisionToSIS, which returns the difference s₁ - s₂ ∈ {-1, 0, 1}^m of the colliding words as in the source's proof, through its certificate isPPT_ajtaiWordCollisionToSIS.

    This statement differs from the source in these ways.

    • The source takes n as the security parameter and requires n log q < m ≤ q / (2 n⁴) and q = O(n^c) (Section 2.2, p. 3). Here the security parameter is κ, and P is any family with P.m computable in polynomial time and P.β ≥ 1. The reduction uses no relation between the parameters. The source needs them for its Theorem 1, which reduces worst-case lattice problems to Problem (A2), and for compression (Section 3.1, p. 5); this theorem claims neither.
    • The assumption is SIS P, with ℓ_∞ bound P.β κ. At P.β = 1 it is the source's Problem (A2) (Section 2.3, p. 4), whose solutions are the nonzero x ∈ {-1, 0, 1}^m with Mx ≡ 0 (mod q). A larger bound makes the assumption stronger. With bound 0, SIS P holds vacuously, which is why P.β ≥ 1 is required.
    • Theorem 2 is stated for (expected) running time T(n, m, q). Here finders and SIS solvers are uniform strict PPT, and the conclusion is negligible success.
    • The key law ajtaiSetup P is a distribution. Its efficient sampling and the cost of evaluating the hash, which Definition 8.2 also asks for, are not certified here.
    • P.m must be computable in polynomial time so that the reduction can write an answer of length m when the finder's words have the wrong length.