Scrypt _DefaultSettings test actually uses default settings

This commit is contained in:
Sebastian Messmer 2023-05-23 18:47:40 -07:00
parent f74c919654
commit 5af5eb107f

View File

@ -55,12 +55,19 @@ TEST_F(SCryptTest, BackwardsCompatibility_128) {
}
TEST_F(SCryptTest, GeneratedKeyIsReproductible_DefaultSettings) {
SCrypt scrypt(SCrypt::TestSettings);
auto derivedKey = scrypt.deriveNewKey(16, "mypassword");
auto rederivedKey = scrypt.deriveExistingKey(16, "mypassword", derivedKey.kdfParameters);
SCrypt scrypt(SCrypt::DefaultSettings);
auto derivedKey = scrypt.deriveNewKey(32, "mypassword");
auto rederivedKey = scrypt.deriveExistingKey(32, "mypassword", derivedKey.kdfParameters);
EXPECT_TRUE(keyEquals(derivedKey.key, rederivedKey));
}
TEST_F(SCryptTest, BackwardsCompatibility_DefaultSettings) {
SCrypt scrypt(SCrypt::DefaultSettings);
auto kdfParameters = Data::FromString("00001000000000000400000008000000D04ACF9519113E1F4E4D7FB39EFBF257CD71CF8536A468B546C2F5A65C6B622C");
auto rederivedKey = scrypt.deriveExistingKey(32, "mypassword", kdfParameters);
EXPECT_EQ("AB70B1923F3EB9EB8A75C15FD665AC3494C5EBAB80323D864135DBB2911ECF59", rederivedKey.ToString());
}
TEST_F(SCryptTest, DifferentPasswordResultsInDifferentKey) {
SCrypt scrypt(SCrypt::TestSettings);
auto derivedKey = scrypt.deriveNewKey(16, "mypassword");