HMAC-SHA256 Hash Generator

Mainly Useful if you want to verify sensitive data like bank & payment gateway transactions. Takes value string and key value and output hash value in string. Below is the overall steps i am adding relevant code below for the same. Hope this helps. [Encrypt Widget.jpg] โ”„ Dependencies:- crypto: 3.0.2

// Begin custom action code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!

import 'dart:convert';
import 'package:crypto/crypto.dart';

Future encrypt(
  String? value1,
  String? value2,
) async {
  // Add your function code here!
  var key = utf8.encode(value1 ?? "");
  var bytes = utf8.encode(value2 ?? "");

  var hmacSha256 = Hmac(sha256, key); // HMAC-SHA256
  var digest = hmacSha256.convert(bytes);
  return digest.toString();
}
1