1 /*******************************************************************************
2 
3     D language bindings for libsodium's crypto_generichash_blake2b.h
4 
5     License: ISC (see LICENSE.txt)
6 
7 *******************************************************************************/
8 
9 module libsodium.crypto_generichash_blake2b;
10 
11 @nogc nothrow:
12 
13 import libsodium.export_;
14 
15 extern (C):
16 
17 align(64) struct crypto_generichash_blake2b_state
18 {
19     ubyte[384] opaque;
20 }
21 
22 enum crypto_generichash_blake2b_BYTES_MIN = 16U;
23 size_t crypto_generichash_blake2b_bytes_min ();
24 
25 enum crypto_generichash_blake2b_BYTES_MAX = 64U;
26 size_t crypto_generichash_blake2b_bytes_max ();
27 
28 enum crypto_generichash_blake2b_BYTES = 32U;
29 size_t crypto_generichash_blake2b_bytes ();
30 
31 enum crypto_generichash_blake2b_KEYBYTES_MIN = 16U;
32 size_t crypto_generichash_blake2b_keybytes_min ();
33 
34 enum crypto_generichash_blake2b_KEYBYTES_MAX = 64U;
35 size_t crypto_generichash_blake2b_keybytes_max ();
36 
37 enum crypto_generichash_blake2b_KEYBYTES = 32U;
38 size_t crypto_generichash_blake2b_keybytes ();
39 
40 enum crypto_generichash_blake2b_SALTBYTES = 16U;
41 size_t crypto_generichash_blake2b_saltbytes ();
42 
43 enum crypto_generichash_blake2b_PERSONALBYTES = 16U;
44 size_t crypto_generichash_blake2b_personalbytes ();
45 
46 size_t crypto_generichash_blake2b_statebytes ();
47 
48 int crypto_generichash_blake2b (
49     ubyte* out_,
50     size_t outlen,
51     const(ubyte)* in_,
52     ulong inlen,
53     const(ubyte)* key,
54     size_t keylen);
55 
56 int crypto_generichash_blake2b_salt_personal (
57     ubyte* out_,
58     size_t outlen,
59     const(ubyte)* in_,
60     ulong inlen,
61     const(ubyte)* key,
62     size_t keylen,
63     const(ubyte)* salt,
64     const(ubyte)* personal);
65 
66 int crypto_generichash_blake2b_init (
67     crypto_generichash_blake2b_state* state,
68     const(ubyte)* key,
69     const size_t keylen,
70     const size_t outlen);
71 
72 int crypto_generichash_blake2b_init_salt_personal (
73     crypto_generichash_blake2b_state* state,
74     const(ubyte)* key,
75     const size_t keylen,
76     const size_t outlen,
77     const(ubyte)* salt,
78     const(ubyte)* personal);
79 
80 int crypto_generichash_blake2b_update (
81     crypto_generichash_blake2b_state* state,
82     const(ubyte)* in_,
83     ulong inlen);
84 
85 int crypto_generichash_blake2b_final (
86     crypto_generichash_blake2b_state* state,
87     ubyte* out_,
88     const size_t outlen);
89 
90 void crypto_generichash_blake2b_keygen (
91     ref ubyte[crypto_generichash_blake2b_KEYBYTES] k);