1 #ifndef crypto_pwhash_scryptsalsa208sha256_H
2 #define crypto_pwhash_scryptsalsa208sha256_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_scryptsalsa208sha256_BYTES_MIN 16U
18 SODIUM_EXPORT
19 size_t crypto_pwhash_scryptsalsa208sha256_bytes_min(void);
20 
21 #define crypto_pwhash_scryptsalsa208sha256_BYTES_MAX \
22     SODIUM_MIN(SODIUM_SIZE_MAX, 0x1fffffffe0ULL)
23 SODIUM_EXPORT
24 size_t crypto_pwhash_scryptsalsa208sha256_bytes_max(void);
25 
26 #define crypto_pwhash_scryptsalsa208sha256_PASSWD_MIN 0U
27 SODIUM_EXPORT
28 size_t crypto_pwhash_scryptsalsa208sha256_passwd_min(void);
29 
30 #define crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX SODIUM_SIZE_MAX
31 SODIUM_EXPORT
32 size_t crypto_pwhash_scryptsalsa208sha256_passwd_max(void);
33 
34 #define crypto_pwhash_scryptsalsa208sha256_SALTBYTES 32U
35 SODIUM_EXPORT
36 size_t crypto_pwhash_scryptsalsa208sha256_saltbytes(void);
37 
38 #define crypto_pwhash_scryptsalsa208sha256_STRBYTES 102U
39 SODIUM_EXPORT
40 size_t crypto_pwhash_scryptsalsa208sha256_strbytes(void);
41 
42 #define crypto_pwhash_scryptsalsa208sha256_STRPREFIX "$7$"
43 SODIUM_EXPORT
44 const char *crypto_pwhash_scryptsalsa208sha256_strprefix(void);
45 
46 #define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN 32768U
47 SODIUM_EXPORT
48 size_t crypto_pwhash_scryptsalsa208sha256_opslimit_min(void);
49 
50 #define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MAX 4294967295U
51 SODIUM_EXPORT
52 size_t crypto_pwhash_scryptsalsa208sha256_opslimit_max(void);
53 
54 #define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN 16777216U
55 SODIUM_EXPORT
56 size_t crypto_pwhash_scryptsalsa208sha256_memlimit_min(void);
57 
58 #define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX \
59     SODIUM_MIN(SIZE_MAX, 68719476736ULL)
60 SODIUM_EXPORT
61 size_t crypto_pwhash_scryptsalsa208sha256_memlimit_max(void);
62 
63 #define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE 524288U
64 SODIUM_EXPORT
65 size_t crypto_pwhash_scryptsalsa208sha256_opslimit_interactive(void);
66 
67 #define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE 16777216U
68 SODIUM_EXPORT
69 size_t crypto_pwhash_scryptsalsa208sha256_memlimit_interactive(void);
70 
71 #define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE 33554432U
72 SODIUM_EXPORT
73 size_t crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive(void);
74 
75 #define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE 1073741824U
76 SODIUM_EXPORT
77 size_t crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive(void);
78 
79 SODIUM_EXPORT
80 int crypto_pwhash_scryptsalsa208sha256(unsigned char * const out,
81                                        unsigned long long outlen,
82                                        const char * const passwd,
83                                        unsigned long long passwdlen,
84                                        const unsigned char * const salt,
85                                        unsigned long long opslimit,
86                                        size_t memlimit)
87             __attribute__ ((warn_unused_result));
88 
89 SODIUM_EXPORT
90 int crypto_pwhash_scryptsalsa208sha256_str(char out[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
91                                            const char * const passwd,
92                                            unsigned long long passwdlen,
93                                            unsigned long long opslimit,
94                                            size_t memlimit)
95             __attribute__ ((warn_unused_result));
96 
97 SODIUM_EXPORT
98 int crypto_pwhash_scryptsalsa208sha256_str_verify(const char str[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
99                                                   const char * const passwd,
100                                                   unsigned long long passwdlen)
101             __attribute__ ((warn_unused_result));
102 
103 SODIUM_EXPORT
104 int crypto_pwhash_scryptsalsa208sha256_ll(const uint8_t * passwd, size_t passwdlen,
105                                           const uint8_t * salt, size_t saltlen,
106                                           uint64_t N, uint32_t r, uint32_t p,
107                                           uint8_t * buf, size_t buflen)
108             __attribute__ ((warn_unused_result));
109 
110 SODIUM_EXPORT
111 int crypto_pwhash_scryptsalsa208sha256_str_needs_rehash(const char str[crypto_pwhash_scryptsalsa208sha256_STRBYTES],
112                                                         unsigned long long opslimit,
113                                                         size_t memlimit)
114             __attribute__ ((warn_unused_result));
115 
116 #ifdef __cplusplus
117 }
118 #endif
119 
120 #endif
121