1 /*******************************************************************************
2 
3     D language bindings for libsodium's crypto_auth_hmacsha256.h
4 
5     License: ISC (see LICENSE.txt)
6 
7 *******************************************************************************/
8 
9 module libsodium.crypto_auth_hmacsha256;
10 
11 @nogc nothrow:
12 
13 import libsodium.export_;
14 import libsodium.crypto_hash_sha256;
15 
16 extern (C):
17 
18 enum crypto_auth_hmacsha256_BYTES = 32U;
19 size_t crypto_auth_hmacsha256_bytes ();
20 
21 enum crypto_auth_hmacsha256_KEYBYTES = 32U;
22 size_t crypto_auth_hmacsha256_keybytes ();
23 
24 int crypto_auth_hmacsha256 (
25     ubyte* out_,
26     const(ubyte)* in_,
27     ulong inlen,
28     const(ubyte)* k);
29 
30 int crypto_auth_hmacsha256_verify (
31     const(ubyte)* h,
32     const(ubyte)* in_,
33     ulong inlen,
34     const(ubyte)* k);
35 
36 /* ------------------------------------------------------------------------- */
37 
38 struct crypto_auth_hmacsha256_state
39 {
40     crypto_hash_sha256_state ictx;
41     crypto_hash_sha256_state octx;
42 }
43 
44 size_t crypto_auth_hmacsha256_statebytes ();
45 
46 int crypto_auth_hmacsha256_init (
47     crypto_auth_hmacsha256_state* state,
48     const(ubyte)* key,
49     size_t keylen);
50 
51 int crypto_auth_hmacsha256_update (
52     crypto_auth_hmacsha256_state* state,
53     const(ubyte)* in_,
54     ulong inlen);
55 
56 int crypto_auth_hmacsha256_final (
57     crypto_auth_hmacsha256_state* state,
58     ubyte* out_);
59 
60 void crypto_auth_hmacsha256_keygen (
61     ref ubyte[crypto_auth_hmacsha256_KEYBYTES] k);