Added chukwa-wrkz algo variant
This commit is contained in:
parent
51587ee38b
commit
836e8b24f3
5 changed files with 33 additions and 7 deletions
|
@ -111,7 +111,7 @@ void CpuImpl::optimizeParameters(size_t& threadsCount, size_t& hashFactor,
|
|||
|
||||
if (algo == Options::ALGO_CRYPTONIGHT_HEAVY || powVariant == POW_XFH) {
|
||||
maximumReasonableHashFactor = 3;
|
||||
} else if (getBaseVariant(powVariant) == POW_V2 || getBaseVariant(powVariant) == POW_V4 || algo == Options::ALGO_CRYPTONIGHT_EXTREMELITE || algo == Options::ALGO_CRYPTONIGHT_ULTRALITE) {
|
||||
} else if (getCNBaseVariant(powVariant) == POW_V2 || getCNBaseVariant(powVariant) == POW_V4 || algo == Options::ALGO_CRYPTONIGHT_EXTREMELITE || algo == Options::ALGO_CRYPTONIGHT_ULTRALITE) {
|
||||
maximumReasonableHashFactor = 2;
|
||||
} else if (!Options::isCNAlgo(algo)) {
|
||||
maximumReasonableHashFactor = 1;
|
||||
|
|
|
@ -354,7 +354,8 @@ constexpr static const char *pow_variant_names[] = {
|
|||
"zls",
|
||||
"graft",
|
||||
"upx2",
|
||||
"chukwa"
|
||||
"chukwa",
|
||||
"wrkz"
|
||||
};
|
||||
|
||||
constexpr static const char *asm_optimization_names[] = {
|
||||
|
@ -1178,6 +1179,12 @@ bool Options::setAlgo(const char *algo)
|
|||
break;
|
||||
}
|
||||
|
||||
if (i == ARRAY_SIZE(algo_names) - 1 && (!strcmp(algo, "argon2-wrkz") || !strcmp(algo, "wrkz"))) {
|
||||
m_algo = ALGO_ARGON2_256;
|
||||
m_powVariant = POW_ARGON2_WRKZ;
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == ARRAY_SIZE(algo_names) - 1) {
|
||||
showUsage(1);
|
||||
return false;
|
||||
|
@ -1188,6 +1195,10 @@ bool Options::setAlgo(const char *algo)
|
|||
m_powVariant = POW_ARGON2_CHUKWA;
|
||||
}
|
||||
|
||||
if (m_algo == ALGO_ARGON2_256 && m_powVariant == POW_AUTODETECT) {
|
||||
m_powVariant = POW_ARGON2_WRKZ;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ enum PowVariant
|
|||
POW_RWZ,
|
||||
POW_UPX2,
|
||||
POW_ARGON2_CHUKWA,
|
||||
POW_ARGON2_WRKZ,
|
||||
LAST_ITEM
|
||||
};
|
||||
|
||||
|
@ -95,6 +96,8 @@ inline std::string getPowVariantName(PowVariant powVariant)
|
|||
return "upx2";
|
||||
case POW_ARGON2_CHUKWA:
|
||||
return "chukwa";
|
||||
case POW_ARGON2_WRKZ:
|
||||
return "wrkz";
|
||||
case POW_AUTODETECT:
|
||||
default:
|
||||
return "-1";
|
||||
|
@ -184,12 +187,14 @@ inline PowVariant parseVariant(const std::string variant)
|
|||
powVariant = PowVariant::POW_UPX2;
|
||||
} else if (variant == "chukwa" || variant == "trtl-chukwa" || variant == "argon2-chukwa") {
|
||||
powVariant = PowVariant::POW_ARGON2_CHUKWA;
|
||||
} else if (variant == "chukwa_wrkz" || variant == "wrkz" || variant == "argon2-wrkz") {
|
||||
powVariant = PowVariant::POW_ARGON2_WRKZ;
|
||||
}
|
||||
|
||||
return powVariant;
|
||||
}
|
||||
|
||||
inline PowVariant getBaseVariant(PowVariant powVariant)
|
||||
inline PowVariant getCNBaseVariant(PowVariant powVariant)
|
||||
{
|
||||
switch (powVariant)
|
||||
{
|
||||
|
|
|
@ -39,4 +39,11 @@ const static uint8_t argon2_chukwa_test_out[32] = {
|
|||
0x0d, 0x2e
|
||||
};
|
||||
|
||||
const static uint8_t argon2_wrkz_test_out[32] = {
|
||||
0xB2, 0xFB, 0x90, 0x2B, 0xF4, 0x95, 0x99, 0x83, 0x9A, 0x61,
|
||||
0xCA, 0x28, 0xA4, 0xF9, 0x81, 0xD5, 0x49, 0x68, 0x8F, 0xCD,
|
||||
0x87, 0x59, 0xC4, 0x05, 0xE6, 0x79, 0xED, 0x9E, 0xF1, 0x36,
|
||||
0xD1, 0xB9,
|
||||
};
|
||||
|
||||
#endif /* __ARGON2_TEST_H__ */
|
||||
|
|
|
@ -456,6 +456,10 @@ static void argon2(AsmOptimization asmOptimization, uint64_t height, PowVariant
|
|||
if (variant == PowVariant::POW_ARGON2_CHUKWA || variant == POW_TURTLE) {
|
||||
argon2id_hash_raw(3, MEMORY_ARGON2_512/1024, 1, input, size, input, 16, output, 32, scratchPad[0]->memory, MEMORY_ARGON2_512);
|
||||
}
|
||||
|
||||
if (variant == PowVariant::POW_ARGON2_WRKZ) {
|
||||
argon2id_hash_raw(4, MEMORY_ARGON2_256/1024, 1, input, size, input, 16, output, 32, scratchPad[0]->memory, MEMORY_ARGON2_256);
|
||||
}
|
||||
}
|
||||
|
||||
void (*hash_ctx[MAX_NUM_HASH_BLOCKS])(AsmOptimization asmOptimization, uint64_t height, PowVariant variant, const uint8_t* input, size_t size, uint8_t* output, ScratchPad** scratchPad);
|
||||
|
@ -914,22 +918,21 @@ bool HashSelector::selfCheck(Options::Algo algo)
|
|||
argon2_select_impl(NULL, NULL);
|
||||
}
|
||||
else if (algo == Options::ALGO_ARGON2_256) {
|
||||
// Trigger Benchmark once to setup CPU instruction set
|
||||
argon2_select_impl(NULL, NULL);
|
||||
|
||||
hash_ctx[0](asmOptimization, 0, PowVariant::POW_ARGON2_WRKZ, argon2_test_input, 76, output, scratchPads);
|
||||
resultArgon2 = resultArgon2 && memcmp(output, argon2_wrkz_test_out, 32) == 0;
|
||||
}
|
||||
else if (algo == Options::ALGO_ARGON2_500) {
|
||||
// Trigger Benchmark once to setup CPU instruction set
|
||||
argon2_select_impl(NULL, NULL);
|
||||
}
|
||||
else if (algo == Options::ALGO_ARGON2_512) {
|
||||
// Trigger Benchmark once to setup CPU instruction set
|
||||
argon2_select_impl(NULL, NULL);
|
||||
|
||||
hash_ctx[0](asmOptimization, 0, PowVariant::POW_ARGON2_CHUKWA, argon2_test_input, 76, output, scratchPads);
|
||||
resultArgon2 = resultArgon2 && memcmp(output, argon2_chukwa_test_out, 32) == 0;
|
||||
}
|
||||
else if (algo == Options::ALGO_ARGON2_4096) {
|
||||
// Trigger Benchmark once to setup CPU instruction set
|
||||
argon2_select_impl(NULL, NULL);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue