Hash Lab

Keyed cryptographic (MAC)

Poly1305

Designed by Daniel J. Bernstein (2005). A polynomial-evaluation MAC over the prime 2130 − 5: extremely fast, with a clean information-theoretic security proof. Always used with a fresh per-message key (typically derived from a stream cipher), which is why ChaCha20-Poly1305 pairs the two so naturally.

How it works

The message is split into 16-byte chunks, each interpreted as a 128-bit integer plus a marker bit. These are coefficients of a polynomial P(r) evaluated at a 128-bit key r modulo 2130 − 5, then masked with a second 128-bit key s. The result is a 128-bit tag.

tag = ( P_msg(r) mod (2^130 - 5) ) + s  mod 2^128

At a glance

Output128 bits (16 bytes)
Key256 bits (split into r and s)
DesignerDaniel J. Bernstein (2005)
StandardRFC 7539 / RFC 8439 (ChaCha20-Poly1305)
Throughput~5-15 GiB/s on modern CPUs
StatusModern, ubiquitous in 2020+ protocols

The one-time-key rule

Poly1305 keys must be fresh per message. Reusing (r, s) for two different messages lets an attacker recover r via linear algebra and forge subsequent tags freely. ChaCha20-Poly1305 satisfies this by deriving (r, s) from ChaCha20’s output keystream with the per-message nonce.

Where it is used

Information-theoretic security

With a uniformly-random one-time key, Poly1305’s forgery probability is bounded by ⌈|m|/16⌉ / 2106. Not just “hard” , provably small against unbounded adversaries (as long as the key is one-time). This is a different (stronger) security notion than HMAC’s computational PRF security.

References

Quick quiz

Test yourself on poly1305

10 multiple-choice questions. Pick an answer for each, then submit to see explanations.

  1. Q1.Who designed Poly1305?

  2. Q2.Poly1305's output size:

  3. Q3.Modulus used by Poly1305:

  4. Q4.What MUST be true about Poly1305 keys?

  5. Q5.Which AEAD pairs Poly1305 with a stream cipher?

  6. Q6.Which protocols use ChaCha20-Poly1305?

  7. Q7.What kind of MAC is Poly1305?

  8. Q8.Poly1305 forgery probability for a one-time key bounded by:

  9. Q9.Reuse of (r, s) for two messages...

  10. Q10.libsodium's AEAD using Poly1305 is called:

0 of 10 answered