Welcome to little lamb

Code » limb » master » tree

[master] / src / doc / poly1305.h / poly1305_init.3.md

% limb manual
% poly1305_init(3)
% limb 0.1.0
% 2023-07-24

# NAME

poly1305_init, poly1305_update, poly1305_final - compute Poly1305-based MAC
of a message

# SYNOPSIS

    #include <limb/poly1305.h>

```pre hl
void poly1305_init(const void *<em>key</em>, void *<em>ctx</em>)
void poly1305_update(const void *<em>msg</em>, size_t <em>mlen</em>, void *<em>ctx</em>)
void poly1305_final(void *<em>dst</em>, void *<em>ctx</em>)
```

# DESCRIPTION

The `poly1305_init`() function initializes the given poly1305 context `ctx` to
compute a Poly1305-based message authentication code.

This implementation is conform to [RFC 8439][rfc8439], as such the key pointed
to by `key` must be 256bit/32 bytes long.

[rfc8439]: https://datatracker.ietf.org/doc/html/rfc8439


The `poly1305_upate`() function feeds the specified chunk of data pointed by
`msg` of length `mlen` (in bytes) to be hashed into the given `ctx`. You can
call this function as many times as needed.

The `poly1305_final`() function stores the computed MAC from `ctx` in binary
form into `dst`, which must be able to store 16 bytes.

# SEE ALSO

[hmac](3), [ccpl_init](3)