Composition of a pseudorandom function with a universal hash function #
Applying a pseudorandom function F to the digest of a keyed hash function H gives
F'((k₁, k₂), m) = F(k₂, H(k₁, m)) (Cslib.Crypto.PRF.hashThenPRF; [BS23],
Section 7.3, equation (7.18), p. 262). For finite key, message, digest and output types,
Cslib.Crypto.PRF.advantage_hashThenPRF_le_add_multiQuery (equation (7.20), p. 263) bounds the
PRF advantage of any adaptive adversary A against hashThenPRF H F by the PRF advantage of
Cslib.Crypto.PRF.hashReduction H A (B_F) against F plus the winning probability of
Cslib.Crypto.PRF.idealQueries A (B'_H) in the multi-query universal-hash game
Cslib.Crypto.UHF.multiQueryExperiment H. When H is ε-universal against every adversary
(Cslib.Probability.IsUniversalHash) and A makes at most Q queries on every path,
Cslib.Crypto.PRF.advantage_hashThenPRF_le bounds that second term by Q.choose 2 * ε.
These finite-type bounds give query-count and output-length guarantees through
Cslib.Crypto.PRF.isQueryBounded_hashReduction and
Cslib.Crypto.PRF.length_le_of_mem_support_idealQueries. IsUniversalHash supplies a collision
bound at one instance. The computational form of Theorem 7.7, with strict PPT certificates and
negligible advantage, is Cslib.Crypto.PRF.hashThenPRFWord_indistinguishable in
CslibFrontier/Crypto/Computational/PseudorandomFunction/HashThenPRF.lean.
Conversely, Cslib.Crypto.PRF.toOuterMeasure_collision_le_advantage_collisionDistinguisher
formalizes the observation of Section 7.3 (p. 263) that two distinct messages colliding with
probability δ give a two-query distinguisher (Cslib.Crypto.PRF.collisionDistinguisher) of
advantage at least δ - 1 / |Z| against hashThenPRF H F.
Main definitions #
Cslib.Crypto.PRF.hashThenPRF:(7.18),F'((k₁, k₂), m) = F(k₂, H(k₁, m)).Cslib.Crypto.PRF.hashReduction: the PRF reductionB_Ffor Theorem 7.7.Cslib.Crypto.PRF.idealQueries: the multi-query UHF adversaryB'_Hsimulating an ideal PRF.Cslib.Crypto.PRF.collisionDistinguisher: the two-query collision test.
Main results #
Cslib.Crypto.PRF.isQueryBounded_hashReduction:B_Fpreserves query budgets.Cslib.Crypto.PRF.length_le_of_mem_support_idealQueries:B'_Houtputs at mostQmessages.Cslib.Crypto.PRF.eval_realExperiment_hashThenPRF: Game 0 is the real experiment ofB_F, a step toward(7.21).Cslib.Crypto.PRF.advantage_idealExperiment_hashReduction_le: Game 1 to Game 2,(7.22).Cslib.Crypto.PRF.isQueryBounded_collisionDistinguisher: the collision distinguisher makes2queries.Cslib.Crypto.PRF.toOuterMeasure_collision_le_advantage_collisionDistinguisher: collision lower bound on advantage againsthashThenPRF H F.
Steps toward Theorem 7.7 #
Cslib.Crypto.PRF.advantage_hashThenPRF_le_add_multiQuery: the concrete bound(7.20).Cslib.Crypto.PRF.advantage_hashThenPRF_le: the concrete bound for anε-bounded UHF.
Implementation notes #
collisionDistinguisher is not exposed. For module callers,
Cslib.Crypto.PRF.eval_realExperiment_collisionDistinguisher and
Cslib.Crypto.PRF.eval_idealExperiment_collisionDistinguisher give its output laws in the two
experiments.
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, Section 7.3, equations (7.18), (7.20)–(7.22), and Theorem 7.7, pp. 262–265.
Equation (7.18) ([BS23], Version 0.6, Section 7.3, p. 262):
F'((k₁, k₂), m) = F(k₂, H(k₁, m)).
The adversary B_F of Theorem 7.7 ([BS23], Version 0.6, Section 7.3, p. 263):
sample a hash key, run A, and forward each query through H k.
B_F makes one query per query of A.
The adversary B'_H named in (7.20) (p. 263) and constructed in Game 2 (p. 264) of
[BS23] (Version 0.6, Section 7.3): run A against a lazily sampled random function on
M and output the list of distinct queries it cached.
B'_H outputs at most as many messages as A makes queries.
Game 0 of the proof of Theorem 7.7 ([BS23], Version 0.6, Section 7.3, pp. 263–264),
a step toward equation (7.21): the real experiment of A against hashThenPRF H F has the same
distribution as the real experiment of hashReduction H A (B_F) against F.
Equation (7.22) ([BS23], Version 0.6, Section 7.3, p. 264), Games 1 and 2: against a uniform function, hashing the queries first changes the adversary's output only when two distinct queries collide under the hash key.
Concrete bound (7.20) for finite types, a step toward [BS23], Theorem 7.7
(Version 0.6, Section 7.3, pp. 262–263), not the cited result: for every H, F, and adversary
A, the distinguishing advantage against hashThenPRF H F is bounded by the advantage of
hashReduction H A against F plus the probability that idealQueries A wins the multi-query
UHF game against H. This finite result counts oracle queries. The computational form is
Cslib.Crypto.PRF.hashThenPRFWord_indistinguishable.
Concrete bound for finite types and an ε-bounded UHF, a step toward [BS23],
Theorem 7.7 (Version 0.6, Section 7.3, p. 262), not the cited result: for an adversary making at
most Q queries, advantage (hashThenPRF H F) A ≤ advantage F (hashReduction H A) + C(Q, 2) · ε.
This finite result assumes an ε collision bound at one instance and counts oracle queries.
The computational form is Cslib.Crypto.PRF.hashThenPRFWord_indistinguishable.
The two-query collision distinguisher of [BS23] (Version 0.6, Section 7.3, p. 263):
query m₀ and m₁ and accept when their replies agree.
collisionDistinguisher m₀ m₁ makes at most two external queries.
Output distribution of collisionDistinguisher m₀ m₁ in the real experiment against
hashThenPRF H F.
Output distribution of collisionDistinguisher m₀ m₁ in the ideal PRF experiment.
If m₀ ≠ m₁ collide under H with probability δ over the uniform hash key, the two-query
distinguisher collisionDistinguisher m₀ m₁ achieves advantage at least δ - 1 / |Z| against
hashThenPRF H F, for every F ([BS23], Version 0.6, Section 7.3, p. 263).