summaryrefslogtreecommitdiff
path: root/selftest.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-10-06 17:55:57 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-10-06 17:55:57 -0700
commit477feee8a3fbc84d00c2939b5fc8a9bbf19af2ca (patch)
tree1f2a6edc5e9d857ec62a3da62d429c41ae3e0506 /selftest.cpp
parent7394ec6f6ab38c48e84edf3bf2fdb46e6966fa35 (diff)
downloadinfinitytier-477feee8a3fbc84d00c2939b5fc8a9bbf19af2ca.tar.gz
infinitytier-477feee8a3fbc84d00c2939b5fc8a9bbf19af2ca.zip
Some work on CIRCUIT_TEST, and a significant speedup to Poly1305.
Diffstat (limited to 'selftest.cpp')
-rw-r--r--selftest.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/selftest.cpp b/selftest.cpp
index b899ee5a..e938cf4d 100644
--- a/selftest.cpp
+++ b/selftest.cpp
@@ -269,6 +269,22 @@ static int testCrypto()
}
std::cout << "PASS" << std::endl;
+ std::cout << "[crypto] Benchmarking Poly1305... "; std::cout.flush();
+ {
+ unsigned char *bb = (unsigned char *)::malloc(1234567);
+ for(unsigned int i=0;i<1234567;++i)
+ bb[i] = (unsigned char)i;
+ double bytes = 0.0;
+ uint64_t start = OSUtils::now();
+ for(unsigned int i=0;i<200;++i) {
+ Poly1305::compute(buf1,bb,1234567,poly1305TV0Key);
+ bytes += 1234567.0;
+ }
+ uint64_t end = OSUtils::now();
+ std::cout << ((bytes / 1048576.0) / ((double)(end - start) / 1000.0)) << " MiB/second" << std::endl;
+ ::free((void *)bb);
+ }
+
std::cout << "[crypto] Testing C25519 and Ed25519 against test vectors... "; std::cout.flush();
for(int k=0;k<ZT_NUM_C25519_TEST_VECTORS;++k) {
C25519::Pair p1,p2;