Merge branch 'master' into pr-mo-flex-msvc-error

This commit is contained in:
MoneroOcean 2024-05-29 09:31:00 -07:00 committed by GitHub
commit 2a90c51f69
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 46 additions and 10 deletions

View file

@ -63,8 +63,13 @@ static inline void do_skein_hash(const uint8_t *input, size_t len, uint8_t *outp
xmr_skein(input, output);
}
static inline void do_flex_skein_hash(const uint8_t* input, size_t len, uint8_t* output) {
int r = skein_hash(512, input, 8 * len, (uint8_t*)output);
assert(SKEIN_SUCCESS == r);
}
void (* const extra_hashes[4])(const uint8_t *, size_t, uint8_t *) = {do_blake_hash, do_groestl_hash, do_jh_hash, do_skein_hash};
void (* const extra_hashes_flex[3])(const uint8_t *, size_t, uint8_t *) = {do_blake_hash, do_groestl_hash, do_flex_skein_hash};
// This will shift and xor tmp1 into itself as 4 32-bit vals such as
@ -543,7 +548,10 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si
cn_implode_scratchpad<ALGO, SOFT_AES>(reinterpret_cast<const __m128i *>(ctx[0]->memory), reinterpret_cast<__m128i *>(ctx[0]->state));
keccakf(h0, 24);
extra_hashes[ctx[0]->state[0] & 3](ctx[0]->state, 200, output);
if (height == 101) // Flex algo ugly hack
extra_hashes_flex[ctx[0]->state[0] & 2](ctx[0]->state, 200, output);
else
extra_hashes[ctx[0]->state[0] & 3](ctx[0]->state, 200, output);
}

View file

@ -74,16 +74,14 @@ static void selectAlgo(unsigned char nibble, bool* selectedAlgos, uint8_t* selec
}
static void getAlgoString(void *mem, unsigned int size, uint8_t* selectedAlgoOutput, int algoCount) {
int i;
unsigned char *p = (unsigned char *)mem;
unsigned int len = size/2;
unsigned char j = 0;
bool* selectedAlgo = new bool[algoCount];
for(int z=0; z < algoCount; z++) {
selectedAlgo[z] = false;
}
int selectedCount = 0;
for (i=0;i<len; i++) {
for (unsigned int i=0;i<len; i++) {
selectAlgo(p[i], selectedAlgo, selectedAlgoOutput, algoCount, &selectedCount);
if(selectedCount == algoCount) {
break;
@ -101,10 +99,9 @@ static void getAlgoString(void *mem, unsigned int size, uint8_t* selectedAlgoOut
}
void print_hex_memory(void *mem, unsigned int size) {
int i;
unsigned char *p = (unsigned char *)mem;
unsigned int len = size/2;
for (i=0;i<len; i++) {
for (unsigned int i=0;i<len; i++) {
printf("%02x", p[(len - i - 1)]);
}
printf("\n");
@ -127,7 +124,6 @@ void flex_hash(const char* input, char* output, cryptonight_ctx** ctx) {
sph_blake512_context ctx_blake;
sph_bmw512_context ctx_bmw;
sph_groestl512_context ctx_groestl;
sph_jh512_context ctx_jh;
sph_keccak512_context ctx_keccak;
sph_skein512_context ctx_skein;
sph_luffa512_context ctx_luffa;
@ -139,7 +135,6 @@ void flex_hash(const char* input, char* output, cryptonight_ctx** ctx) {
sph_fugue512_context ctx_fugue;
sph_shabal512_context ctx_shabal;
sph_whirlpool_context ctx_whirlpool;
sph_sha256_context ctx_sha;
void *in = (void*) input;
int size = 80;
sph_keccak512_init(&ctx_keccak);