summaryrefslogtreecommitdiff
path: root/selftest.cpp
diff options
context:
space:
mode:
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 27c81c25..f84abcc0 100644
--- a/selftest.cpp
+++ b/selftest.cpp
@@ -193,6 +193,24 @@ static int testCrypto()
std::cout << "[crypto] Salsa20 SSE: DISABLED" << std::endl;
#endif
+ std::cout << "[crypto] Benchmarking Salsa20/8... "; 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,8);
+ 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] Benchmarking Salsa20/12... "; std::cout.flush();
{
unsigned char *bb = (unsigned char *)::malloc(1234567);