Fixed-length SUF-CMA MAC + arbitrary-length weakly collision-resistant hash ⇒ arbitrary-length SUF-CMA MAC (NMAC)
Statement
Let with , and for and let , with and , where with each and , with least such that divides , is the padding of Merkle–Damgård iteration: is the iteration of keyed by its initial chaining value. NMAC has two independent keys , message space , canonical verification, and
for a fixed string of bits. Suppose that , keyed by its chaining input under a uniform key, is an -secure MAC on -bit messages: no forger that makes queries and runs in time succeeds with probability more than . Suppose that is -weakly collision resistant: no adversary that sees , for a hidden uniform , only through oracle queries of at most bits and runs in time outputs with with probability more than . Then NMAC is an -secure MAC against forgers making queries of at most bits in time , which includes the time to compute the answers — BCK96 (Theorem 4.1).
The outer and inner functions need not come from one compression function — BCK96 (Remark 4.6). Let be an arbitrary-length weakly collision-resistant family, with domain , range and key generation . Set , polynomially bounded since is, and computable from in polynomial time as the length of the hash of the empty string under the key that outputs on all-zero coins, and . Then has exactly the collisions of , and for all but finitely many : the inputs and collide whenever , which weak collision resistance therefore allows for only finitely many — standard. Let be a -correct, SUF-CMA-secure MAC for messages of length , so that its message space contains , the range of . The MAC has keys and , message space , and
It is -correct for every , since is independent of , and for every making queries there are , which makes queries, all in , and runs once plus evaluations of , and , which makes queries (those of and its forged message) and runs once plus evaluations of , such that
— standard, following the proof of Theorem 4.1 in BCK96. So, for negligible , is an arbitrary-length SUF-CMA MAC. NMAC is the case , whose range is , so that , and on with canonical verification. This MAC is the restriction of to the -bit messages ending in : a forger against it, with in place of each it queries or outputs, is one against on with the same success, since is injective — standard. Both and NMAC are deterministic with canonical verification, so for each of them UF-CMA and SUF-CMA security coincide (Deterministic MACs), and if , keyed by its chaining input, is a UF-CMA-secure MAC on and is weakly collision resistant, NMAC is a perfectly correct arbitrary-length SUF-CMA MAC — standard.
Sketch
samples , answers each query of by querying its own oracle on , and outputs for ‘s output ; samples , answers with applied to its oracle’s answer padded with , then queries and outputs for an with , if there is one. If is valid and is no query–answer pair of , then either such an exists, or every with equals and was answered with a tag other than , so is valid and is no query–answer pair of — standard; for UF-CMA, BCK96 (proof of Theorem 4.1).
Notes
- The collision finder queries to learn and so name the colliding pair, which makes queries — standard; the proof of Theorem 4.1 in BCK96 bounds it by the forger’s .
- The bound cannot be replaced by : a divide-and-conquer attack recovers the two keys one at a time, so the security of NMAC rests on the length of each key rather than of both — BCK96 (Section 6, Remark 4.7). A birthday attack, which looks for a tag collision among equal-length messages and extends it, forges NMAC with significant probability only after about tag queries — BCK96 (Section 6).
- Without the outer application of , the iteration is forged by length extension, whatever (No fixed-construction reduction from CRHF to MAC (secret-prefix MAC)) — BCK96 (Remark 4.9).
- Weak collision resistance of can be replaced by the weaker assumption that is collision resistant against adversaries that see its values only after a second hashing under a different secret key — BCK96 (Remark 4.5). Weak collision resistance fails for MD5 and SHA-1 as iterated hash functions keyed by their initial value — Bel06. NMAC is a PRF, hence a MAC, if is a PRF, with no collision-resistance assumption (Non-uniform compression-function PRF ⇒ MAC (NMAC), Compression-function PRF ⇒ MAC (NMAC, uniform proof)) — Bel06, GPR14.
- HMAC is NMAC under the keys and derived from one key , so the theorem covers it if in addition is indistinguishable from a pair of independent uniform keys — BCK96 (Section 5.2).
- A compressing weakly collision-resistant family yields an arbitrary-length one by the steps of CRHF ⇒ Arbitrary-length CRHF (Merkle–Damgård): restriction to , the fixed-length iteration over one-bit blocks, which raises the block length to , and Merkle–Damgård iteration. In each step a collision finder for runs an adversary against the new family, answers its queries by chained calls to its own oracle, and evaluates both outputs by further such calls, returning the inputs at the last step at which the two computations differ in their input; for Merkle–Damgård iteration this needs both outputs shorter than , which holds for efficient adversaries and all large — standard.