20 #include <gtest/gtest.h>
25 #include "../test/file_test.h"
26 #include "../test/test_util.h"
31 if (!t->GetAttribute(&
str,
name)) {
36 *
out = strtoull(
str.data(), &endptr, 10);
37 return !
str.empty() && *endptr ==
'\0';
40 TEST(ScryptTest, TestVectors) {
42 std::vector<uint8_t> password, salt,
key;
50 if (t->HasAttribute(
"MaxMemory")) {
56 password.size(), salt.data(), salt.size(),
N,
r,
62 TEST(ScryptTest, MemoryLimit) {
63 static const char kPassword[] =
"pleaseletmein";
64 static const char kSalt[] =
"SodiumChloride";
69 reinterpret_cast<const uint8_t *
>(kSalt),
70 strlen(kSalt), 1048576 , 8 ,
71 1 , 0 ,
key,
sizeof(
key)));
77 TEST(ScryptTest, InvalidParameters) {
82 1 , 0 ,
key,
sizeof(
key)));
84 0 , 0 ,
key,
sizeof(
key)));
88 1 , 0 ,
key,
sizeof(
key)));
90 1 , 0 ,
key,
sizeof(
key)));
92 1 , 0 ,
key,
sizeof(
key)));
94 1 , 0 ,
key,
sizeof(
key)));
96 1 , 0 ,
key,
sizeof(
key)));
100 1 , 0 ,
key,
sizeof(
key)));
102 1 , 0 ,
key,
sizeof(
key)));