1 #ifndef crypto_pwhash_argon2i_H
2 #define crypto_pwhash_argon2i_H
3 
4 #include <limits.h>
5 #include <stddef.h>
6 #include <stdint.h>
7 
8 #include "export.h"
9 
10 #ifdef __cplusplus
11 # ifdef __GNUC__
12 #  pragma GCC diagnostic ignored "-Wlong-long"
13 # endif
14 extern "C" {
15 #endif
16 
17 #define crypto_pwhash_argon2i_ALG_ARGON2I13 1
18 SODIUM_EXPORT
19 int crypto_pwhash_argon2i_alg_argon2i13(void);
20 
21 #define crypto_pwhash_argon2i_BYTES_MIN 16U
22 SODIUM_EXPORT
23 size_t crypto_pwhash_argon2i_bytes_min(void);
24 
25 #define crypto_pwhash_argon2i_BYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX, 4294967295U)
26 SODIUM_EXPORT
27 size_t crypto_pwhash_argon2i_bytes_max(void);
28 
29 #define crypto_pwhash_argon2i_PASSWD_MIN 0U
30 SODIUM_EXPORT
31 size_t crypto_pwhash_argon2i_passwd_min(void);
32 
33 #define crypto_pwhash_argon2i_PASSWD_MAX 4294967295U
34 SODIUM_EXPORT
35 size_t crypto_pwhash_argon2i_passwd_max(void);
36 
37 #define crypto_pwhash_argon2i_SALTBYTES 16U
38 SODIUM_EXPORT
39 size_t crypto_pwhash_argon2i_saltbytes(void);
40 
41 #define crypto_pwhash_argon2i_STRBYTES 128U
42 SODIUM_EXPORT
43 size_t crypto_pwhash_argon2i_strbytes(void);
44 
45 #define crypto_pwhash_argon2i_STRPREFIX "$argon2i$"
46 SODIUM_EXPORT
47 const char *crypto_pwhash_argon2i_strprefix(void);
48 
49 #define crypto_pwhash_argon2i_OPSLIMIT_MIN 3U
50 SODIUM_EXPORT
51 size_t crypto_pwhash_argon2i_opslimit_min(void);
52 
53 #define crypto_pwhash_argon2i_OPSLIMIT_MAX 4294967295U
54 SODIUM_EXPORT
55 size_t crypto_pwhash_argon2i_opslimit_max(void);
56 
57 #define crypto_pwhash_argon2i_MEMLIMIT_MIN 8192U
58 SODIUM_EXPORT
59 size_t crypto_pwhash_argon2i_memlimit_min(void);
60 
61 #define crypto_pwhash_argon2i_MEMLIMIT_MAX \
62     ((SIZE_MAX >= 4398046510080U) ? 4398046510080U : (SIZE_MAX >= 2147483648U) ? 2147483648U : 32768U)
63 SODIUM_EXPORT
64 size_t crypto_pwhash_argon2i_memlimit_max(void);
65 
66 #define crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE 4U
67 SODIUM_EXPORT
68 size_t crypto_pwhash_argon2i_opslimit_interactive(void);
69 
70 #define crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE 33554432U
71 SODIUM_EXPORT
72 size_t crypto_pwhash_argon2i_memlimit_interactive(void);
73 
74 #define crypto_pwhash_argon2i_OPSLIMIT_MODERATE 6U
75 SODIUM_EXPORT
76 size_t crypto_pwhash_argon2i_opslimit_moderate(void);
77 
78 #define crypto_pwhash_argon2i_MEMLIMIT_MODERATE 134217728U
79 SODIUM_EXPORT
80 size_t crypto_pwhash_argon2i_memlimit_moderate(void);
81 
82 #define crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE 8U
83 SODIUM_EXPORT
84 size_t crypto_pwhash_argon2i_opslimit_sensitive(void);
85 
86 #define crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE 536870912U
87 SODIUM_EXPORT
88 size_t crypto_pwhash_argon2i_memlimit_sensitive(void);
89 
90 SODIUM_EXPORT
91 int crypto_pwhash_argon2i(unsigned char * const out,
92                           unsigned long long outlen,
93                           const char * const passwd,
94                           unsigned long long passwdlen,
95                           const unsigned char * const salt,
96                           unsigned long long opslimit, size_t memlimit,
97                           int alg)
98             __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
99 
100 SODIUM_EXPORT
101 int crypto_pwhash_argon2i_str(char out[crypto_pwhash_argon2i_STRBYTES],
102                               const char * const passwd,
103                               unsigned long long passwdlen,
104                               unsigned long long opslimit, size_t memlimit)
105             __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
106 
107 SODIUM_EXPORT
108 int crypto_pwhash_argon2i_str_verify(const char str[crypto_pwhash_argon2i_STRBYTES],
109                                      const char * const passwd,
110                                      unsigned long long passwdlen)
111             __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
112 
113 SODIUM_EXPORT
114 int crypto_pwhash_argon2i_str_needs_rehash(const char str[crypto_pwhash_argon2i_STRBYTES],
115                                            unsigned long long opslimit, size_t memlimit)
116             __attribute__ ((warn_unused_result))  __attribute__ ((nonnull));
117 
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 #endif
123