crypto_secretbox_open static method

int crypto_secretbox_open(
  1. Uint8List m,
  2. Uint8List c,
  3. int d,
  4. Uint8List n,
  5. Uint8List k,
)

Implementation

static int crypto_secretbox_open(
    Uint8List m, Uint8List c, int d, Uint8List n, Uint8List k) {
  int i;
  Uint8List x = Uint8List(32);
  if (d < 32) return -1;
  crypto_stream(x, 0, 32, n, k);
  if (_crypto_onetimeauth_verify(c, 16, c, 32, d - 32, x) != 0) return -1;
  crypto_stream_xor(m, 0, c, 0, d, n, k);

  ///for (i = 0; i < 32; i++) m[i] = 0;
  return 0;
}