mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
Byteswap computed hash in hashtest so it can be correctly checked
This commit is contained in:
parent
d8770654f5
commit
e01d6941c1
10
main.c
10
main.c
@ -4222,13 +4222,21 @@ bool hashtest(const struct work *work)
|
||||
unsigned char swap[128];
|
||||
uint32_t *swap32 = (uint32_t *)swap;
|
||||
unsigned char hash1[32];
|
||||
unsigned char hash2[32];
|
||||
uint32_t *hash2_32 = (uint32_t *)hash2;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 80 / 4; i++)
|
||||
swap32[i] = swab32(data32[i]);
|
||||
|
||||
sha2(swap, 80, hash1, false);
|
||||
sha2(hash1, 32, (unsigned char *)(work->hash), false);
|
||||
sha2(hash1, 32, hash2, false);
|
||||
|
||||
for (i = 0; i < 32 / 4; i++)
|
||||
hash2_32[i] = swab32(hash2_32[i]);
|
||||
|
||||
memcpy((void*)work->hash, hash2, 32);
|
||||
|
||||
return fulltest(work->hash, work->target);
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user