calculateMac function

Uint8List calculateMac(
  1. Uint8List key,
  2. Uint8List nonce,
  3. Uint8List ciphertext
)

Implementation

Uint8List calculateMac(Uint8List key, Uint8List nonce, Uint8List ciphertext) {
  var hmacSha256 = crypto.Hmac(crypto.sha256, key);
  var mac = hmacSha256.convert([...nonce, ...ciphertext]).bytes;
  return Uint8List.fromList(mac);
}