ddn.crypto.mac.poly1305

Poly1305 Message Authentication Code (RFC 8439).

Side-Channel Status: The accumulator arithmetic runs on fixed 26-bit limbs with a fully unrolled, branch-free block function, so the operation sequence does not depend on the key or the message.

class Poly1305

Types 1

classPoly1305 : MAC

Poly1305 Implementation.

One-time authenticator. Requires a 32-byte key (r, s).

The state is kept as five 26-bit limbs (the classic fixed-width representation): the block multiply is an unrolled fixed sequence of multiply-accumulate and carry steps with no data-dependent branches, unlike the previous BigInt-based implementation whose timing followed the values it processed.

Warning: The key (r, s) MUST NOT be reused for different messages. Typically, this key is derived from a master key and a nonce (e.g., in ChaCha20-Poly1305).

Methods
void initialize(SecretKey key)Initializes (or re-initializes) the Poly1305 MAC with the given key.
void initialize(const(ubyte)[] key)
size_t size() @property const
void reset()
MAC update(const(ubyte)[] input)
ubyte[] finish()
void wipe() nothrow @nogc @trustedZeroizes the key and all accumulator state in place.
Constructors
this(Key key)Constructs a Poly1305 MAC with the given key.
Destructors