cryptoStream static method

Uint8List cryptoStream(
  1. int clen,
  2. Uint8List n,
  3. Uint8List k
)

Implementation

static Uint8List cryptoStream(int clen, Uint8List n, Uint8List k) {
  RangeError.checkValueInInterval(n.length, cryptoStreamNoncebytes,
      cryptoStreamNoncebytes, 'n', 'Invalid length');
  RangeError.checkValueInInterval(k.length, cryptoStreamKeybytes,
      cryptoStreamKeybytes, 'k', 'Invalid length');

  final _c = calloc<Uint8>(clen);
  final _n = n.toPointer();
  final _k = k.toPointer();
  try {
    _cryptoStream
        .crypto_stream(_c, clen, _n, _k)
        .mustSucceed('crypto_stream');
    return _c.toList(clen);
  } finally {
    calloc.free(_c);
    calloc.free(_n);
    calloc.free(_k);
  }
}