speedtest_SOURCES = \
base32.cc \
base64.cc base64.hh \
+ credentials.cc credentials.hh \
dnslabeltext.cc \
dnsname.cc dnsname.hh \
dnsparser.cc dnsparser.hh \
if LIBSODIUM
testrunner_SOURCES += sodiumsigners.cc
testrunner_LDADD += $(LIBSODIUM_LIBS)
+speedtest_LDADD += $(LIBSODIUM_LIBS)
endif
if LIBDECAF
#include "config.h"
#include <boost/format.hpp>
#include <boost/container/string.hpp>
+#include "credentials.hh"
#include "dnsparser.hh"
#include "sstuff.hh"
#include "misc.hh"
bool d_contended;
};
+struct CredentialsHashTest
+{
+ explicit CredentialsHashTest() {}
+
+ string getName() const
+ {
+ return "Credentials hashing test";
+ }
+
+ void operator()() const
+ {
+ hashPassword(d_password);
+ }
+
+private:
+ const std::string d_password{"test password"};
+};
+
+struct CredentialsVerifyTest
+{
+ explicit CredentialsVerifyTest() {
+ d_hashed = hashPassword(d_password);
+ }
+
+ string getName() const
+ {
+ return "Credentials verification test";
+ }
+
+ void operator()() const
+ {
+ verifyPassword(d_hashed, d_password);
+ }
+
+private:
+ std::string d_hashed;
+ const std::string d_password{"test password"};
+};
+
int main(int argc, char** argv)
try
{
doRun(NSEC3HashTest(150, "ABCDABCDABCDABCDABCDABCDABCDABCD"));
doRun(NSEC3HashTest(500, "ABCDABCDABCDABCDABCDABCDABCDABCD"));
+#ifdef HAVE_LIBSODIUM
+ doRun(CredentialsHashTest());
+ doRun(CredentialsVerifyTest());
+#endif
+
#ifndef RECURSOR
S.doRings();