checksum static method

List<int> checksum(
  1. dynamic payload
)

Calculates the checksum of the given payload using the first 4 bytes of its SHA3-256 hash.

payload - A list of integers representing the payload to be hashed.

Implementation

static List<int> checksum(payload) {
  var k = SHA3(256, SHA3_PADDING, 256);
  k.update(payload);
  List<int> hash = k.digest();
  return hash.sublist(0, 4);
}