Electroneum
test_check_hash< hash_target_high, hash_target_low, difficulty_high, difficulty_low > Class Template Reference

#include <check_hash.h>

Collaboration diagram for test_check_hash< hash_target_high, hash_target_low, difficulty_high, difficulty_low >:

Public Member Functions

bool init ()
 
bool test ()
 

Static Public Attributes

static const size_t loop_count = 100000
 

Detailed Description

template<uint64_t hash_target_high, uint64_t hash_target_low, uint64_t difficulty_high, uint64_t difficulty_low>
class test_check_hash< hash_target_high, hash_target_low, difficulty_high, difficulty_low >

Definition at line 35 of file check_hash.h.

Member Function Documentation

◆ init()

template<uint64_t hash_target_high, uint64_t hash_target_low, uint64_t difficulty_high, uint64_t difficulty_low>
bool test_check_hash< hash_target_high, hash_target_low, difficulty_high, difficulty_low >::init ( )
inline

Definition at line 40 of file check_hash.h.

41  {
42  cryptonote::difficulty_type hash_target = hash_target_high;
43  hash_target = (hash_target << 64) | hash_target_low;
44  difficulty = difficulty_high;
45  difficulty = (difficulty << 64) | difficulty_low;
46  boost::multiprecision::uint256_t hash_value = std::numeric_limits<boost::multiprecision::uint256_t>::max() / hash_target;
47  ((uint64_t*)&hash)[0] = (hash_value & 0xffffffffffffffff).convert_to<uint64_t>();
48  hash_value >>= 64;
49  ((uint64_t*)&hash)[1] = (hash_value & 0xffffffffffffffff).convert_to<uint64_t>();
50  hash_value >>= 64;
51  ((uint64_t*)&hash)[2] = (hash_value & 0xffffffffffffffff).convert_to<uint64_t>();
52  hash_value >>= 64;
53  ((uint64_t*)&hash)[3] = (hash_value & 0xffffffffffffffff).convert_to<uint64_t>();
54  return true;
55  }
unsigned __int64 uint64_t
Definition: stdint.h:136
boost::multiprecision::uint128_t difficulty_type
Definition: difficulty.h:43

◆ test()

template<uint64_t hash_target_high, uint64_t hash_target_low, uint64_t difficulty_high, uint64_t difficulty_low>
bool test_check_hash< hash_target_high, hash_target_low, difficulty_high, difficulty_low >::test ( )
inline

Definition at line 57 of file check_hash.h.

58  {
59  cryptonote::check_hash_128(hash, difficulty);
60  return true;
61  }
bool check_hash_128(const crypto::hash &hash, difficulty_type difficulty)
Definition: difficulty.cpp:184
Here is the call graph for this function:

Member Data Documentation

◆ loop_count

template<uint64_t hash_target_high, uint64_t hash_target_low, uint64_t difficulty_high, uint64_t difficulty_low>
const size_t test_check_hash< hash_target_high, hash_target_low, difficulty_high, difficulty_low >::loop_count = 100000
static

Definition at line 38 of file check_hash.h.


The documentation for this class was generated from the following file: