while ((count = read(fdin, buffer, sizeof(buffer)))) { rc = crypto_stream_xsalsa20_ref_xor(buffer2, buffer, sizeof(buffer), (void *)nonce, key); rc = write(fdout, buffer2, count); nonce[0]++; }