From Emerald Madrill, 7 Months ago, written in C++.
Embed
  1. while ((count = read(fdin, buffer, sizeof(buffer))))
  2. {
  3.         rc = crypto_stream_xsalsa20_ref_xor(buffer2, buffer, sizeof(buffer), (void *)nonce, key);
  4.         rc = write(fdout, buffer2, count);
  5.         nonce[0]++;
  6. }