Cache seed renamed to key

pull/40/head
tevador 5 years ago
parent 1a4bde36be
commit c87dcc8ae5

@ -47,15 +47,15 @@ static_assert(ARGON2_BLOCK_SIZE == randomx::ArgonBlockSize, "Unpexpected value o
namespace randomx {
void initCache(randomx_cache* cache, const void* seed, size_t seedSize) {
void initCache(randomx_cache* cache, const void* key, size_t keySize) {
uint32_t memory_blocks, segment_length;
argon2_instance_t instance;
argon2_context context;
context.out = nullptr;
context.outlen = 0;
context.pwd = CONST_CAST(uint8_t *)seed;
context.pwdlen = (uint32_t)seedSize;
context.pwd = CONST_CAST(uint8_t *)key;
context.pwdlen = (uint32_t)keySize;
context.salt = CONST_CAST(uint8_t *)RANDOMX_ARGON_SALT;
context.saltlen = (uint32_t)randomx::ArgonSaltSize;
context.secret = NULL;
@ -100,7 +100,7 @@ namespace randomx {
fill_memory_blocks(&instance);
cache->reciprocalCache.clear();
randomx::Blake2Generator gen(seed, seedSize);
randomx::Blake2Generator gen(key, keySize);
for (int i = 0; i < RANDOMX_CACHE_ACCESSES; ++i) {
randomx::generateSuperscalar(cache->programs[i], gen);
for (unsigned j = 0; j < cache->programs[i].getSize(); ++j) {
@ -114,8 +114,8 @@ namespace randomx {
}
}
void initCacheCompile(randomx_cache* cache, const void* seed, size_t seedSize) {
initCache(cache, seed, seedSize);
void initCacheCompile(randomx_cache* cache, const void* key, size_t keySize) {
initCache(cache, key, keySize);
cache->jit->generateSuperscalarHash(cache->programs, cache->reciprocalCache);
cache->jit->generateDatasetInitCode();
}

@ -76,8 +76,8 @@ extern "C" {
return cache;
}
void randomx_init_cache(randomx_cache *cache, const void *seed, size_t seedSize) {
cache->initialize(cache, seed, seedSize);
void randomx_init_cache(randomx_cache *cache, const void *key, size_t keySize) {
cache->initialize(cache, key, keySize);
}
void randomx_release_cache(randomx_cache* cache) {

@ -56,13 +56,13 @@ extern "C" {
randomx_cache *randomx_alloc_cache(randomx_flags flags);
/**
* Initializes the cache memory and SuperscalarHash using the provided seed value.
* Initializes the cache memory and SuperscalarHash using the provided key value.
*
* @param cache is a pointer to a previously allocated randomx_cache structure. Must not be NULL.
* @param seed is a pointer to memory which contains the seed value. Must not be NULL.
* @param seedSize is the number of bytes of the seed.
* @param key is a pointer to memory which contains the key value. Must not be NULL.
* @param keySize is the number of bytes of the key.
*/
void randomx_init_cache(randomx_cache *cache, const void *seed, size_t seedSize);
void randomx_init_cache(randomx_cache *cache, const void *key, size_t keySize);
/**
* Releases all memory occupied by the randomx_cache structure.
@ -146,7 +146,7 @@ randomx_vm *randomx_create_vm(randomx_flags flags, randomx_cache *cache, randomx
/**
* Reinitializes a virtual machine with a new Cache. This function should be called anytime
* the Cache is reinitialized with a new seed.
* the Cache is reinitialized with a new key.
*
* @param machine is a pointer to a randomx_vm structure that was initialized
* without RANDOMX_FLAG_FULL_MEM. Must not be NULL.

@ -126,7 +126,7 @@ int main(int argc, char** argv) {
if (miningMode) {
flags = (randomx_flags)(flags | RANDOMX_FLAG_FULL_MEM);
std::cout << " - full memory mode (2 GiB)" << std::endl;
std::cout << " - full memory mode (2080 MiB)" << std::endl;
}
else {
std::cout << " - light memory mode (256 MiB)" << std::endl;

@ -23,7 +23,6 @@ along with RandomX. If not, see<http://www.gnu.org/licenses/>.
#include <sstream>
#include <cmath>
#include <cfloat>
#include <climits>
#include "vm_interpreted.hpp"
#include "dataset.hpp"
#include "intrin_portable.h"

Loading…
Cancel
Save