cryptoGenerichash static method
Implementation
static Uint8List cryptoGenerichash(int outlen, Uint8List i, Uint8List? key) {
RangeError.checkValueInInterval(
outlen, cryptoGenerichashBytesMin, cryptoGenerichashBytesMax);
if (key != null) {
RangeError.checkValueInInterval(key.length, cryptoGenerichashKeybytesMin,
cryptoGenerichashKeybytesMax, 'key', 'Invalid length');
}
final _out = calloc<Uint8>(outlen);
final _in = i.toPointer();
final _key = key?.toPointer() ?? nullptr;
try {
_cryptoGenerichash
.crypto_generichash(
_out, outlen, _in, i.length, _key, key?.length ?? 0)
.mustSucceed('crypto_generichash');
return _out.toList(outlen);
} finally {
calloc.free(_out);
calloc.free(_in);
if (_key != nullptr) {
calloc.free(_key);
}
}
}