hashOf static method

String hashOf(
  1. JsonMap row
)

The hash of row: SHA-256 over its fields without hash, in a fixed key order, after its prev_hash.

Implementation

static String hashOf(JsonMap row) {
  final fields = Map.fromEntries(
    row.entries.where((e) => e.key != 'hash').toList()
      ..sort((a, b) => a.key.compareTo(b.key)),
  );
  return sha256.convert(utf8.encode(jsonEncode(fields))).toString();
}