validChecksum function
Verify that the payload has not been corrupted by checking that the checksum is valid
Implementation
bool validChecksum(List<int> payload) {
final msgBuffer = Uint8List.fromList(payload).sublist(0, 34);
final checksumBuffer =
Uint8List.fromList(payload).sublist(34, payload.length);
// hash message (bytes 0-33)
final hashChecksumBuffer = createHash(msgBuffer).sublist(0, 4);
// verify checksum bytes match
return const ListEquality().equals(checksumBuffer, hashChecksumBuffer);
}