← Cryptography guide

K058 / Hashes, MACs and key derivation

Poly1305

Poly1305 MAC · Survey date 2026-12-05

Poly1305 is an authenticator (MAC) that takes a 32-byte key and message and produces a 16-byte tag.

CRYPTOGRAPHY LAB / K058

Cryptography Lab · Poly1305

Run real computations and inspect intermediate states step by step.

Educational only. Never enter real passwords or secret keys. Computation stays in your browser; input and trace values are not sent to a server. Do not use this implementation in production.

Scope: Standard operation

Poly1305 (one-time key)

See the scope above for fixed examples, reduced parameters and supported variants. Standard operation names and formulas are retained.

Reference ↗

Open lab →

Definition and overview
Poly1305 is an authenticator (MAC) that takes a 32-byte key and message and produces a 16-byte tag. Source document ↗
Classification and reversibility
MAC for message integrity and origin authentication, not decryption/decoding. Source document ↗
Key or secret requirements
Requires a secret 32-byte one-time key; never reuse. Source document ↗
Operating principle and structure
Treat message blocks as polynomial coefficients, evaluate at secret r modulo 2^130−5 and add s to compute tag. Source document ↗
Key size, block size and parameters
256-bit key split into 128-bit r and s; 128-bit tag. Source document ↗
Security strength and recommendation
Recommended in IETF RFC 7539/8439, no separate NIST FIPS approval. Source document ↗
Known attacks and vulnerabilities
Reusing key across messages permits tag forgery. Source document ↗
Standards and certification
IETF RFC 7539 and RFC 8439; no separate NIST FIPS. Source document ↗
Typical uses
Mainly message authentication in ChaCha20/XChaCha20 AEAD. Source document ↗
Implementations, libraries and tools
Implementations in HACL*, libsodium, cryptography, PyCryptodome. Source document ↗
Decryption or decoding
Poly1305 itself does not decrypt; AEAD must not release plaintext before tag verification. Source document ↗
Advantages
Fast on 32/64-bit systems using 16-byte blocks and prime modular arithmetic. Source document ↗
Limitations and cautions
One-time key requirement; reuse enables forgery. Source document ↗
Distinguishing encryption, encoding and hashing
MAC authentication tag, not encryption, encoding or decryption. Source document ↗

Practical examples

Examples are illustrative; they are not execution-tested implementations or operational recommendations.

Example

Sender computes 16-byte tag with one-time 32-byte key and sends it with message; receiver recomputes and compares. ChaCha20-Poly1305 transmits ciphertext and tag together.

Procedure

MAC: prepare one-time key, calculate tag, transmit, recompute/verify with same key. AEAD: prepare key/nonce, encrypt/generate tag, authenticate before releasing plaintext. Distinguish from encoding; no plaintext on verification failure.

Scenario

Mobile app/server messages use ChaCha20-Poly1305 authenticated encryption and release plaintext only after successful verification. Use AEAD tag to confirm API request body integrity and origin.

Pitfalls and alternatives

Never reuse one-time keys or nonces. Prefer vetted ChaCha20-Poly1305/libsodium AEAD over standalone implementations. Do not use plaintext before verification or mistake MAC for encryption/hash/encoding.

References