cryptoAuth static method

Uint8List cryptoAuth(
  1. Uint8List i,
  2. Uint8List k
)

Implementation

static Uint8List cryptoAuth(Uint8List i, Uint8List k) {
  RangeError.checkValueInInterval(k.length, cryptoAuthKeybytes,
      cryptoAuthKeybytes, 'k', 'Invalid length');

  final _out = calloc<Uint8>(cryptoAuthBytes);
  final _in = i.toPointer();
  final _k = k.toPointer();

  try {
    _cryptoAuth
        .crypto_auth(_out, _in, i.length, _k)
        .mustSucceed('crypto_auth');

    return _out.toList(cryptoAuthBytes);
  } finally {
    calloc.free(_out);
    calloc.free(_in);
    calloc.free(_k);
  }
}