wire / wire-format / poly1305
Poly1305 is a one-time MAC (RFC 8439) that authenticates a message using a 256-bit one-time key. The key is split into r (128 bits, clamped) and s (128 bits). The message is processed in 16-byte blocks, each interpreted as a little-endian integer and multiplied by r modulo 2^130-5. The final tag is (accumulator + s) mod 2^128.
aka: Poly1305 one-time MAC
spec: RFC 8439
Poly1305 is a one-time MAC (RFC 8439) that authenticates a message using a 256-bit one-time key. The key is split into r (128 bits, clamped) and s (128 bits). The message is processed in 16-byte blocks, each interpreted as a little-endian integer and multiplied by r modulo 2^130-5. The final tag is (accumulator + s) mod 2^128.
| field | size | meaning |
|---|---|---|
| One-time key | 32 bytes | r (16 bytes, clamped: r &= 0x0ffffffc0ffffffc0ffffffc0fffffff) + s (16 bytes). |
| Message block | 16 bytes | Each 16-byte chunk interpreted as a little-endian integer, with a 0x01 byte appended (for the final partial block, pad with zeros then 0x01). |
| Accumulator | 17 bytes (136 bits) | Running sum mod 2^130-5. Initialized to 0. |
| Tag | 16 bytes | Final tag = (accumulator + s) mod 2^128 (low 128 bits). |
example:
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Poly1305 one-time key (all zeros, for illustration)
agent: curl -H 'accept: application/json' wire.phall.io/wire-format/poly1305
or /wire-format/poly1305.json