1 /*******************************************************************************
2 
3     D language bindings for libsodium's crypto_pwhash_argon2i.h
4 
5     License: ISC (see LICENSE.txt)
6 
7 *******************************************************************************/
8 
9 module libsodium.crypto_pwhash_argon2i;
10 
11 @nogc nothrow:
12 
13 import libsodium.export_;
14 import core.stdc.stdint;
15 
16 extern (C):
17 
18 enum crypto_pwhash_argon2i_ALG_ARGON2I13 = 1;
19 int crypto_pwhash_argon2i_alg_argon2i13 ();
20 
21 enum crypto_pwhash_argon2i_BYTES_MIN = 16U;
22 size_t crypto_pwhash_argon2i_bytes_min ();
23 
24 enum crypto_pwhash_argon2i_BYTES_MAX = SODIUM_MIN(SODIUM_SIZE_MAX, 4294967295U);
25 size_t crypto_pwhash_argon2i_bytes_max ();
26 
27 enum crypto_pwhash_argon2i_PASSWD_MIN = 0U;
28 size_t crypto_pwhash_argon2i_passwd_min ();
29 
30 enum crypto_pwhash_argon2i_PASSWD_MAX = 4294967295U;
31 size_t crypto_pwhash_argon2i_passwd_max ();
32 
33 enum crypto_pwhash_argon2i_SALTBYTES = 16U;
34 size_t crypto_pwhash_argon2i_saltbytes ();
35 
36 enum crypto_pwhash_argon2i_STRBYTES = 128U;
37 size_t crypto_pwhash_argon2i_strbytes ();
38 
39 enum crypto_pwhash_argon2i_STRPREFIX = "$argon2i$";
40 const(char)* crypto_pwhash_argon2i_strprefix ();
41 
42 enum crypto_pwhash_argon2i_OPSLIMIT_MIN = 3U;
43 size_t crypto_pwhash_argon2i_opslimit_min ();
44 
45 enum crypto_pwhash_argon2i_OPSLIMIT_MAX = 4294967295U;
46 size_t crypto_pwhash_argon2i_opslimit_max ();
47 
48 enum crypto_pwhash_argon2i_MEMLIMIT_MIN = 8192U;
49 size_t crypto_pwhash_argon2i_memlimit_min ();
50 
51 enum crypto_pwhash_argon2i_MEMLIMIT_MAX = (SIZE_MAX >= 4398046510080U) ? 4398046510080U : (SIZE_MAX >= 2147483648U) ? 2147483648U : 32768U;
52 size_t crypto_pwhash_argon2i_memlimit_max ();
53 
54 enum crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE = 4U;
55 size_t crypto_pwhash_argon2i_opslimit_interactive ();
56 
57 enum crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE = 33554432U;
58 size_t crypto_pwhash_argon2i_memlimit_interactive ();
59 
60 enum crypto_pwhash_argon2i_OPSLIMIT_MODERATE = 6U;
61 size_t crypto_pwhash_argon2i_opslimit_moderate ();
62 
63 enum crypto_pwhash_argon2i_MEMLIMIT_MODERATE = 134217728U;
64 size_t crypto_pwhash_argon2i_memlimit_moderate ();
65 
66 enum crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE = 8U;
67 size_t crypto_pwhash_argon2i_opslimit_sensitive ();
68 
69 enum crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE = 536870912U;
70 size_t crypto_pwhash_argon2i_memlimit_sensitive ();
71 
72 int crypto_pwhash_argon2i (
73     ubyte* out_,
74     ulong outlen,
75     const char* passwd,
76     ulong passwdlen,
77     const ubyte* salt,
78     ulong opslimit,
79     size_t memlimit,
80     int alg);
81 
82 int crypto_pwhash_argon2i_str (
83     ref char[crypto_pwhash_argon2i_STRBYTES] out_,
84     const char* passwd,
85     ulong passwdlen,
86     ulong opslimit,
87     size_t memlimit);
88 
89 int crypto_pwhash_argon2i_str_verify (
90     ref const(char)[crypto_pwhash_argon2i_STRBYTES] str,
91     const char* passwd,
92     ulong passwdlen);
93 
94 int crypto_pwhash_argon2i_str_needs_rehash (
95     ref const(char)[crypto_pwhash_argon2i_STRBYTES] str,
96     ulong opslimit,
97     size_t memlimit);