randomx project changed to a static library

separate benchmark project
API usage examples
This commit is contained in:
tevador
2019-04-21 00:20:21 +02:00
parent d7eefce583
commit 41557ce010
29 changed files with 979 additions and 15048 deletions

25
src/tests/api-example1.c Normal file
View File

@@ -0,0 +1,25 @@
#include "../randomx.h"
#include <stdio.h>
int main() {
const char mySeed[] = "RandomX example seed";
const char myInput[] = "RandomX example input";
char hash[RANDOMX_HASH_SIZE];
randomx_cache *myCache = randomx_alloc_cache(RANDOMX_FLAG_DEFAULT);
randomx_init_cache(myCache, mySeed, sizeof mySeed);
randomx_vm *myMachine = randomx_create_vm(RANDOMX_FLAG_DEFAULT);
randomx_vm_set_cache(myMachine, myCache);
randomx_calculate_hash(myMachine, &myInput, sizeof myInput, hash);
randomx_destroy_vm(myMachine);
randomx_release_cache(myCache);
for (unsigned i = 0; i < RANDOMX_HASH_SIZE; ++i)
printf("%02x", hash[i] & 0xff);
printf("\n");
return 0;
}