mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-23 10:37:37 -07:00
performance_tests: add tests for new Cryptonight variants
This commit is contained in:
parent
fff23bf7c6
commit
b9a618848f
@ -34,6 +34,7 @@
|
|||||||
#include "crypto/crypto.h"
|
#include "crypto/crypto.h"
|
||||||
#include "cryptonote_basic/cryptonote_basic.h"
|
#include "cryptonote_basic/cryptonote_basic.h"
|
||||||
|
|
||||||
|
template<unsigned int variant>
|
||||||
class test_cn_slow_hash
|
class test_cn_slow_hash
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -42,18 +43,15 @@ public:
|
|||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
struct data_t
|
struct data_t
|
||||||
{
|
{
|
||||||
char data[13];
|
char data[43];
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
static_assert(13 == sizeof(data_t), "Invalid structure size");
|
static_assert(43 == sizeof(data_t), "Invalid structure size");
|
||||||
|
|
||||||
bool init()
|
bool init()
|
||||||
{
|
{
|
||||||
if (!epee::string_tools::hex_to_pod("63617665617420656d70746f72", m_data))
|
if (!epee::string_tools::hex_to_pod("63617665617420656d70746f763617665617420656d70746f72263617665617420656d70746f7201020304", m_data))
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!epee::string_tools::hex_to_pod("bbec2cacf69866a8e740380fe7b818fc78f8571221742d729d9d02d7f8989b87", m_expected_hash))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -62,11 +60,10 @@ public:
|
|||||||
bool test()
|
bool test()
|
||||||
{
|
{
|
||||||
crypto::hash hash;
|
crypto::hash hash;
|
||||||
crypto::cn_slow_hash(&m_data, sizeof(m_data), hash);
|
crypto::cn_slow_hash(&m_data, sizeof(m_data), hash, variant);
|
||||||
return hash == m_expected_hash;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
data_t m_data;
|
data_t m_data;
|
||||||
crypto::hash m_expected_hash;
|
|
||||||
};
|
};
|
||||||
|
@ -193,7 +193,10 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
TEST_PERFORMANCE2(filter, p, test_wallet2_expand_subaddresses, 50, 200);
|
TEST_PERFORMANCE2(filter, p, test_wallet2_expand_subaddresses, 50, 200);
|
||||||
|
|
||||||
TEST_PERFORMANCE0(filter, p, test_cn_slow_hash);
|
TEST_PERFORMANCE1(filter, p, test_cn_slow_hash, 0);
|
||||||
|
TEST_PERFORMANCE1(filter, p, test_cn_slow_hash, 1);
|
||||||
|
TEST_PERFORMANCE1(filter, p, test_cn_slow_hash, 2);
|
||||||
|
TEST_PERFORMANCE1(filter, p, test_cn_slow_hash, 4);
|
||||||
TEST_PERFORMANCE1(filter, p, test_cn_fast_hash, 32);
|
TEST_PERFORMANCE1(filter, p, test_cn_fast_hash, 32);
|
||||||
TEST_PERFORMANCE1(filter, p, test_cn_fast_hash, 16384);
|
TEST_PERFORMANCE1(filter, p, test_cn_fast_hash, 16384);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user