A
prepares a message, add an authentication tag, sends it to B
A
doesn't store the messageB
sends the message and the authentication tag to A
A
uses the authentication tag to verify that it created this message.crypto_auth()
function computes a tag for the message in
, whose length is inlen
bytes, and the key k
. k
should be crypto_auth_KEYBYTES
bytes. The function puts the tag into out
. The tag is crypto_auth_BYTES
bytes long.crypto_auth_verify()
function verifies that the tag stored at h
is a valid tag for the message in
whose length is inlen
bytes, and the key k
.-1
if the verification fails, and 0
if it passes.k
.randombytes_buf()
but improves code clarity and can prevent misuse by ensuring that the provided key length is always be correct.crypto_auth_BYTES
crypto_auth_KEYBYTES