summaryrefslogtreecommitdiff
path: root/selftest.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-05-14 17:41:05 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-05-14 17:41:05 -0700
commite94518590de48e2718539f98b87e2f617fa02f75 (patch)
tree8329028e4fc1e2e198f2e1e7ee275a47d02b9dc0 /selftest.cpp
parenta8835cd8b33903440f372ed66f4e3b49745ea68f (diff)
downloadinfinitytier-e94518590de48e2718539f98b87e2f617fa02f75.tar.gz
infinitytier-e94518590de48e2718539f98b87e2f617fa02f75.zip
First stab of PFS design work with PKC security -- may not implement in 1.0.3 but stubbing out.
Diffstat (limited to 'selftest.cpp')
-rw-r--r--selftest.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/selftest.cpp b/selftest.cpp
index 319271f3..5d5067fd 100644
--- a/selftest.cpp
+++ b/selftest.cpp
@@ -204,6 +204,24 @@ static int testCrypto()
::free((void *)bb);
}
+ std::cout << "[crypto] Benchmarking Salsa20/20... "; std::cout.flush();
+ {
+ unsigned char *bb = (unsigned char *)::malloc(1234567);
+ for(unsigned int i=0;i<1234567;++i)
+ bb[i] = (unsigned char)i;
+ Salsa20 s20(s20TV0Key,256,s20TV0Iv,20);
+ double bytes = 0.0;
+ uint64_t start = OSUtils::now();
+ for(unsigned int i=0;i<200;++i) {
+ s20.encrypt(bb,bb,1234567);
+ bytes += 1234567.0;
+ }
+ uint64_t end = OSUtils::now();
+ SHA512::hash(buf1,bb,1234567);
+ std::cout << ((bytes / 1048576.0) / ((double)(end - start) / 1000.0)) << " MiB/second (" << Utils::hex(buf1,16) << ')' << std::endl;
+ ::free((void *)bb);
+ }
+
std::cout << "[crypto] Testing SHA-512... "; std::cout.flush();
SHA512::hash(buf1,sha512TV0Input,(unsigned int)strlen(sha512TV0Input));
if (memcmp(buf1,sha512TV0Digest,64)) {