cryptoSecretstreamXchacha20poly1305Pull static method

PullResult cryptoSecretstreamXchacha20poly1305Pull(
  1. Pointer<Uint8> state,
  2. Uint8List c,
  3. Uint8List? ad
)

Implementation

static PullResult cryptoSecretstreamXchacha20poly1305Pull(
    Pointer<Uint8> state, Uint8List c, Uint8List? ad) {
  final _m =
      calloc<Uint8>(c.length - cryptoSecretstreamXchacha20poly1305Abytes);
  final _mlenP = calloc<Uint64>(1);
  final _tagP = calloc<Uint8>(1);
  final _c = c.toPointer();
  final _ad = ad?.toPointer() ?? nullptr;
  final _adlen = ad?.length ?? 0;
  try {
    _cryptoSecretStream
        .crypto_secretstream_xchacha20poly1305_pull(
          state,
          _m,
          _mlenP,
          _tagP,
          _c,
          c.length,
          _ad,
          _adlen,
        )
        .mustSucceed('crypto_secretstream_xchacha20poly1305_pull');

    return PullResult(m: _m.toList(_mlenP[0]), tag: _tagP[0]);
  } finally {
    calloc.free(_m);
    calloc.free(_mlenP);
    calloc.free(_tagP);
    calloc.free(_c);
    calloc.free(_ad);
  }
}