auth static method

List<int> auth(
  1. List<int> key,
  2. List<int> data
)

Computes a Poly1305 authentication code (MAC) for the provided data using the given key.

This static method simplifies the process of generating a Poly1305 authentication code (MAC) for a specific data set and key.

Parameters:

  • key: A List<int> representing the key used for Poly1305 authentication.
  • data: A List<int> containing the data to be authenticated.

Returns: A List<int> containing the computed Poly1305 authentication code (MAC).

This method creates a Poly1305 instance initialized with the provided key, updates it with the data, computes the MAC, and then cleans up the instance before returning the MAC.

Implementation

static List<int> auth(List<int> key, List<int> data) {
  final Poly1305 h = Poly1305(key);
  h.update(data);
  final List<int> digest = h.digest();
  h.clean();
  return digest;
}