1 /*******************************************************************************
2 
3     D language bindings for libsodium's crypto_stream_xsalsa20.h
4 
5     License: ISC (see LICENSE.txt)
6 
7 *******************************************************************************/
8 
9 module libsodium.crypto_stream_xsalsa20;
10 
11 @nogc nothrow:
12 
13 import libsodium.export_;
14 
15 extern (C):
16 
17 /*
18  *  WARNING: This is just a stream cipher. It is NOT authenticated encryption.
19  *  While it provides some protection against eavesdropping, it does NOT
20  *  provide any security against active attacks.
21  *  Unless you know what you're doing, what you are looking for is probably
22  *  the crypto_box functions.
23  */
24 
25 enum crypto_stream_xsalsa20_KEYBYTES = 32U;
26 size_t crypto_stream_xsalsa20_keybytes ();
27 
28 enum crypto_stream_xsalsa20_NONCEBYTES = 24U;
29 size_t crypto_stream_xsalsa20_noncebytes ();
30 
31 enum crypto_stream_xsalsa20_MESSAGEBYTES_MAX = SODIUM_SIZE_MAX;
32 size_t crypto_stream_xsalsa20_messagebytes_max ();
33 
34 int crypto_stream_xsalsa20 (
35     ubyte* c,
36     ulong clen,
37     const(ubyte)* n,
38     const(ubyte)* k);
39 
40 int crypto_stream_xsalsa20_xor (
41     ubyte* c,
42     const(ubyte)* m,
43     ulong mlen,
44     const(ubyte)* n,
45     const(ubyte)* k);
46 
47 int crypto_stream_xsalsa20_xor_ic (
48     ubyte* c,
49     const(ubyte)* m,
50     ulong mlen,
51     const(ubyte)* n,
52     ulong ic,
53     const(ubyte)* k);
54 
55 void crypto_stream_xsalsa20_keygen (
56     ref ubyte[crypto_stream_xsalsa20_KEYBYTES] k);