2 #define TEST_NAME "pwhash_scrypt_ll"
5 static const char * passwd1 = "";
6 static const char * salt1 = "";
7 static const uint64_t N1 = 16U;
8 static const uint32_t r1 = 1U;
9 static const uint32_t p1 = 1U;
11 static const char * passwd2 = "password";
12 static const char * salt2 = "NaCl";
13 static const uint64_t N2 = 1024U;
14 static const uint32_t r2 = 8U;
15 static const uint32_t p2 = 16U;
17 static const char * passwd3 = "pleaseletmein";
18 static const char * salt3 = "SodiumChloride";
19 static const uint64_t N3 = 16384U;
20 static const uint32_t r3 = 8U;
21 static const uint32_t p3 = 1U;
24 tv(const char *passwd, const char *salt, uint64_t N, uint32_t r, uint32_t p)
28 size_t olen = (sizeof data / sizeof data[0]);
29 size_t passwd_len = strlen(passwd);
30 size_t salt_len = strlen(salt);
33 if (crypto_pwhash_scryptsalsa208sha256_ll(
34 (const uint8_t *) passwd, passwd_len, (const uint8_t *) salt,
35 salt_len, N, r, p, data, olen) != 0) {
36 printf("pwhash_scryptsalsa208sha256_ll([%s],[%s]) failure\n", passwd,
41 printf("scrypt('%s', '%s', %lu, %lu, %lu, %lu) =\n", passwd, salt,
42 (unsigned long) N, (unsigned long) r, (unsigned long) p,
43 (unsigned long) olen);
45 for (i = 0; i < olen; i++) {
46 printf("%02x%c", data[i], line_items < 15 ? ' ' : '\n');
47 line_items = line_items < 15 ? line_items + 1 : 0;
54 tv(passwd1, salt1, N1, r1, p1);
55 tv(passwd2, salt2, N2, r2, p2);
56 tv(passwd3, salt3, N3, r3, p3);