aboutsummaryrefslogtreecommitdiff
path: root/tests/performance_tests/cn_slow_hash.h
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2019-03-04 17:06:37 +0200
committerRiccardo Spagni <ric@spagni.net>2019-03-04 17:06:37 +0200
commit815c8a48ab38586baf7963f7a4d9a87263811855 (patch)
tree36fa875b076db18a0d2775a5b96e61dc01cd0616 /tests/performance_tests/cn_slow_hash.h
parentMerge pull request #5132 (diff)
parenttests: add a CNv4 JIT test (diff)
downloadmonero-815c8a48ab38586baf7963f7a4d9a87263811855.tar.xz
Merge pull request #5174
0de14396 tests: add a CNv4 JIT test (moneromooo-monero) 24d281c3 crypto: plug CNv4 JIT into cn_slow_hash (moneromooo-monero) 78ab59ea crypto: clear cache after generating random program (moneromooo-monero) b9a61884 performance_tests: add tests for new Cryptonight variants (moneromooo-monero) fff23bf7 CNv4 JIT compiler for x86-64 and tests (SChernykh) 3dde67d8 blockchain: add v10 fork heights (moneromooo-monero)
Diffstat (limited to 'tests/performance_tests/cn_slow_hash.h')
-rw-r--r--tests/performance_tests/cn_slow_hash.h15
1 files changed, 6 insertions, 9 deletions
diff --git a/tests/performance_tests/cn_slow_hash.h b/tests/performance_tests/cn_slow_hash.h
index b484afa41..79ebb8778 100644
--- a/tests/performance_tests/cn_slow_hash.h
+++ b/tests/performance_tests/cn_slow_hash.h
@@ -34,6 +34,7 @@
#include "crypto/crypto.h"
#include "cryptonote_basic/cryptonote_basic.h"
+template<unsigned int variant>
class test_cn_slow_hash
{
public:
@@ -42,18 +43,15 @@ public:
#pragma pack(push, 1)
struct data_t
{
- char data[13];
+ char data[43];
};
#pragma pack(pop)
- static_assert(13 == sizeof(data_t), "Invalid structure size");
+ static_assert(43 == sizeof(data_t), "Invalid structure size");
bool init()
{
- if (!epee::string_tools::hex_to_pod("63617665617420656d70746f72", m_data))
- return false;
-
- if (!epee::string_tools::hex_to_pod("bbec2cacf69866a8e740380fe7b818fc78f8571221742d729d9d02d7f8989b87", m_expected_hash))
+ if (!epee::string_tools::hex_to_pod("63617665617420656d70746f763617665617420656d70746f72263617665617420656d70746f7201020304", m_data))
return false;
return true;
@@ -62,11 +60,10 @@ public:
bool test()
{
crypto::hash hash;
- crypto::cn_slow_hash(&m_data, sizeof(m_data), hash);
- return hash == m_expected_hash;
+ crypto::cn_slow_hash(&m_data, sizeof(m_data), hash, variant);
+ return true;
}
private:
data_t m_data;
- crypto::hash m_expected_hash;
};