computeDiscriminator function

Future<List<int>> computeDiscriminator(
  1. String namespace,
  2. String name
)

Implementation

Future<List<int>> computeDiscriminator(String namespace, String name) async {
  final identifier = '$namespace:$name';
  final hash = await _sha256.hash(identifier.codeUnits);
  final hashBytes = hash.bytes;

  return hashBytes.sublist(0, 8);
}