|
|
|
@ -31,7 +31,9 @@ template<size_t K, size_t H>
|
|
|
|
|
void calcStringHash(const char(&key)[K], const char(&input)[H], void* output) {
|
|
|
|
|
initCache(key);
|
|
|
|
|
assert(vm != nullptr);
|
|
|
|
|
#if RANDOMX_HASH_SIZE == 32
|
|
|
|
|
randomx_calculate_hash(vm, input, H - 1, output);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<size_t K, size_t H>
|
|
|
|
@ -40,7 +42,9 @@ void calcHexHash(const char(&key)[K], const char(&hex)[H], void* output) {
|
|
|
|
|
assert(vm != nullptr);
|
|
|
|
|
char input[H / 2];
|
|
|
|
|
hex2bin((char*)hex, H - 1, input);
|
|
|
|
|
#if RANDOMX_HASH_SIZE == 32
|
|
|
|
|
randomx_calculate_hash(vm, input, sizeof(input), output);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int testNo = 0;
|
|
|
|
@ -1051,6 +1055,7 @@ int main() {
|
|
|
|
|
assert(cacheMemory[33554431] == 0x1f47f056d05cd99b);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
#if RANDOMX_HASH_SIZE == 32
|
|
|
|
|
runTest("Hash batch test", RANDOMX_HAVE_COMPILER && stringsEqual(RANDOMX_ARGON_SALT, "RandomX\x03"), []() {
|
|
|
|
|
char hash1[RANDOMX_HASH_SIZE];
|
|
|
|
|
char hash2[RANDOMX_HASH_SIZE];
|
|
|
|
@ -1069,6 +1074,7 @@ int main() {
|
|
|
|
|
assert(equalsHex(hash2, "300a0adb47603dedb42228ccb2b211104f4da45af709cd7547cd049e9489c969"));
|
|
|
|
|
assert(equalsHex(hash3, "c36d4ed4191e617309867ed66a443be4075014e2b061bcdaf9ce7b721d2b77a8"));
|
|
|
|
|
});
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
randomx_destroy_vm(vm);
|
|
|
|
|
vm = nullptr;
|
|
|
|
|