1 /*
2 Written in the D programming language.
3 For git maintenance (ensure at least one congruent line with originating C header):
4 #define crypto_generichash_blake2b_H
5 */
6 
7 module deimos.sodium.crypto_generichash_blake2b;
8 
9 
10 extern(C) @nogc :
11 
12 version(bin_v1_0_16)
13     align(64) struct crypto_generichash_blake2b_state {
14       align(1) :
15 
16         ulong[8] h;
17         ulong[2] t;
18         ulong[2] f;
19         ubyte[2 * 128] buf;
20         size_t buflen;
21         ubyte last_node;
22     }
23 else
24     align(64) struct crypto_generichash_blake2b_state {
25       ubyte[384] opaque;
26     }
27 
28 enum crypto_generichash_blake2b_BYTES_MIN     = 16U;
29 
30 size_t crypto_generichash_blake2b_bytes_min() pure @trusted;
31 
32 enum crypto_generichash_blake2b_BYTES_MAX     = 64U;
33 
34 size_t crypto_generichash_blake2b_bytes_max() pure @trusted;
35 
36 enum crypto_generichash_blake2b_BYTES         = 32U;
37 
38 size_t crypto_generichash_blake2b_bytes() pure @trusted;
39 
40 enum crypto_generichash_blake2b_KEYBYTES_MIN  = 16U;
41 
42 size_t crypto_generichash_blake2b_keybytes_min() pure @trusted;
43 
44 enum crypto_generichash_blake2b_KEYBYTES_MAX  = 64U;
45 
46 size_t crypto_generichash_blake2b_keybytes_max() pure @trusted;
47 
48 enum crypto_generichash_blake2b_KEYBYTES      = 32U;
49 
50 size_t crypto_generichash_blake2b_keybytes() pure @trusted;
51 
52 enum crypto_generichash_blake2b_SALTBYTES     = 16U;
53 
54 size_t crypto_generichash_blake2b_saltbytes() pure @trusted;
55 
56 enum crypto_generichash_blake2b_PERSONALBYTES = 16U;
57 
58 size_t crypto_generichash_blake2b_personalbytes() pure @trusted;
59 
60 size_t crypto_generichash_blake2b_statebytes() pure @trusted;
61 
62 int crypto_generichash_blake2b(ubyte* out_, size_t outlen,
63                                const(ubyte)*in_,
64                                ulong inlen,
65                                const(ubyte)* key, size_t keylen) pure; // __attribute__ ((nonnull(1)));
66 
67 int crypto_generichash_blake2b_salt_personal(ubyte* out_, size_t outlen,
68                                              const(ubyte)* in_,
69                                              ulong inlen,
70                                              const(ubyte)* key,
71                                              size_t keylen,
72                                              const(ubyte)* salt,
73                                              const(ubyte)* personal) pure; // __attribute__ ((nonnull(1)));
74 
75 int crypto_generichash_blake2b_init(crypto_generichash_blake2b_state* state,
76                                     const(ubyte)* key,
77                                     const size_t keylen, const size_t outlen) pure; // __attribute__ ((nonnull(1)));
78 
79 int crypto_generichash_blake2b_init_salt_personal(crypto_generichash_blake2b_state* state,
80                                                   const(ubyte)* key,
81                                                   const size_t keylen, const size_t outlen,
82                                                   const(ubyte)* salt,
83                                                   const(ubyte)* personal) pure; // __attribute__ ((nonnull(1)));
84 
85 int crypto_generichash_blake2b_update(crypto_generichash_blake2b_state* state,
86                                       const(ubyte)* in_,
87                                       ulong inlen) pure; // __attribute__ ((nonnull(1)));
88 
89 int crypto_generichash_blake2b_final(crypto_generichash_blake2b_state* state,
90                                      ubyte* out_,
91                                      const size_t outlen) pure; // __attribute__ ((nonnull));
92 
93 void crypto_generichash_blake2b_keygen(ref ubyte[crypto_generichash_blake2b_KEYBYTES] k) nothrow @trusted; // __attribute__ ((nonnull));