hashStream static method
Computes a generic hash of specified length for given stream of byte values and optional key.
Implementation
static Future<Uint8List> hashStream(Stream<Uint8List> stream,
{Uint8List? key, int? outlen}) async {
outlen ??= Sodium.cryptoGenerichashBytes;
final state = Sodium.cryptoGenerichashInit(key, outlen);
try {
await for (var value in stream) {
Sodium.cryptoGenerichashUpdate(state, value);
}
return Sodium.cryptoGenerichashFinal(state, outlen);
} finally {
calloc.free(state);
}
}