Implemented Monero v1 pow changes
* Adds arm implementation and test code for single hash * Fixed build break for when APP_DEBUG is set * Applied new icons / design
This commit is contained in:
parent
9098c4936a
commit
75952e0eb4
9 changed files with 317 additions and 19 deletions
|
@ -105,7 +105,7 @@ bool CryptoNight::selfTest(int algo)
|
|||
{
|
||||
if (cryptonight_hash_ctx[0] == nullptr || cryptonight_hash_ctx[2] == nullptr ||
|
||||
cryptonight_hash_ctx[2] == nullptr || cryptonight_hash_ctx[3] == nullptr ||
|
||||
cryptonight_hash_ctx[4] == nullptr) {
|
||||
cryptonight_hash_ctx[4] == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -115,22 +115,35 @@ bool CryptoNight::selfTest(int algo)
|
|||
ctx->memory = (uint8_t *) _mm_malloc(MEMORY * 6, 16);
|
||||
|
||||
cryptonight_hash_ctx[0](test_input, 76, output, ctx);
|
||||
bool resultSingle = memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output1 : test_output0, 32) == 0;
|
||||
bool resultSingle = memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_light : test_output, 32) == 0;
|
||||
|
||||
cryptonight_hash_ctx[1](test_input, 76, output, ctx);
|
||||
bool resultDouble = memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output1 : test_output0, 64) == 0;
|
||||
bool resultDouble = memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_light : test_output, 64) == 0;
|
||||
|
||||
cryptonight_hash_ctx[2](test_input, 76, output, ctx);
|
||||
bool resultTriple = memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output1 : test_output0, 96) == 0;
|
||||
bool resultTriple = memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_light : test_output, 96) == 0;
|
||||
|
||||
cryptonight_hash_ctx[3](test_input, 76, output, ctx);
|
||||
bool resultQuadruple = memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output1 : test_output0, 128) == 0;
|
||||
bool resultQuadruple = memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_light : test_output, 128) == 0;
|
||||
|
||||
cryptonight_hash_ctx[4](test_input, 76, output, ctx);
|
||||
bool resultQuintuple = memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output1 : test_output0, 160) == 0;
|
||||
bool resultQuintuple = memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_light : test_output, 160) == 0;
|
||||
|
||||
// monero v1 pow
|
||||
bool resultV1Pow = true;
|
||||
if (algo == Options::ALGO_CRYPTONIGHT)
|
||||
{
|
||||
cryptonight_hash_ctx[0](test_input_monero_v1_pow_0, sizeof(test_input_monero_v1_pow_0), output, ctx);
|
||||
resultV1Pow = resultV1Pow &&memcmp(output, test_output_monero_v1_pow[0], 32) == 0;
|
||||
cryptonight_hash_ctx[1](test_input_monero_v1_pow_1, sizeof(test_input_monero_v1_pow_1), output, ctx);
|
||||
resultV1Pow = resultV1Pow &&memcmp(output, test_output_monero_v1_pow[1], 32) == 0;
|
||||
cryptonight_hash_ctx[2](test_input_monero_v1_pow_2, sizeof(test_input_monero_v1_pow_2), output, ctx);
|
||||
resultV1Pow = resultV1Pow &&memcmp(output, test_output_monero_v1_pow[2], 32) == 0;
|
||||
//TODO test multihashs
|
||||
}
|
||||
|
||||
_mm_free(ctx->memory);
|
||||
_mm_free(ctx);
|
||||
|
||||
return resultSingle && resultDouble && resultTriple && resultQuadruple && resultQuintuple;
|
||||
return resultSingle && resultDouble && resultTriple && resultQuadruple && resultQuintuple && resultV1Pow;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue