hash256ToHex static method

String hash256ToHex(
  1. String input
)

This method takes a string input, converts it to bytes using UTF-8 encoding, computes the SHA3-256 hash of the bytes, and returns the hash value as a hexadecimal string.

Implementation

static String hash256ToHex(String input) {
  List<int> bytes = utf8.encode(input);
  String hexVersion = hex.encode(bytes);
  var k = SHA3(256, SHA3_PADDING, 256);
  k.update(bytes);
  var hash = k.digest();
  hexVersion = HEX.encode(hash);
  return hexVersion;
}