#pragma once
#include "include/hash_types.h"
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
#define NOEXCEPT noexcept
#else
#define NOEXCEPT
#endif
#define ETHASH_REVISION "23"
#define ETHASH_EPOCH_LENGTH 7500
#define ETHASH_LIGHT_CACHE_ITEM_SIZE 64
#define ETHASH_FULL_DATASET_ITEM_SIZE 128
#define ETHASH_NUM_DATASET_ACCESSES 64
struct ethash_epoch_context
{
const int epoch_number;
const int light_cache_num_items;
const union ethash_hash512* const light_cache;
const uint32_t* const l1_cache;
const int full_dataset_num_items;
};
struct ethash_epoch_context_full;
struct ethash_result
{
union ethash_hash256 final_hash;
union ethash_hash256 mix_hash;
};
int ethash_calculate_light_cache_num_items(int epoch_number) NOEXCEPT;
int ethash_calculate_full_dataset_num_items(int epoch_number) NOEXCEPT;
union ethash_hash256 ethash_calculate_epoch_seed(int epoch_number) NOEXCEPT;
struct ethash_epoch_context* ethash_create_epoch_context(int epoch_number) NOEXCEPT;
struct ethash_epoch_context_full* ethash_create_epoch_context_full(int epoch_number) NOEXCEPT;
void ethash_destroy_epoch_context(struct ethash_epoch_context* context) NOEXCEPT;
void ethash_destroy_epoch_context_full(struct ethash_epoch_context_full* context) NOEXCEPT;
const struct ethash_epoch_context* ethash_get_global_epoch_context(int epoch_number) NOEXCEPT;
const struct ethash_epoch_context_full* ethash_get_global_epoch_context_full(
int epoch_number) NOEXCEPT;
struct ethash_result ethash_hash(const struct ethash_epoch_context* context,
const union ethash_hash256* header_hash, uint64_t nonce) NOEXCEPT;
bool ethash_verify(const struct ethash_epoch_context* context,
const union ethash_hash256* header_hash, const union ethash_hash256* mix_hash, uint64_t nonce,
const union ethash_hash256* boundary) NOEXCEPT;
bool ethash_verify_final_hash(const union ethash_hash256* header_hash,
const union ethash_hash256* mix_hash, uint64_t nonce,
const union ethash_hash256* boundary) NOEXCEPT;