ppad-poly1305-0.3.0: A pure Poly1305 MAC
Copyright(c) 2025 Jared Tobin
LicenseMIT
MaintainerJared Tobin <jared@ppad.tech>
Safe HaskellNone
LanguageHaskell2010

Crypto.MAC.Poly1305

Description

A pure Poly1305 MAC implementation, as specified by RFC 8439.

Synopsis

Poly1305 message authentication code

mac Source #

Arguments

:: ByteString

256-bit one-time key

-> ByteString

arbitrary-length message

-> Maybe ByteString

128-bit message authentication code

Produce a Poly1305 MAC for the provided message, given the provided key.

Per RFC8439: the key, which is essentially a one-time key, should be unique, and MUST be unpredictable for each invocation.

The key must be exactly 256 bits in length.

>>> mac "i'll never use this key again!!!" "a message needing authentication"
Just "O'\231Z\224\149\148\246\203[}\210\203\b\200\207"