diff options
author | Riccardo Spagni <ric@spagni.net> | 2019-02-18 17:07:50 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2019-02-18 17:07:50 +0200 |
commit | 35616a71da0556189b120adfe4d793d7337d3587 (patch) | |
tree | 830b371c88726386cd5eed1973c798ef6a580862 /tests/performance_tests/cn_slow_hash.h | |
parent | Merge pull request #5157 (diff) | |
parent | tests: add a CNv4 JIT test (diff) | |
download | monero-35616a71da0556189b120adfe4d793d7337d3587.tar.xz |
Merge pull request #5158
993a1994 tests: add a CNv4 JIT test (moneromooo-monero)
736f2579 crypto: plug CNv4 JIT into cn_slow_hash (moneromooo-monero)
2e9b988a crypto: clear cache after generating random program (moneromooo-monero)
683c3d13 performance_tests: add tests for new Cryptonight variants (moneromooo-monero)
Diffstat (limited to 'tests/performance_tests/cn_slow_hash.h')
-rw-r--r-- | tests/performance_tests/cn_slow_hash.h | 15 |
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; }; |