The accumulator from a group of unknown order: correctness and aggregation #
The accumulator of [BS23], §10.9 (pp. 421–423), which the book calls the GUO
accumulator, in the group (ℤ/Nℤ)ˣ with a base g; the modulus, the base and every group element
are natural numbers. Alice commits to a finite set S of elements of a type X, through a hash
H : X → ℕ, by c = g ^ E with E = ∏ x ∈ S, H x (construction (10.5), p. 421). Adding an
element x ∉ S raises the commitment to the power H x (p. 421). A membership proof for x is
b = g ^ (E / H x), which Bob checks by b ^ H x = c. A non-membership proof is a pair (b, γ)
with β * H x + γ * E = 1 and b = g ^ β, which Bob checks by b ^ H x * c ^ γ = g
(pp. 421–422). One group element π_T = g ^ (E / ∏ x ∈ T, H x) proves T ⊆ S (p. 423); two
membership proofs for elements with coprime hashes combine into one by Shamir's trick, and the
aggregate splits back into the two proofs (p. 422).
The source's claims map to Lean as follows.
- (10.5) and the update
c' = c ^ H(x)(p. 421):guoCommitandguoCommit_insert. - Membership proofs and Bob's check (p. 421), the aggregate
π_xy(p. 422) andπ_T(p. 423):guoSubsetWitnessandguoVerifySubset; the proofs verify byguoVerifySubset_subsetWitness,guoVerifySubset_singletonandguoVerifySubset_pair. - Recovering
π_xfromπ_xy(p. 422):guoVerifySubset_split. Carol's aggregation of two membership proofs by Theorem 10.6 (pp. 422–423):guoVerifySubset_commonRoot. - Non-membership proofs (pp. 421–422):
guoNonMemCoeffandguoNonMemWitnesscompute Alice's(b, γ)andguoVerifyNonMemis Bob's check.guoVerifyNonMem_witnessshows that Alice's proof verifies whenevergcd(H(x), E) = 1, andguoNonMemCoeff_ltis the book's bound on|γ|. - Correctness (p. 422): for a prime
H xdistinct from the hashes of the elements ofS, the exponents are coprime (coprime_guoExponent) and Alice's non-membership proof verifies (guoVerifyNonMem_guoCommit); if they are not coprime andx ∉ S, somey ∈ Scollides withx(exists_collision_of_not_coprime_guoExponent). - The two equations in the book's security argument (p. 422),
a ^ H(x) = candb ^ H(x) * c ^ γ = g, give(b * a ^ γ) ^ H(x) = g:guoForgeryRootandpowMod_guoForgeryRoot. The security theorem, which uses them, isStrongRSA.negligible_guoAccumulatorGameinCslibFrontier/Crypto/Computational/GUOAccumulator/Security.lean.
Main definitions #
Cslib.Crypto.guoExponent: the exponentE = ∏ x ∈ S, H xof (10.5).Cslib.Crypto.guoCommit: the commitmentg ^ E mod N.Cslib.Crypto.guoSubsetWitness: Alice's proofπ_TthatT ⊆ S,g ^ (∏ x ∈ S \ T, H x).Cslib.Crypto.guoVerifySubset: Bob's checkb ^ e = cfor one hasheor a product of hashes.Cslib.Crypto.guoNonMemCoeff,Cslib.Crypto.guoNonMemWitness: Alice's non-membership proof, the negated coefficient-γand the group elementb = g ^ β.Cslib.Crypto.guoVerifyNonMem: Bob's non-membership check, including the check thatcis a unit.Cslib.Crypto.guoForgeryRoot: the rootb * a ^ γcomputed from a membership proofaand a non-membership proof(b, γ)for one element.
Main results #
Cslib.Crypto.guoCommit_insert: the commitment toinsert x Sisc ^ H xforx ∉ S.Cslib.Crypto.guoVerifySubset_subsetWitness,Cslib.Crypto.guoVerifySubset_singleton,Cslib.Crypto.guoVerifySubset_pair: Alice's proofs for a subset, an element and a pair verify.Cslib.Crypto.guoVerifySubset_split,Cslib.Crypto.guoVerifySubset_commonRoot: an aggregate splits into proofs, and two proofs for coprime exponents against a unit commitment aggregate.Cslib.Crypto.guoNonMemCoeff_lt,Cslib.Crypto.guoVerifyNonMem_witness,Cslib.Crypto.guoVerifyNonMem_guoCommit: Alice's non-membership proofs verify.Cslib.Crypto.coprime_guoExponent,Cslib.Crypto.exists_collision_of_not_coprime_guoExponent:gcd(H(x), E) = 1unless the hash collides.Cslib.Crypto.powMod_guoForgeryRoot: a membership and a non-membership proof for one element give anH x-th root ofg.Cslib.Crypto.computableInPolyTime_guoVerifySubset,Cslib.Crypto.computableInPolyTime_guoVerifyNonMem,Cslib.Crypto.computableInPolyTime_guoNonMemCoeff,Cslib.Crypto.computableInPolyTime_neg_guoNonMemCoeff,Cslib.Crypto.computableInPolyTime_guoNonMemWitness,Cslib.Crypto.computableInPolyTime_guoForgeryRoot: both checks, Alice's non-membership proof and the root are computable in polynomial time from polynomial-time inputs, the integerγonencIntBinand every natural number onencNat, with no condition on the values.Cslib.Crypto.computableInPolyTime_guoExponent_toFinset,Cslib.Crypto.computableInPolyTime_guoCommit_toFinset: Alice's exponentEand commitment for the elements of a list read onencListare computable in polynomial time whenHis (and, for the commitment, whenNandgare).
Implementation notes #
The statements differ from the book's as follows.
- The group is
(ℤ/Nℤ)ˣ, the one group of unknown order whose generation the book specifies (p. 421), represented by natural numbers. Group operations arepowMod, which returns1at the modulus0. The base is a unit (Nat.Coprime g N) where a proof needs it. His any functionX → ℕ. The book's hash takes values in the firstLprimes (p. 421); primality is assumed only where it is used, incoprime_guoExponentand its consequences.π_Tisg ^ (∏ x ∈ S \ T, H x)rather thang ^ (E / ∏ x ∈ T, H x). The two are equal whenT ⊆ Sand no hash is0, and this form needs no division and no hypothesis on the hashes.γis an integer as in the book, but no one inverts a group element: forγ < 0Bob comparesb ^ H xwithg * c ^ |γ|. Alice'sγis-guoNonMemCoeff (H x) E, soγ ≤ 0,|γ| < H xwhere the book has|γ| ≤ H(x), andβ = (|γ| * E + 1) / H xis a natural number.- Bob checks that
cis a unit, the book'sc ∈ G. Without this check(c, a, b, γ) = (0, 0, 0, -1)would pass both checks for every modulusN ≥ 1, base and hashH x ≥ 1. - "Correctness relies on the collision resistance of
H" (p. 422) is stated by the explicit collision ofexists_collision_of_not_coprime_guoExponent, not as a game against a hash family.
guoCommit and guoSubsetWitness take a Finset. Alice computes E from a list of elements as
the product of their hashes, which for a list without duplicates is guoExponent of its elements
(List.prod_toFinset). computableInPolyTime_guoExponent_toFinset and
computableInPolyTime_guoCommit_toFinset certify E and the commitment from any list, whose
duplicates they erase before multiplying; the certificates for her non-membership proof take E
as an input and compose with the first. Her membership proofs guoSubsetWitness are not
certified from a list.
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, §10.9, pp. 421–423.
Bob's check b ^ e = c modulo N of a proof b against the commitment c
([BS23], §10.9, pp. 421–423). For a membership proof of x, e = H x; for an
aggregate proof of a set T, e is the product of the hashes of its elements.
Alice's proof π_T that T ⊆ S: g to the product of the hashes of the elements of S \ T.
For T ⊆ S and nonzero hashes this is the book's g ^ (E / ∏ x ∈ T, H x) ([BS23],
§10.9, p. 423); T = {x} is the membership proof π_x (p. 421), and T = {x, y} is the
aggregate π_xy (p. 422).
The accumulator is dynamic ([BS23], §10.9, p. 421): for x ∉ S, the commitment to
insert x S is the commitment c to S raised to the power H x.
Alice's proof that T ⊆ S verifies against the commitment to S, with the product of the
hashes of the elements of T as exponent ([BS23], §10.9, p. 423).
Correctness of membership proofs ([BS23], §10.9, pp. 421–422): for x ∈ S, Alice's
proof π_x verifies against the commitment to S.
Alice's aggregate proof π_xy for distinct x, y ∈ S verifies against the commitment to S
with the exponent H x * H y ([BS23], §10.9, p. 422).
An aggregate proof splits ([BS23], §10.9, p. 422): if b passes Bob's check with
the exponent e * f, then b ^ f mod N passes it with the exponent e.
Anyone can aggregate two membership proofs ([BS23], §10.9, pp. 422–423): if b₁
and b₂ pass Bob's check against a unit c with coprime exponents e and f, then Shamir's
trick commonRoot (Theorem 10.6) yields a proof that passes it with the exponent e * f.
Bob's check of a non-membership proof (b, γ) for an element with hash h against the
commitment c ([BS23], §10.9, pp. 421–422): c is a unit modulo N, the book's
c ∈ G, and b ^ h * c ^ γ = g. For γ < 0 the check compares b ^ h with g * c ^ |γ|, so
no inverse is computed.
The coefficient k = -γ of Alice's non-membership proof for an element with hash h
against the exponent E ([BS23], §10.9, p. 421): the inverse of -E modulo h,
computed by the extended Euclidean algorithm BinaryGcd.modInv. When 0 < h and
Nat.Coprime h E, h divides k * E + 1, so β * h + γ * E = 1 for γ = -k and
β = (k * E + 1) / h.
The group element b = g ^ β of Alice's non-membership proof for an element with hash h
against the exponent E ([BS23], §10.9, p. 421), with
β = (guoNonMemCoeff h E * E + 1) / h.
Alice's coefficient satisfies |γ| < h, a slightly sharper form of the book's
|γ| ≤ H(x) ([BS23], §10.9, p. 421).
Correctness of non-membership proofs ([BS23], §10.9, pp. 421–422): if g is a unit
modulo N, 0 < h and gcd(h, E) = 1, then Alice's proof
(guoNonMemWitness N g h E, -guoNonMemCoeff h E) passes Bob's check against c = g ^ E.
For a prime H x distinct from the hashes of the elements of S, which are prime too, H x
is coprime to the exponent E of S ([BS23], §10.9, p. 422).
The book's argument that correctness relies on the collision resistance of H
([BS23], §10.9, p. 422), stated as an explicit collision: if x ∉ S, the hashes are
prime and gcd(H(x), E) ≠ 1, then some y ∈ S with y ≠ x has H y = H x.
Correctness of non-membership proofs for a committed set ([BS23], §10.9,
pp. 421–422): if g is a unit modulo N, H x is prime and distinct from the hashes of the
elements of S, which are prime too, then Alice's non-membership proof for x passes Bob's check
against the commitment to S.
The algebra of the book's security argument ([BS23], §10.9, p. 422): if a passes
Bob's membership check and (b, γ) his non-membership check for the same hash h and commitment
c, then guoForgeryRoot N a b γ is an h-th root of g modulo N. There is no hypothesis on
N, g or h.
Polynomial-time certificates #
Bob's membership and subset check is computable in polynomial time whenever N, c, e and
b are, as natural numbers on encNat.
Bob's non-membership check is computable in polynomial time whenever N, g, c, h and
b are, as natural numbers on encNat, and γ is, as an integer on encIntBin.
Alice's exponent E for the set of elements of a list is computable in polynomial time whenever
the list is, on encList encX, and H is, with binary values. The machine erases the list's
duplicates (eraseDupsByWithInput) and multiplies the hashes along the result (binary_prod);
for a list without duplicates, E is that product (List.prod_toFinset). The list certificate
comes first, so that fun_prop can infer the element encoding.
Alice's commitment to the set of elements of a list is computable in polynomial time whenever
N and g are, as natural numbers on encNat, the list is, on encList encX, and H is, with
binary values: computableInPolyTime_powMod applied to
computableInPolyTime_guoExponent_toFinset.
Alice's non-membership coefficient guoNonMemCoeff h E, the natural number -γ on encNat,
is computable in polynomial time whenever h and E are, as natural numbers on encNat.
Alice's coefficient γ = -guoNonMemCoeff h E, as an integer on encIntBin, is computable in
polynomial time whenever h and E are, as natural numbers on encNat. This is the form of γ
in guoVerifyNonMem_witness and computableInPolyTime_guoVerifyNonMem.
Alice's non-membership group element is computable in polynomial time whenever N, g, h
and E are, as natural numbers on encNat.
The root guoForgeryRoot is computable in polynomial time whenever N, a and b are, as
natural numbers on encNat, and γ is, as an integer on encIntBin.