1 /*******************************************************************************
2 
3     D language bindings for libsodium's crypto_pwhash_argon2id.h
4 
5     License: ISC (see LICENSE.txt)
6 
7 *******************************************************************************/
8 
9 module libsodium.crypto_pwhash_argon2id;
10 
11 @nogc nothrow:
12 
13 import libsodium.export_;
14 import core.stdc.stdint;
15 
16 extern (C):
17 
18 enum crypto_pwhash_argon2id_ALG_ARGON2ID13 = 2;
19 int crypto_pwhash_argon2id_alg_argon2id13 ();
20 
21 enum crypto_pwhash_argon2id_BYTES_MIN = 16U;
22 size_t crypto_pwhash_argon2id_bytes_min ();
23 
24 enum crypto_pwhash_argon2id_BYTES_MAX = SODIUM_MIN(SODIUM_SIZE_MAX, 4294967295U);
25 size_t crypto_pwhash_argon2id_bytes_max ();
26 
27 enum crypto_pwhash_argon2id_PASSWD_MIN = 0U;
28 size_t crypto_pwhash_argon2id_passwd_min ();
29 
30 enum crypto_pwhash_argon2id_PASSWD_MAX = 4294967295U;
31 size_t crypto_pwhash_argon2id_passwd_max ();
32 
33 enum crypto_pwhash_argon2id_SALTBYTES = 16U;
34 size_t crypto_pwhash_argon2id_saltbytes ();
35 
36 enum crypto_pwhash_argon2id_STRBYTES = 128U;
37 size_t crypto_pwhash_argon2id_strbytes ();
38 
39 enum crypto_pwhash_argon2id_STRPREFIX = "$argon2id$";
40 const(char)* crypto_pwhash_argon2id_strprefix ();
41 
42 enum crypto_pwhash_argon2id_OPSLIMIT_MIN = 1U;
43 size_t crypto_pwhash_argon2id_opslimit_min ();
44 
45 enum crypto_pwhash_argon2id_OPSLIMIT_MAX = 4294967295U;
46 size_t crypto_pwhash_argon2id_opslimit_max ();
47 
48 enum crypto_pwhash_argon2id_MEMLIMIT_MIN = 8192U;
49 size_t crypto_pwhash_argon2id_memlimit_min ();
50 
51 enum crypto_pwhash_argon2id_MEMLIMIT_MAX = (SIZE_MAX >= 4398046510080U) ? 4398046510080U : (SIZE_MAX >= 2147483648U) ? 2147483648U : 32768U;
52 size_t crypto_pwhash_argon2id_memlimit_max ();
53 
54 enum crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE = 2U;
55 size_t crypto_pwhash_argon2id_opslimit_interactive ();
56 
57 enum crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE = 67108864U;
58 size_t crypto_pwhash_argon2id_memlimit_interactive ();
59 
60 enum crypto_pwhash_argon2id_OPSLIMIT_MODERATE = 3U;
61 size_t crypto_pwhash_argon2id_opslimit_moderate ();
62 
63 enum crypto_pwhash_argon2id_MEMLIMIT_MODERATE = 268435456U;
64 size_t crypto_pwhash_argon2id_memlimit_moderate ();
65 
66 enum crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE = 4U;
67 size_t crypto_pwhash_argon2id_opslimit_sensitive ();
68 
69 enum crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE = 1073741824U;
70 size_t crypto_pwhash_argon2id_memlimit_sensitive ();
71 
72 int crypto_pwhash_argon2id (
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_argon2id_str (
83     ref char[crypto_pwhash_argon2id_STRBYTES] out_,
84     const char* passwd,
85     ulong passwdlen,
86     ulong opslimit,
87     size_t memlimit);
88 
89 int crypto_pwhash_argon2id_str_verify (
90     ref const(char)[crypto_pwhash_argon2id_STRBYTES] str,
91     const char* passwd,
92     ulong passwdlen);
93 
94 int crypto_pwhash_argon2id_str_needs_rehash (
95     ref const(char)[crypto_pwhash_argon2id_STRBYTES] str,
96     ulong opslimit,
97     size_t memlimit);