summaryrefslogtreecommitdiff
path: root/selftest.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2018-03-12 16:16:20 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2018-03-12 16:16:20 -0700
commit610e594a501d3419e0b8a1bac061ca1af689d531 (patch)
tree1a0111c6b93d6d5b7681a550d1419ee1eb90ac44 /selftest.cpp
parentb4e25470522122b92c3cb310717f7ee07e7bf8c7 (diff)
downloadinfinitytier-610e594a501d3419e0b8a1bac061ca1af689d531.tar.gz
infinitytier-610e594a501d3419e0b8a1bac061ca1af689d531.zip
Speed tweaks for signatures, etc.
Diffstat (limited to 'selftest.cpp')
-rw-r--r--selftest.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/selftest.cpp b/selftest.cpp
index 03f587b0..4008cd2a 100644
--- a/selftest.cpp
+++ b/selftest.cpp
@@ -376,11 +376,11 @@ static int testCrypto()
C25519::Pair bp[8];
for(int k=0;k<8;++k)
bp[k] = C25519::generate();
- const uint64_t st = OSUtils::now();
+ uint64_t st = OSUtils::now();
for(unsigned int k=0;k<50;++k) {
C25519::agree(bp[~k & 7],bp[k & 7].pub,buf1,64);
}
- const uint64_t et = OSUtils::now();
+ uint64_t et = OSUtils::now();
std::cout << ((double)(et - st) / 50.0) << "ms per agreement." << std::endl;
std::cout << "[crypto] Testing Ed25519 ECC signatures... "; std::cout.flush();
@@ -419,6 +419,15 @@ static int testCrypto()
}
std::cout << "PASS" << std::endl;
+ std::cout << "[crypto] Benchmarking Ed25519 ECC signatures... "; std::cout.flush();
+ st = OSUtils::now();
+ for(int k=0;k<1000;++k) {
+ C25519::Signature sig;
+ C25519::sign(didntSign.priv,didntSign.pub,buf1,sizeof(buf1),sig.data);
+ }
+ et = OSUtils::now();
+ std::cout << ((double)(et - st) / 50.0) << "ms per signature." << std::endl;
+
return 0;
}