Reuse RandomX hashing context during mining
This commit is contained in:
parent
b46ce28c09
commit
fbac0a9d47
5 changed files with 126 additions and 22 deletions
|
|
@ -3,9 +3,31 @@
|
|||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
static constexpr std::size_t VEXTA_RANDOMX_HASH_SIZE = 32;
|
||||
|
||||
class VextaRandomXHasher
|
||||
{
|
||||
public:
|
||||
VextaRandomXHasher(const void* key, std::size_t key_size);
|
||||
~VextaRandomXHasher();
|
||||
|
||||
VextaRandomXHasher(const VextaRandomXHasher&) = delete;
|
||||
VextaRandomXHasher& operator=(const VextaRandomXHasher&) = delete;
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
bool Hash(
|
||||
const void* input,
|
||||
std::size_t input_size,
|
||||
uint8_t output[VEXTA_RANDOMX_HASH_SIZE]);
|
||||
|
||||
private:
|
||||
struct Impl;
|
||||
std::unique_ptr<Impl> m_impl;
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculate a RandomX hash using an explicit key.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue