poly1305auth function
Computes the Poly1305 MAC (message authentication code) of the given
message
using the given the 16 or 32-byte long keypair
for authentication.
Parameters:
message
is a variable-length list of byteskeypair
is required and must contain exactly 16 or 32 bytes.
If keypair
length is 16 bytes, the final digest will not be signed.
Warning: The algorithm is designed to ensure unforgeability of a message with a random key. Authenticating multiple messages using the same key could allow for forgeries.
Example usage:
final keypair = randomBytes(32);
print('TAG(signed): ${poly1305auth(message, keypair)}');
Implementation
@pragma('vm:prefer-inline')
HashDigest poly1305auth(List<int> message, List<int> keypair) =>
poly1305.by(keypair).convert(message);