diff options
Diffstat (limited to 'toxencryptsave/crypto_pwhash_scryptsalsa208sha256/crypto_pwhash_scryptsalsa208sha256.h')
-rw-r--r-- | toxencryptsave/crypto_pwhash_scryptsalsa208sha256/crypto_pwhash_scryptsalsa208sha256.h | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/toxencryptsave/crypto_pwhash_scryptsalsa208sha256/crypto_pwhash_scryptsalsa208sha256.h b/toxencryptsave/crypto_pwhash_scryptsalsa208sha256/crypto_pwhash_scryptsalsa208sha256.h new file mode 100644 index 00000000..5cb32f8d --- /dev/null +++ b/toxencryptsave/crypto_pwhash_scryptsalsa208sha256/crypto_pwhash_scryptsalsa208sha256.h | |||
@@ -0,0 +1,92 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | #include "config.h" | ||
3 | #endif | ||
4 | #ifdef VANILLA_NACL /* toxcore only uses this when libsodium is unavailable */ | ||
5 | |||
6 | #ifndef crypto_pwhash_scryptsalsa208sha256_H | ||
7 | #define crypto_pwhash_scryptsalsa208sha256_H | ||
8 | |||
9 | #include <stddef.h> | ||
10 | #include <stdint.h> | ||
11 | |||
12 | #include "export.h" | ||
13 | |||
14 | #ifdef __cplusplus | ||
15 | # if __GNUC__ | ||
16 | # pragma GCC diagnostic ignored "-Wlong-long" | ||
17 | # endif | ||
18 | extern "C" { | ||
19 | #endif | ||
20 | |||
21 | #define crypto_pwhash_scryptsalsa208sha256_SALTBYTES 32U | ||
22 | SODIUM_EXPORT | ||
23 | size_t crypto_pwhash_scryptsalsa208sha256_saltbytes(void); | ||
24 | |||
25 | #define crypto_pwhash_scryptsalsa208sha256_STRBYTES 102U | ||
26 | SODIUM_EXPORT | ||
27 | size_t crypto_pwhash_scryptsalsa208sha256_strbytes(void); | ||
28 | |||
29 | #define crypto_pwhash_scryptsalsa208sha256_STRPREFIX "$7$" | ||
30 | SODIUM_EXPORT | ||
31 | const char *crypto_pwhash_scryptsalsa208sha256_strprefix(void); | ||
32 | |||
33 | #define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE 524288ULL | ||
34 | SODIUM_EXPORT | ||
35 | size_t crypto_pwhash_scryptsalsa208sha256_opslimit_interactive(void); | ||
36 | |||
37 | #define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE 16777216ULL | ||
38 | SODIUM_EXPORT | ||
39 | size_t crypto_pwhash_scryptsalsa208sha256_memlimit_interactive(void); | ||
40 | |||
41 | #define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE 33554432ULL | ||
42 | SODIUM_EXPORT | ||
43 | size_t crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive(void); | ||
44 | |||
45 | #define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE 1073741824ULL | ||
46 | SODIUM_EXPORT | ||
47 | size_t crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive(void); | ||
48 | |||
49 | SODIUM_EXPORT | ||
50 | int crypto_pwhash_scryptsalsa208sha256(unsigned char * const out, | ||
51 | unsigned long long outlen, | ||
52 | const char * const passwd, | ||
53 | unsigned long long passwdlen, | ||
54 | const unsigned char * const salt, | ||
55 | unsigned long long opslimit, | ||
56 | size_t memlimit); | ||
57 | |||
58 | SODIUM_EXPORT | ||
59 | int crypto_pwhash_scryptsalsa208sha256_str(char out[crypto_pwhash_scryptsalsa208sha256_STRBYTES], | ||
60 | const char * const passwd, | ||
61 | unsigned long long passwdlen, | ||
62 | unsigned long long opslimit, | ||
63 | size_t memlimit); | ||
64 | |||
65 | SODIUM_EXPORT | ||
66 | int crypto_pwhash_scryptsalsa208sha256_str_verify(const char str[crypto_pwhash_scryptsalsa208sha256_STRBYTES], | ||
67 | const char * const passwd, | ||
68 | unsigned long long passwdlen); | ||
69 | |||
70 | SODIUM_EXPORT | ||
71 | int crypto_pwhash_scryptsalsa208sha256_ll(const uint8_t * passwd, size_t passwdlen, | ||
72 | const uint8_t * salt, size_t saltlen, | ||
73 | uint64_t N, uint32_t r, uint32_t p, | ||
74 | uint8_t * buf, size_t buflen); | ||
75 | |||
76 | #ifdef __cplusplus | ||
77 | } | ||
78 | #endif | ||
79 | |||
80 | /* Backward compatibility with version 0.5.0 */ | ||
81 | |||
82 | #define crypto_pwhash_scryptxsalsa208sha256_SALTBYTES crypto_pwhash_scryptsalsa208sha256_SALTBYTES | ||
83 | #define crypto_pwhash_scryptxsalsa208sha256_saltbytes crypto_pwhash_scryptsalsa208sha256_saltbytes | ||
84 | #define crypto_pwhash_scryptxsalsa208sha256_STRBYTES crypto_pwhash_scryptsalsa208sha256_STRBYTES | ||
85 | #define crypto_pwhash_scryptxsalsa208sha256_strbytes crypto_pwhash_scryptsalsa208sha256_strbytes | ||
86 | #define crypto_pwhash_scryptxsalsa208sha256 crypto_pwhash_scryptsalsa208sha256 | ||
87 | #define crypto_pwhash_scryptxsalsa208sha256_str crypto_pwhash_scryptsalsa208sha256_str | ||
88 | #define crypto_pwhash_scryptxsalsa208sha256_str_verify crypto_pwhash_scryptsalsa208sha256_str_verify | ||
89 | |||
90 | #endif | ||
91 | |||
92 | #endif | ||