hmacSHA512 function

Uint8List hmacSHA512(
  1. Uint8List key,
  2. Uint8List data
)

This function calculates the HMAC-SHA-512 digest of a given key and data using HMAC (Hash-based Message Authentication Code). HMAC is a method for verifying both the data integrity and authenticity of a message.

Implementation

Uint8List hmacSHA512(Uint8List key, Uint8List data) {
  /// Create an HMAC instance with the SHA-512 hash algorithm and a 128-bit block size.
  final tmp = HMac(SHA512Digest(), 128);

  /// Initialize the HMAC instance with the provided key.
  tmp.init(KeyParameter(key));

  /// Calculate the HMAC-SHA-512 digest of the input data.
  return tmp.process(data);
}