calculateNonce method

Future<Mac> calculateNonce({
  1. required SecretKey preNonce,
})

Implementation

Future<Mac> calculateNonce({
  required SecretKey preNonce,
}) async {
  // Создаем алгоритм HMAC-SHA-384
  final hmac = Hmac(Sha384());

  // Подготавливаем данные - объединяем контент и footer если он есть
  final dataToMac = <int>[...content];
  final footer = this.footer;
  if (footer != null) {
    dataToMac.addAll(footer);
  }

  // Вычисляем MAC
  final mac = await hmac.calculateMac(
    dataToMac,
    secretKey: preNonce,
  );

  return mac;
}