Universal Hashing and Carter-Wegman MAC #
This file formalizes universal hash families and the Carter-Wegman one-time MAC construction from Chapter 12 of "The Joy of Cryptography".
Main definitions #
UHFamily— universal hash family structureboolPairwiseHash— pairwise-independent hash over Bool: H(k₁,k₂)(m) = (k₁∧m) ⊕ k₂uh_forge_real,uh_forge_ideal— forgery gamesIsUniversal— universality property
Main results #
boolHash_forge_advantage— forgery advantage ≤ 1/2 for Bool hashboolPairwiseHash_is_universal— Bool hash is 1/2-universal
References #
- [Rosulek, The Joy of Cryptography, Chapter 12]
- [Carter & Wegman, Universal Classes of Hash Functions, 1979]
Universal Hash Family #
A universal hash family with collision bound ε.
Instances For
Pairwise-independent hash over Bool.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Forgery Games #
Real forgery game: sample key, check if adversary's guess matches hash on new message.
Equations
- CatCryptCore.Examples.UniversalHash.uh_forge_real H _m m_star t_star = do let k ← CatCrypt.Core.SPComp.sample H.KeyType CatCrypt.Core.SPComp.pure (t_star == H.hash k m_star)
Instances For
Ideal forgery game: forgery always fails.
Instances For
Forgery advantage.
Equations
- One or more equations did not get rendered due to their size.
Instances For
IsPure Proofs #
Arithmetic Helpers #
Core prTrue Equality #
For the Bool pairwise hash forgery game with m_star ≠ m, the prTrue distribution equals that of uniform Bool sampling.
The proof expands the sums over Bool × Bool, computes the hash values, and uses arithmetic to show the 4-element sum equals the 2-element sum.
Main Security Theorem #
For the Bool hash, forgery advantage ≤ 1/2. Uses forge_prTrue_eq to show the advantage equals that of sample Bool vs pure false.
Concrete instance: Bool hash MAC security bound.
Collision Game and Universality #
Collision probability game.
Equations
- CatCryptCore.Examples.UniversalHash.collision_game H m₁ m₂ = do let k ← CatCrypt.Core.SPComp.sample H.KeyType CatCrypt.Core.SPComp.pure (H.hash k m₁ == H.hash k m₂)
Instances For
A hash family is ε-universal.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Collision prTrue equals uniform Bool prTrue (same argument as forge).
The Bool pairwise hash is 1/2-universal.