lib1305(3)

πŸ“¦
version 0~20250415 Β· 3 versions
, in debian trixie, ubuntu questing

✨ lib1305(3) ✨

okay bestie, sit down, hydrate, and let me tell you about lib1305 πŸ’– β€” it's the C API for the lib1305 implementation of the Poly1305 one-time authenticator. yes, THE one. the icon. the moment. πŸŽ€


🌸 NAME 🌸

lib1305 β€” a C API for the lib1305 implementation of the Poly1305 one-time authenticator. that's it, that's the whole vibe. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

Using lib1305:

#include <lib1305.h>

and link with -l1305. that's the whole linking situation, no cap. 🫢

Authenticating a message:

unsigned char a[poly1305_BYTES];
const unsigned char m[mlen];
const unsigned char k[poly1305_KEYBYTES];

poly1305(a,m,mlen,k);

Verifying an authenticator:

const unsigned char a[poly1305_BYTES];
const unsigned char m[mlen];
const unsigned char k[poly1305_KEYBYTES];
int result;

result = poly1305_verify(a,m,mlen,k);

πŸ‘‘ DESCRIPTION πŸ‘‘

so lib1305 is an implementation of the Poly1305 one-time authenticator. periodt. πŸ’œ

the lib1305 functions follow the SUPERCOP onetimeauth API… except that (and bestie, listen, there are three little exceptions and they matter):

  • the function names are lib1305-specific instead of crypto_onetimeauth_* πŸ’…
  • message lengths are long long instead of unsigned long long 😌
  • and the poly1305 function returns void instead of int 🫢

the poly1305 function generates an authenticator a[0], a[1], ..., a[poly1305_BYTES-1] given a message m[0], m[1], ..., m[mlen-1] and a secret key k[0], k[1], ..., k[poly1305_KEYBYTES-1]. ✨

⚠️ okay so "one-time" means the secret key must not be reused to generate an authenticator of another message. like, do NOT recycle that key. that's the whole entire point. iykyk. πŸ”₯

the poly1305_verify function verifies an authenticator a[0], a[1], ..., a[poly1305_BYTES-1] given a message m[0], m[1], ..., m[mlen-1] and a secret key k[0], k[1], ..., k[poly1305_KEYBYTES-1]. πŸ¦‹

it returns 0 if the authenticator is valid, otherwise nonzero. that's the vibe check right there β€” zero means slay, nonzero means nope. πŸ’€


🌈 SEE ALSO 🌈

  • randombytes(3) β€” go get yourself some random bytes, bestie, you're gonna need 'em πŸŽ€

πŸ’– and that's the tea, babe πŸ’– β€” this little masterpiece lives in the lib1305(3) manual page, and the footer says the same thing, so like… it's lib1305(3) all the way down. iconic. no date, no version drama, just the name. periodt. πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from