Discrete-logarithm collision-resistant hash families #
Over a PrimeOrderGroupFamily, this module formalizes the encoded collision-resistance endpoint of
Katz and Lindell's discrete-logarithm hash ([KL20], Section 9.4.2, Construction 9.78 and
Theorem 9.79, pp. 357–359; [BS23], Section 8.5.1). The family samples a group description
d ← setup n and a uniform group element h = α • g (groupHashSetup), and hashes a
2 * blockLen d-bit input x by splitting x into two blockLen d-bit halves (x₁, x₂) (read
as natural numbers in little-endian binary via ofBits) and evaluating
encode (x₁ • g + x₂ • h) (groupHash).
When 2 ^ blockLen d ≤ F.order d, the two blockLen d-bit halves represent elements strictly
below the prime order q = F.order d. Any collision x ≠ y of length 2 * blockLen d with
groupHash blockLen (d, encode d (α • g)) x = groupHash blockLen (d, encode d (α • g)) y satisfies
x₁ + x₂ * α = y₁ + y₂ * α in ZMod q with (y₂ : ZMod q) ≠ x₂, so extractNat
recovers the discrete logarithm α = (y₂ - x₂)⁻¹ * (x₁ - y₁) in deterministic polynomial time.
This yields an exact zero-loss reduction
(succProbability_collisionGameFor_groupHash_le_discreteLogGame) showing that F.DiscreteLog setup
implies CollisionResistantForOn for groupHash (DiscreteLog.collisionResistantForOn_groupHash).
This is the collision-resistance reduction of Theorem 9.79 for the encoded outputs. It does not establish the packaging conditions discussed with Construction 9.78 ([KL20], pp. 357–358), which remain separate obligations for a client that needs a fixed-length compression function:
- Fixed digest width.
PrimeOrderGroupFamily.encodemay produce variable-length or padded encodings, so no fixed output length is asserted; the source pads outputs to a fixed length. - Compression.
2 ^ blockLen d ≤ F.order dbounds only the input scalars. The source notes that the construction compresses only when group elements are represented in fewer bits than the input; no such representation-length bound is assumed here. - Efficient setup.
setupis an arbitrary distribution with no efficient-generation certificate, whereas the source's key generation runs a polynomial-time group generator.
We also formalize the algebraic core of the multi-generator generalization ([KL20],
Exercise 9.28, Construction 9.81, p. 363), multiGeneratorHash d hs xs = ∑ i, xs i • hs i, with
its linear homomorphisms and coordinate-wise discrete-logarithm extraction identity
(multiGeneratorHash_extract_of_eq).
Main definitions #
Cslib.Crypto.PrimeOrderGroupFamily.groupHashSetup: public parameter distribution drawingd ← setup nandα ← ZMod (F.order d)and returning(d, F.encode d (α • F.generator d)).Cslib.Crypto.PrimeOrderGroupFamily.validGroupHashInput: domain predicate testing whether an input word has length2 * blockLen pk.1.Cslib.Crypto.PrimeOrderGroupFamily.groupHash: discrete-logarithm hash on2 * blockLen pk.1-bit inputs, splittingxatblockLen pk.1and evaluatingF.encodePedersenCommit(encoded output; no fixed output width or compression is asserted).Cslib.Crypto.PrimeOrderGroupFamily.groupHashToDLAdversary: discrete-logarithm reduction from agroupHashcollision finder viaextractNat.Cslib.Crypto.PrimeOrderGroupFamily.multiGeneratorHash: multi-generator vector hash∑ i, xs i • hs i(algebraic core of [KL20], Construction 9.81).
Main results #
Cslib.Crypto.PrimeOrderGroupFamily.groupHash_encode,Cslib.Crypto.PrimeOrderGroupFamily.groupHash_append_of_length_eq: algebraic characterization ofgroupHashviapedersenCommit.Cslib.Crypto.PrimeOrderGroupFamily.computableInPolyTime_validGroupHashInput,Cslib.Crypto.PrimeOrderGroupFamily.computableInPolyTime_groupHash: polynomial-time evaluation of the domain test and hash function whenblockLenis polynomial-time in unary.Cslib.Crypto.PrimeOrderGroupFamily.extractNat_eq_of_isCollisionFor_groupHash: any validgroupHashcollision underh = α • gwhen2 ^ blockLen d ≤ F.order drecoversα.Cslib.Crypto.PrimeOrderGroupFamily.isPPTOn_groupHashToDLAdversary,Cslib.Crypto.PrimeOrderGroupFamily.DiscreteLog.collisionResistantForOn_groupHash, andCslib.Crypto.PrimeOrderGroupFamily.succProbability_collisionGameFor_groupHash_le_discreteLogGame— exact zero-loss reduction and encoded collision resistance under the discrete-logarithm assumption (the reduction of [KL20], Theorem 9.79, without the output-padding, compression and efficient-setup conditions above).Cslib.Crypto.PrimeOrderGroupFamily.multiGeneratorHash_add,Cslib.Crypto.PrimeOrderGroupFamily.multiGeneratorHash_smul,Cslib.Crypto.PrimeOrderGroupFamily.multiGeneratorHash_smul_generator_eq_iff,Cslib.Crypto.PrimeOrderGroupFamily.multiGeneratorHash_extract_of_eq: algebraic laws and coordinate discrete-logarithm extraction formultiGeneratorHash(ingredients of the proof of [KL20], Exercise 9.28(a); not proved here).
References #
- J. Katz, Y. Lindell, Introduction to Modern Cryptography, 3rd ed., Section 9.4.2 (Construction 9.78 and Theorem 9.79, pp. 357–359) and Exercise 9.28 (Construction 9.81, p. 363).
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, Section 8.5.1.
Discrete-logarithm hash family (Construction 9.78 & Theorem 9.79) #
Setup distribution for the discrete-logarithm hash family ([KL20],
Construction 9.78, p. 358): draw d ← setup n and a uniform exponent
α ← PMF.uniformOfFintype (ZMod (F.order d)), and output the public parameter
(d, F.encode d (α • F.generator d)).
Discrete-logarithm hash function ([KL20], Construction 9.78, p. 358), with the
source's fixed input length 2 * blockLen d and an encoded group element as output: given public
parameter pk = (d, h) and input x : List Bool, split x at w = blockLen d into
(x.take w, x.drop w) and evaluate
F.encodePedersenCommit (d, h, ofBits (x.take w), ofBits (x.drop w)).
On an encoded group element F.encode d h, groupHash computes the encoding of
F.pedersenCommit d h (ofBits (x.take (blockLen d))) (ofBits (x.drop (blockLen d))).
When x₁ has length blockLen d, hashing the concatenation x₁ ++ x₂ under
(d, F.encode d h) evaluates F.encode d (F.pedersenCommit d h (ofBits x₁) (ofBits x₂)).
Testing whether an input satisfies validGroupHashInput blockLen is computable in polynomial
time whenever blockLen is computable in polynomial time in unary.
Evaluating groupHash blockLen is computable in polynomial time whenever blockLen is
computable in polynomial time in unary.
Collision extraction for groupHash (step 2 of the proof of [KL20],
Theorem 9.79, pp. 358–359): if 2 ^ blockLen d ≤ F.order d, any valid collision (x, y) for
groupHash blockLen under (d, F.encode d (α • F.generator d)) recovers α with
extractNat.
Turn a groupHash collision finder into a discrete-logarithm adversary by splitting the two
candidate colliding words at blockLen d and extracting α with extractNat in binary
([KL20], Theorem 9.79, pp. 358–359).
Exact collision-to-discrete-logarithm reduction ([KL20], Theorem 9.79,
pp. 358–359): whenever every group d in the support of setup n satisfies
2 ^ blockLen d ≤ F.order d, the collision-finding success probability of adversary in
collisionGameFor (F.groupHashSetup setup) (F.groupHash blockLen) (F.validGroupHashInput blockLen)
is at most the discrete-logarithm success probability of
F.groupHashToDLAdversary blockLen adversary.
groupHashToDLAdversary is uniform strict PPT whenever blockLen is computable in polynomial
time in unary and adversary is uniform strict PPT.
Collision resistance of the discrete-logarithm hash family under the discrete-logarithm
assumption ([KL20], Section 9.4.2, Theorem 9.79, pp. 358–359): if
F.DiscreteLog setup holds, blockLen is computable in polynomial time in unary, and
2 ^ blockLen d ≤ F.order d for every supported group d ∈ (setup n).support at all sufficiently
large n, then F.groupHash blockLen is collision-resistant on F.validGroupHashInput blockLen
under F.groupHashSetup setup. This is the encoded collision-resistance endpoint: a fixed digest
width, compression and an efficient setup are not established (see the module docstring).
Algebraic core of the multi-generator hash (Construction 9.81, Exercise 9.28) #
Algebraic multi-generator discrete-logarithm vector hash ([KL20], Exercise 9.28,
Construction 9.81, p. 363; algebraic core only: hs is arbitrary, whereas KL's Gen fixes
h₁ = g and samples the other hᵢ uniformly, and no key generation or game is defined here):
given generators hs : ι → F.Carrier d and a scalar vector xs : ι → ZMod (F.order d), compute
∑ i, xs i • hs i.
Additive homomorphism of multiGeneratorHash.
Subtractive homomorphism of multiGeneratorHash.
Scalar-multiplication homomorphism of multiGeneratorHash.
When hs i = αs i • F.generator d for each i, multiGeneratorHash evaluates
(∑ i, xs i * αs i) • F.generator d.
Two input vectors xs, ys collide under hs i = αs i • F.generator d if and only if
∑ i, xs i * αs i = ∑ i, ys i * αs i in ZMod (F.order d).
Coordinate discrete-logarithm extraction from a multiGeneratorHash collision
(ingredient of the proof of [KL20], Exercise 9.28(a), p. 363): if xs and ys
collide under hs i = αs i • F.generator d and differ at coordinate j (ys j ≠ xs j), then the
discrete logarithm αs j is given by
(ys j - xs j)⁻¹ * ∑ i ∈ Finset.univ.erase j, (xs i - ys i) * αs i.