Poly1305.aead_encrypt

You're seeing just the function aead_encrypt, go back to Poly1305 module for more information.
Link to this function

aead_encrypt(m, k, n, a \\ "")

View Source

Specs

aead_encrypt(binary(), key(), nonce(), binary()) :: {binary(), tag()}

authenticated encryption with additional data - encryption

  • message to be encrypted
  • shared secret key
  • one-time use nonce
  • additional authenticated data

The return value will be a tuple of {ciphertext, MAC}

The algorithm is applied as described in RFC7539:

  • The key and nonce are used to encrypt the message with ChaCha20.
  • The one-time MAC key is derived from the cipher key and nonce.
  • The ciphertext and additional data are authenticated with the MAC