mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Add transform key benchmark to TestKeys.
This commit is contained in:
parent
586de64293
commit
b07de47e35
@ -165,4 +165,24 @@ void TestKeys::testFileKeyError()
|
||||
errorMsg = "";
|
||||
}
|
||||
|
||||
void TestKeys::benchmarkTransformKey()
|
||||
{
|
||||
QByteArray env = qgetenv("BENCHMARK");
|
||||
|
||||
if (env.isEmpty() || env == "0" || env == "no") {
|
||||
QSKIP("Benchmark skipped. Set env variable BENCHMARK=1 to enable.", SkipAll);
|
||||
}
|
||||
|
||||
PasswordKey pwKey;
|
||||
pwKey.setPassword("password");
|
||||
CompositeKey compositeKey;
|
||||
compositeKey.addKey(pwKey);
|
||||
|
||||
QByteArray seed(32, '\x4B');
|
||||
|
||||
QBENCHMARK {
|
||||
compositeKey.transform(seed, 1e6);
|
||||
}
|
||||
}
|
||||
|
||||
QTEST_GUILESS_MAIN(TestKeys)
|
||||
|
@ -31,6 +31,7 @@ private Q_SLOTS:
|
||||
void testFileKey_data();
|
||||
void testCreateFileKey();
|
||||
void testFileKeyError();
|
||||
void benchmarkTransformKey();
|
||||
};
|
||||
|
||||
#endif // KEEPASSX_TESTKEYS_H
|
||||
|
Loading…
Reference in New Issue
Block a user