Domination-free encodings and the Winternitz encoding #
This module formalizes domination-free encodings and the Winternitz checksum encoding from Boneh–Shoup, Section 14.3 (Definition 14.4, Section 14.3.1, and Lemma 14.5, pp. 591–593).
A function P : M → Fin n → Fin (d + 1) is domination-free (DominationFree) when no pair of
distinct messages m ≠ m' satisfies P m ≤ P m' coordinatewise. The Winternitz encoding
(winternitzDigits d n0 n1 m) decomposes m < (d + 1) ^ n0 into n0 base-(d + 1) message
digits radixDigits d n0 m, computes the complement checksum
∑ i : Fin n0, (d - (radixDigits d n0 m i).val), and appends its n1 base-(d + 1) digits.
When d * n0 < (d + 1) ^ n1 and f : M → ℕ injects M into {x | x < (d + 1) ^ n0}, the
resulting encoding is domination-free (winternitzDigits_dominationFree).
We also provide an executable list form winternitzDigitList together with its List.ofFn
characterization (winternitzDigitList_eq_ofFn), length and entry agreements
(winternitzDigitList_length, getElem_winternitzDigitList), and a polynomial-time certificate
winternitzDigitList_polyTime in binary d, m and unary n0, n1.
Main definitions #
Cslib.Crypto.OneTimeSignature.DominationFree: domination-free encodingsM → Fin n → Fin (d + 1).Cslib.Crypto.OneTimeSignature.radixDigits: little-endian base-(d + 1)digit vector of lengthwidth.Cslib.Crypto.OneTimeSignature.winternitzDigits: Winternitz message-and-checksum digit vector of lengthn0 + n1.Cslib.Crypto.OneTimeSignature.winternitzDigitList: executable list of Winternitz message-and-checksum digits.
Main results #
Cslib.Crypto.OneTimeSignature.dominationFree_of_append_checksum: append-checksum criterion for domination-freeness (argument of Lemma 14.5, p. 593).Cslib.Crypto.OneTimeSignature.sum_radixDigits_mul_pow: positional reconstruction ofx < (d + 1) ^ width.Cslib.Crypto.OneTimeSignature.radixDigits_injOn: injectivity ofradixDigits d widthbelow(d + 1) ^ width.Cslib.Crypto.OneTimeSignature.le_of_radixDigits_le: coordinatewise digit comparison implies numeric comparison.Cslib.Crypto.OneTimeSignature.winternitzDigits_dominationFree: Lemma 14.5 (p. 593), for anyn1withd * n0 < (d + 1) ^ n1.Cslib.Crypto.OneTimeSignature.winternitzDigitList_eq_ofFn:List.ofFnagreement withwinternitzDigits.Cslib.Crypto.OneTimeSignature.winternitzDigitList_polyTime: polynomial-time computability ofwinternitzDigitList.Cslib.Crypto.OneTimeSignature.winternitzDigits_one_eq_one_iff_mem_optSet: equivalence ofwinternitzDigits 1withoptSet([BS23], Section 14.3.1, p. 593).
References #
- D. Boneh and V. Shoup, A Graduate Course in Applied Cryptography, Section 14.3 (Definition 14.4, Section 14.3.1, and Lemma 14.5, pp. 591–593).
Append-checksum criterion, the argument of the proof of Lemma 14.5 in [BS23]
(p. 593): if P0 is injective, ∑ i, (P0 m i).val + checksum m is the same number C for every
m, and P1 m ≤ P1 m' implies checksum m ≤ checksum m', then
fun m => Fin.append (P0 m) (P1 m) is domination-free.
Positional reconstruction of x < (d + 1) ^ width from radixDigits d width x.
radixDigits d width is injective on {x | x < (d + 1) ^ width}.
Coordinatewise order on radixDigits implies numeric order below (d + 1) ^ width.
The function P of [BS23], Section 14.3.1 (pp. 592–593), on a message m : ℕ:
the n0 base-(d + 1) digits of m, then the n1 base-(d + 1) digits of the checksum
∑ i : Fin n0, (d - (radixDigits d n0 m i).val), which equals the printed
d * n0 - (s_1 + ... + s_n0). Both blocks are least significant first, a choice made here:
domination-freeness does not depend on the order within a block.
Lemma 14.5 of [BS23] (p. 593): fun m => winternitzDigits d n0 n1 (f m) is
domination-free when f : M → ℕ is injective with values below (d + 1) ^ n0 and
d * n0 < (d + 1) ^ n1.
The book states it for the messages {0,1}^v read as the integers below 2 ^ v, with n0
the least integer such that 2 ^ v ≤ (d + 1) ^ n0 and n1 = ⌈log_(d+1) (d * n0)⌉ + 1: the
instance f = Fin.val on Fin (2 ^ v) with n1 = Nat.clog (d + 1) (d * n0) + 1. Minimality
of n0 is not used. The table on p. 592 takes the least n1 with d * n0 < (d + 1) ^ n1,
one less than the printed formula for d = 3, 15, 1023.
Executable list of n0 + n1 Winternitz message-and-checksum digits for m.
Length of winternitzDigitList d n0 n1 m.
Every entry of winternitzDigitList d n0 n1 m equals the corresponding coordinate of
winternitzDigits d n0 n1 m.
winternitzDigitList d n0 n1 m as List.ofFn of winternitzDigits d n0 n1 m.
winternitzDigitList is computable in polynomial time when d and m are encoded in
binary (encNat) and the digit counts n0 and n1 are encoded in unary (encUnary).
For d = 1, winternitzDigits 1 v w on the little-endian integer value of m is 1 at
coordinate k if and only if k ∈ optSet v w m ([BS23], Section 14.3.1, p. 593).