hex2bin static method
Implementation
static Uint8List hex2bin(String hex, {String? ignore = ': '}) {
final _bin = calloc<Uint8>(hex.length);
final _hex = hex.toNativeUtf8();
final _ignore = ignore == null ? nullptr : ignore.toNativeUtf8();
final _binlen = calloc<Uint8>(4);
try {
_sodium
.sodium_hex2bin(
_bin, hex.length, _hex, _hex.length, _ignore, _binlen, nullptr)
.mustSucceed('sodium_hex2bin');
final binlen =
_binlen.toList(4).buffer.asByteData().getUint32(0, Endian.host);
return _bin.toList(binlen);
} finally {
calloc.free(_bin);
calloc.free(_hex);
calloc.free(_ignore);
calloc.free(_binlen);
}
}