|
|
@ -1178,23 +1178,10 @@ void static RandomXMiner() |
|
|
|
|
|
|
|
char randomxHash[RANDOMX_HASH_SIZE]; |
|
|
|
fprintf(stderr,"RandomXMiner: created randomxHash of size %d\n", RANDOMX_HASH_SIZE); |
|
|
|
// Initial randomx key is chain magic || ac_name which is >= 2^40 bits of entropy assuming strlen(ac_name) >= 1
|
|
|
|
// For ac_name=DRAGONX we have 4 + 7 = 11 bytes or 2^88 bits of entropy
|
|
|
|
//int randomxKeySize = sizeof(randomxKey); // 4 + strlen(SMART_CHAIN_SYMBOL)];
|
|
|
|
char randomxKey[] = "RANDOMX"; |
|
|
|
//fprintf(stderr,"RandomXMiner: creating randomxKey of size %d\n", randomxKeySize);
|
|
|
|
/*
|
|
|
|
randomxKey[0] = ASSETCHAINS_MAGIC & 0xff; |
|
|
|
randomxKey[1] = (ASSETCHAINS_MAGIC >> 8) & 0xff; |
|
|
|
randomxKey[2] = (ASSETCHAINS_MAGIC >> 16) & 0xff; |
|
|
|
randomxKey[3] = (ASSETCHAINS_MAGIC >> 24) & 0xff; |
|
|
|
|
|
|
|
for(int i=0; i++; i<strlen(SMART_CHAIN_SYMBOL) ) { |
|
|
|
randomxKey[4+i] = SMART_CHAIN_SYMBOL[i]; |
|
|
|
fprintf(stderr,"RandomXMiner: added %s to randomxKey\n", SMART_CHAIN_SYMBOL[i]); |
|
|
|
} |
|
|
|
fprintf(stderr,"RandomXMiner: created randomxKey=%s\n", randomxKey); |
|
|
|
*/ |
|
|
|
// Initial randomx key is ac_name which is >= 2^40 bits of entropy assuming strlen(ac_name) >= 5
|
|
|
|
// For ac_name=DRAGONX we have 7 bytes or 2^56 bits of entropy
|
|
|
|
char randomxKey[65]; // randomx spec says keysize of >60 bytes is implementation-specific
|
|
|
|
strncpy(randomxKey, SMART_CHAIN_SYMBOL, 65); |
|
|
|
|
|
|
|
crypto_generichash_blake2b_state state; |
|
|
|
// Hash = blake2b( key || ac_name)
|
|
|
@ -1203,8 +1190,11 @@ void static RandomXMiner() |
|
|
|
//crypto_generichash_blake2b_update(&state, (unsigned char*)&SMART_CHAIN_SYMBOL[0], sizeof(SMART_CHAIN_SYMBOL));
|
|
|
|
//uchar randomxInput[32];
|
|
|
|
//crypto_generichash_blake2b_final(&state, randomxInput, 32);
|
|
|
|
unsigned char randomxInput[] = "RANDOMX"; |
|
|
|
fprintf(stderr,"RandomXMiner: created randomxInput\n"); |
|
|
|
//unsigned char randomxInput[] = "RANDOMX";
|
|
|
|
char randomxInput[80]; |
|
|
|
sprintf(randomxInput, "%08x", ASSETCHAINS_MAGIC); |
|
|
|
|
|
|
|
fprintf(stderr,"RandomXMiner: created randomxInput=%s\n", randomxInput); |
|
|
|
|
|
|
|
randomx_flags flags = randomx_get_flags(); |
|
|
|
randomx_cache *randomxCache = randomx_alloc_cache(flags); |
|
|
@ -1237,7 +1227,7 @@ void static RandomXMiner() |
|
|
|
//crypto_generichash_blake2b_update(&new_state, (unsigned char *)&randomxBlockKey, 32);
|
|
|
|
//crypto_generichash_blake2b_final(&new_state, randomxInput, 32);
|
|
|
|
|
|
|
|
randomx_init_cache(randomxCache, &randomxBlockKey, sizeof randomxKey); |
|
|
|
randomx_init_cache(randomxCache, &randomxBlockKey, sizeof randomxBlockKey); |
|
|
|
fprintf(stderr,"RandomXMiner: initialized cache with randomxBlockKey=%s\n", randomxBlockKey.ToString().c_str()); |
|
|
|
} |
|
|
|
|
|
|
|