{
  "id": "2014/578",
  "url": "https://opencryptology.org/2014/578",
  "original_url": "https://eprint.iacr.org/2014/578",
  "title": "The Exact PRF-Security of NMAC and HMAC",
  "authors": [
    "Peter Gaži",
    "Krzysztof Pietrzak",
    "Michal Rybár"
  ],
  "affiliations": null,
  "abstract": "NMAC is a mode of operation which turns a fixed input-length\nkeyed hash function f into a variable input-length function.\nA~practical single-key variant of NMAC called HMAC is a very\npopular and widely deployed message authentication code\n(MAC).  Security proofs and attacks for NMAC can typically\nbe lifted to HMAC.\n\nNMAC was introduced by Bellare, Canetti and Krawczyk\n[Crypto'96], who proved it to be a secure pseudorandom\nfunction (PRF), and thus also a MAC, assuming that\n(1) f is a PRF and\n(2) the function we get when cascading f is weakly\ncollision-resistant.\nUnfortunately, HMAC is typically instantiated with\ncryptographic hash functions like MD5 or SHA-1 for which (2)\nhas been found to be wrong.  To restore the provable\nguarantees for NMAC, Bellare [Crypto'06]  showed its\nsecurity based solely on the assumption that f is a PRF,\nalbeit via a non-uniform reduction.\n\nOur first contribution is a simpler and uniform proof: If f\nis an \\eps-secure PRF (against q queries) and a\n\\delta-non-adaptively secure PRF (against q queries), then\nNMAC^f is an (\\eps+lq\\delta)-secure PRF against q queries of\nlength at most l blocks each.\n\nWe then show that this \\eps+lq\\delta bound is basically\ntight.  For the most interesting case where lq\\delta>=\\eps\nwe prove this by constructing an f for which an attack with\nadvantage lq\\delta exists.  This also violates the bound\nO(l\\eps) on the PRF-security of NMAC recently claimed by\nKoblitz and Menezes.\n\nFinally, we analyze the PRF-security of a modification of\nNMAC called NI [An and Bellare, Crypto'99] that differs\nmainly by using a compression function with an additional\nkeying input. This avoids the constant rekeying on\nmulti-block messages in NMAC and allows for a security proof\nstarting by the standard switch from a PRF to a random\nfunction, followed by an information-theoretic analysis. We\ncarry out such an analysis, obtaining a tight lq^2/2^c bound\nfor this step, improving over the trivial bound of\nl^2q^2/2^c.  The proof borrows combinatorial techniques\noriginally developed for proving the security of CBC-MAC\n[Bellare et al., Crypto'05].  We also analyze a variant of\nNI that does not include the message length in the last call\nto the compression function, proving a l^{1+o(1)}q^2/2^c\nbound in this case.",
  "category": "Secret-key cryptography",
  "license": {
    "code": "CC BY",
    "url": "https://creativecommons.org/licenses/by/4.0/",
    "label": "CC BY 4.0",
    "attribution": "“The Exact PRF-Security of NMAC and HMAC” by Peter Gaži, Krzysztof Pietrzak, Michal Rybár, Cryptology ePrint Archive, Paper 2014/578, https://eprint.iacr.org/2014/578. Licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/).",
    "retroactive": true,
    "redistribute_verbatim_only": false,
    "non_commercial": false
  },
  "dates": {
    "submitted": "2014-07-24T12:53:13Z",
    "updated": "2014-08-13T06:56:37Z",
    "withdrawn": null
  },
  "withdrawn": false,
  "withdrawn_on": null,
  "pdf": {
    "url": "https://opencryptology.org/2014/578.pdf",
    "sha256": "bcc04c75380fe0cf19cc931e4bb79f7fea701ce10005c5406c5506e49619edb2",
    "size": 492310,
    "source": "github-mirror",
    "source_date": "2019-02-25T16:55:32Z",
    "maybe_stale": false,
    "newer_on_eprint": null,
    "withdrawn": false
  },
  "versions": [
    {
      "url": "https://opencryptology.org/2014/578/versions/20190225T165532Z.pdf",
      "captured_at": "2019-02-25T16:55:32Z",
      "label": "copy captured 2019-02-25",
      "source": "github-mirror",
      "source_url": "https://raw.githubusercontent.com/arturo-kong/IACR-eprint-mirror/master/2014/578.pdf",
      "size": 492310,
      "sha256": "bcc04c75380fe0cf19cc931e4bb79f7fea701ce10005c5406c5506e49619edb2",
      "is_default_pdf": true
    }
  ],
  "other_sources": [
    {
      "kind": "wayback",
      "url": "https://web.archive.org/web/20260924034613id_/https://eprint.iacr.org/2014/578.pdf",
      "captured_at": "2026-09-24T03:46:13Z",
      "size": 493638
    },
    {
      "kind": "github-mirror",
      "url": "https://raw.githubusercontent.com/arturo-kong/IACR-eprint-mirror/master/2014/578.pdf",
      "captured_at": "2019-02-25T16:55:32Z",
      "size": 492310
    }
  ],
  "bibtex": "@misc{cryptoeprint:2014/578,\n      author = {Peter Gaži and Krzysztof Pietrzak and Michal Rybár},\n      title = {The Exact PRF-Security of NMAC and HMAC},\n      howpublished = {Cryptology {ePrint} Archive, Paper 2014/578},\n      year = {2014},\n      url = {https://eprint.iacr.org/2014/578}\n}"
}
