Reuse RandomX hashing context during mining

This commit is contained in:
Capri 2026-09-16 21:53:20 +00:00
commit fbac0a9d47
Signed by: VextaProject
SSH key fingerprint: SHA256:739BZv8LvIDY2tR7lXLy/IQ6MaGTQtYcG9GNvCjmpVM
5 changed files with 126 additions and 22 deletions

View file

@ -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.
*