diff --git a/src/libethash/data_sizes.h b/src/libethash/data_sizes.h index 3b747b3e..cf52ae4f 100644 --- a/src/libethash/data_sizes.h +++ b/src/libethash/data_sizes.h @@ -48,7 +48,7 @@ extern "C" { // Sow[i*HashBytes]; j++]]]][[2]][[1]] -static const size_t dag_sizes[2048] = { +static const uint64_t dag_sizes[2048] = { 1073739904U, 1082130304U, 1090514816U, 1098906752U, 1107293056U, 1115684224U, 1124070016U, 1132461952U, 1140849536U, 1149232768U, 1157627776U, 1166013824U, 1174404736U, 1182786944U, 1191180416U, @@ -477,7 +477,7 @@ static const size_t dag_sizes[2048] = { // While[! PrimeQ[i], i--]; // Sow[i*HashBytes]; j++]]]][[2]][[1]] -const size_t cache_sizes[2048] = { +const uint64_t cache_sizes[2048] = { 16776896U, 16907456U, 17039296U, 17170112U, 17301056U, 17432512U, 17563072U, 17693888U, 17824192U, 17955904U, 18087488U, 18218176U, 18349504U, 18481088U, 18611392U, 18742336U, 18874304U, 19004224U, 19135936U, 19267264U, 19398208U, diff --git a/src/libethash/ethash.h b/src/libethash/ethash.h index 809b7cce..cc3d634d 100644 --- a/src/libethash/ethash.h +++ b/src/libethash/ethash.h @@ -43,8 +43,8 @@ extern "C" { #endif typedef struct ethash_params { - size_t full_size; // Size of full data set (in bytes, multiple of mix size (128)). - size_t cache_size; // Size of compute cache (in bytes, multiple of node size (64)). + uint64_t full_size; // Size of full data set (in bytes, multiple of mix size (128)). + uint64_t cache_size; // Size of compute cache (in bytes, multiple of node size (64)). } ethash_params; typedef struct ethash_return_value { @@ -52,8 +52,8 @@ typedef struct ethash_return_value { uint8_t mix_hash[32]; } ethash_return_value; -size_t ethash_get_datasize(const uint32_t block_number); -size_t ethash_get_cachesize(const uint32_t block_number); +uint64_t ethash_get_datasize(const uint32_t block_number); +uint64_t ethash_get_cachesize(const uint32_t block_number); // Initialize the Parameters static inline int ethash_params_init(ethash_params *params, const uint32_t block_number) { diff --git a/src/libethash/internal.c b/src/libethash/internal.c index 9b6629f7..ea0b630f 100644 --- a/src/libethash/internal.c +++ b/src/libethash/internal.c @@ -36,13 +36,13 @@ #include "sha3.h" #endif // WITH_CRYPTOPP -size_t ethash_get_datasize(const uint32_t block_number) { +uint64_t ethash_get_datasize(const uint32_t block_number) { if (block_number / EPOCH_LENGTH >= 2048) return 0; return dag_sizes[block_number / EPOCH_LENGTH]; } -size_t ethash_get_cachesize(const uint32_t block_number) { +uint64_t ethash_get_cachesize(const uint32_t block_number) { if (block_number / EPOCH_LENGTH >= 2048) return 0; return cache_sizes[block_number / EPOCH_LENGTH]; diff --git a/src/python/core.c b/src/python/core.c index 35973599..6d0a40ad 100644 --- a/src/python/core.c +++ b/src/python/core.c @@ -58,7 +58,7 @@ mkcache_bytes(PyObject *self, PyObject *args) { } ethash_params params; - params.cache_size = (size_t) cache_size; + params.cache_size = (uint64_t) cache_size; ethash_cache cache; cache.mem = malloc(cache_size); ethash_mkcache(&cache, ¶ms, (uint8_t *) seed); @@ -92,8 +92,8 @@ calc_dataset_bytes(PyObject *self, PyObject *args) { } ethash_params params; - params.cache_size = (size_t) cache_size; - params.full_size = (size_t) full_size; + params.cache_size = (uint64_t) cache_size; + params.full_size = (uint64_t) full_size; ethash_cache cache; cache.mem = (void *) cache_bytes; void *mem = malloc(params.full_size); @@ -138,8 +138,8 @@ hashimoto_light(PyObject *self, PyObject *args) { ethash_return_value out; ethash_params params; - params.cache_size = (size_t) cache_size; - params.full_size = (size_t) full_size; + params.cache_size = (uint64_t) cache_size; + params.full_size = (uint64_t) full_size; ethash_cache cache; cache.mem = (void *) cache_bytes; ethash_light(&out, &cache, ¶ms, (uint8_t *) header, nonce); @@ -175,7 +175,7 @@ hashimoto_full(PyObject *self, PyObject *args) { ethash_return_value out; ethash_params params; - params.full_size = (size_t) full_size; + params.full_size = (uint64_t) full_size; ethash_full(&out, (void *) full_bytes, ¶ms, (uint8_t *) header, nonce); return Py_BuildValue("{s:s#, s:s#}", "mix digest", out.mix_hash, 32, @@ -216,7 +216,7 @@ mine(PyObject *self, PyObject *args) { ethash_return_value out; ethash_params params; - params.full_size = (size_t) full_size; + params.full_size = (uint64_t) full_size; // TODO: Multi threading? do { diff --git a/test/c/test.cpp b/test/c/test.cpp index 9c0213d9..8c854ecb 100644 --- a/test/c/test.cpp +++ b/test/c/test.cpp @@ -17,7 +17,7 @@ #include #include -std::string bytesToHexString(const uint8_t *str, const size_t s) { +std::string bytesToHexString(const uint8_t *str, const uint32_t s) { std::ostringstream ret; for (int i = 0; i < s; ++i)