cryptoSecretboxOpen static method

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

Implementation

static int cryptoSecretboxOpen(
    Uint8List m, Uint8List c, int d, Uint8List n, Uint8List k) {
  Uint8List x = Uint8List(32);
  if (d < 32) return -1;
  cryptoStream(x, 0, 32, n, k);
  if (_cryptoOnetimeauthVerify(c, 16, c, 32, d - 32, x) != 0) return -1;
  cryptoStreamXor(m, 0, c, 0, d, n, k);

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