blake2bHash static method

BuBytes blake2bHash(
  1. List<int>? data,
  2. int digestSize, {
  3. List<int>? key,
  4. List<int>? salt,
  5. List<int>? personalization,
  6. List<List<int>> batch = const [],
})

Implementation

static BuBytes blake2bHash(
  List<int>? data,
  int digestSize, {
  List<int>? key,
  List<int>? salt,
  List<int>? personalization,
  List<List<int>> batch = const [],
}) {
  final config = Blake2Config.blake2b(
    key: key,
    salt: salt,
    personalization: personalization,
  );
  final b = blockchainUtils.api.hash.blake2b(
    digestLength: digestSize,
    config: config,
  );
  try {
    if (data != null) {
      b.update(data);
    }
    for (final i in batch) {
      b.update(i);
    }
    return b.digest().asBytes;
  } finally {
    b.clean();
  }
}