mirror of
https://github.com/xmrig/xmrig.git
synced 2025-01-11 05:14:40 +00:00
Added support for cn-lite/ipbc.
This commit is contained in:
parent
ca149d2eed
commit
ba5f92c6dd
4 changed files with 96 additions and 18 deletions
|
@ -112,6 +112,21 @@ const static uint8_t test_output_v1_lite[160] = {
|
|||
0x8C, 0x2B, 0xA4, 0x1F, 0x60, 0x76, 0x39, 0xD7, 0xF6, 0x46, 0x77, 0x18, 0x20, 0xAD, 0xD4, 0xC9,
|
||||
0x87, 0xF7, 0x37, 0xDA, 0xFD, 0xBA, 0xBA, 0xD2, 0xF2, 0x68, 0xDC, 0x26, 0x8D, 0x1B, 0x08, 0xC6
|
||||
};
|
||||
|
||||
|
||||
// IPBC
|
||||
const static uint8_t test_output_ipbc_lite[160] = {
|
||||
0xE4, 0x93, 0x8C, 0xAA, 0x59, 0x8D, 0x02, 0x8A, 0xB8, 0x6F, 0x25, 0xD2, 0xB1, 0x23, 0xD0, 0xD5,
|
||||
0x33, 0xE3, 0x9F, 0x37, 0xAC, 0xE5, 0xF8, 0xEB, 0x7A, 0xE8, 0x40, 0xEB, 0x5D, 0xB1, 0x35, 0x5F,
|
||||
0xB2, 0x47, 0x86, 0xF0, 0x7F, 0x6F, 0x4B, 0x55, 0x3E, 0xA1, 0xBB, 0xE8, 0xA1, 0x75, 0x00, 0x2D,
|
||||
0x07, 0x9A, 0x21, 0x0E, 0xBD, 0x06, 0x6A, 0xB0, 0xFD, 0x96, 0x9E, 0xE6, 0xE4, 0x69, 0x67, 0xBB,
|
||||
0x88, 0x45, 0x0B, 0x91, 0x0B, 0x7B, 0xCB, 0x21, 0x3C, 0x3C, 0x09, 0x30, 0x07, 0x71, 0x07, 0xD5,
|
||||
0xB8, 0x2D, 0x83, 0x09, 0xAF, 0x7E, 0xB2, 0xA8, 0xAC, 0x25, 0xDC, 0x10, 0xF8, 0x63, 0x6A, 0xBC,
|
||||
0x73, 0x01, 0x4E, 0xA8, 0x1C, 0xDA, 0x9A, 0x86, 0x17, 0xEC, 0xA8, 0xFB, 0xAA, 0x23, 0x23, 0x17,
|
||||
0xE1, 0x32, 0x68, 0x9C, 0x4C, 0xF4, 0x08, 0xED, 0xB0, 0x15, 0xC3, 0xA9, 0x0F, 0xF0, 0xA2, 0x7E,
|
||||
0xD9, 0xE4, 0x23, 0xA7, 0x9E, 0x91, 0xD8, 0x73, 0x94, 0xD6, 0x6C, 0x70, 0x9B, 0x8B, 0x72, 0x92,
|
||||
0xA3, 0xA4, 0x0A, 0xE2, 0x3C, 0x0A, 0x34, 0x88, 0xA1, 0x6D, 0xFE, 0x02, 0x44, 0x60, 0x7B, 0x3D
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -457,13 +457,22 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si
|
|||
al0 += hi;
|
||||
ah0 += lo;
|
||||
|
||||
VARIANT1_2(ah0, 0);
|
||||
((uint64_t*)&l0[idx0 & MASK])[0] = al0;
|
||||
((uint64_t*)&l0[idx0 & MASK])[1] = ah0;
|
||||
VARIANT1_2(ah0, 0);
|
||||
|
||||
ah0 ^= ch;
|
||||
if (VARIANT > 0) {
|
||||
if (VARIANT == xmrig::VARIANT_IBPC) {
|
||||
((uint64_t*)&l0[idx0 & MASK])[1] = ah0 ^ tweak1_2_0 ^ al0;
|
||||
}
|
||||
else {
|
||||
((uint64_t*)&l0[idx0 & MASK])[1] = ah0 ^ tweak1_2_0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
((uint64_t*)&l0[idx0 & MASK])[1] = ah0;
|
||||
}
|
||||
|
||||
al0 ^= cl;
|
||||
ah0 ^= ch;
|
||||
idx0 = al0;
|
||||
|
||||
if (ALGO == xmrig::CRYPTONIGHT_HEAVY) {
|
||||
|
@ -556,13 +565,22 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
|
|||
al0 += hi;
|
||||
ah0 += lo;
|
||||
|
||||
VARIANT1_2(ah0, 0);
|
||||
((uint64_t*) &l0[idx0 & MASK])[0] = al0;
|
||||
((uint64_t*) &l0[idx0 & MASK])[1] = ah0;
|
||||
VARIANT1_2(ah0, 0);
|
||||
((uint64_t*)&l0[idx0 & MASK])[0] = al0;
|
||||
|
||||
if (VARIANT > 0) {
|
||||
if (VARIANT == xmrig::VARIANT_IBPC) {
|
||||
((uint64_t*)&l0[idx0 & MASK])[1] = ah0 ^ tweak1_2_0 ^ al0;
|
||||
}
|
||||
else {
|
||||
((uint64_t*)&l0[idx0 & MASK])[1] = ah0 ^ tweak1_2_0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
((uint64_t*)&l0[idx0 & MASK])[1] = ah0;
|
||||
}
|
||||
|
||||
ah0 ^= ch;
|
||||
al0 ^= cl;
|
||||
ah0 ^= ch;
|
||||
idx0 = al0;
|
||||
|
||||
if (ALGO == xmrig::CRYPTONIGHT_HEAVY) {
|
||||
|
@ -581,13 +599,22 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
|
|||
al1 += hi;
|
||||
ah1 += lo;
|
||||
|
||||
VARIANT1_2(ah1, 1);
|
||||
((uint64_t*) &l1[idx1 & MASK])[0] = al1;
|
||||
((uint64_t*) &l1[idx1 & MASK])[1] = ah1;
|
||||
VARIANT1_2(ah1, 1);
|
||||
((uint64_t*)&l1[idx1 & MASK])[0] = al1;
|
||||
|
||||
if (VARIANT > 0) {
|
||||
if (VARIANT == xmrig::VARIANT_IBPC) {
|
||||
((uint64_t*)&l1[idx1 & MASK])[1] = ah1 ^ tweak1_2_1 ^ al1;
|
||||
}
|
||||
else {
|
||||
((uint64_t*)&l1[idx1 & MASK])[1] = ah1 ^ tweak1_2_1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
((uint64_t*)&l1[idx1 & MASK])[1] = ah1;
|
||||
}
|
||||
|
||||
ah1 ^= ch;
|
||||
al1 ^= cl;
|
||||
ah1 ^= ch;
|
||||
idx1 = al1;
|
||||
|
||||
if (ALGO == xmrig::CRYPTONIGHT_HEAVY) {
|
||||
|
@ -644,6 +671,10 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
|
|||
\
|
||||
if (VARIANT > 0) { \
|
||||
_mm_store_si128(ptr, _mm_xor_si128(a, mc)); \
|
||||
\
|
||||
if (VARIANT == xmrig::VARIANT_IBPC) { \
|
||||
((uint64_t*)ptr)[1] ^= ((uint64_t*)ptr)[0]; \
|
||||
} \
|
||||
} else { \
|
||||
_mm_store_si128(ptr, a); \
|
||||
} \
|
||||
|
|
|
@ -62,9 +62,9 @@ bool xmrig::CpuThread::isSoftAES(AlgoVariant av)
|
|||
|
||||
xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant av, Variant variant)
|
||||
{
|
||||
assert(variant == VARIANT_0 || variant == VARIANT_1);
|
||||
assert(variant == VARIANT_0 || variant == VARIANT_1 || variant == VARIANT_IBPC || variant == VARIANT_XTL);
|
||||
|
||||
static const cn_hash_fun func_table[50] = {
|
||||
static const cn_hash_fun func_table[90] = {
|
||||
cryptonight_single_hash<CRYPTONIGHT, false, VARIANT_0>,
|
||||
cryptonight_double_hash<CRYPTONIGHT, false, VARIANT_0>,
|
||||
cryptonight_single_hash<CRYPTONIGHT, true, VARIANT_0>,
|
||||
|
@ -87,6 +87,19 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
|
|||
cryptonight_quad_hash<CRYPTONIGHT, true, VARIANT_1>,
|
||||
cryptonight_penta_hash<CRYPTONIGHT, true, VARIANT_1>,
|
||||
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
|
||||
cryptonight_single_hash<CRYPTONIGHT, false, VARIANT_XTL>,
|
||||
cryptonight_double_hash<CRYPTONIGHT, false, VARIANT_XTL>,
|
||||
cryptonight_single_hash<CRYPTONIGHT, true, VARIANT_XTL>,
|
||||
cryptonight_double_hash<CRYPTONIGHT, true, VARIANT_XTL>,
|
||||
cryptonight_triple_hash<CRYPTONIGHT, false, VARIANT_XTL>,
|
||||
cryptonight_quad_hash<CRYPTONIGHT, false, VARIANT_XTL>,
|
||||
cryptonight_penta_hash<CRYPTONIGHT, false, VARIANT_XTL>,
|
||||
cryptonight_triple_hash<CRYPTONIGHT, true, VARIANT_XTL>,
|
||||
cryptonight_quad_hash<CRYPTONIGHT, true, VARIANT_XTL>,
|
||||
cryptonight_penta_hash<CRYPTONIGHT, true, VARIANT_XTL>,
|
||||
|
||||
# ifndef XMRIG_NO_AEON
|
||||
cryptonight_single_hash<CRYPTONIGHT_LITE, false, VARIANT_0>,
|
||||
cryptonight_double_hash<CRYPTONIGHT_LITE, false, VARIANT_0>,
|
||||
|
@ -109,9 +122,24 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
|
|||
cryptonight_triple_hash<CRYPTONIGHT_LITE, true, VARIANT_1>,
|
||||
cryptonight_quad_hash<CRYPTONIGHT_LITE, true, VARIANT_1>,
|
||||
cryptonight_penta_hash<CRYPTONIGHT_LITE, true, VARIANT_1>,
|
||||
|
||||
cryptonight_single_hash<CRYPTONIGHT_LITE, false, VARIANT_IBPC>,
|
||||
cryptonight_double_hash<CRYPTONIGHT_LITE, false, VARIANT_IBPC>,
|
||||
cryptonight_single_hash<CRYPTONIGHT_LITE, true, VARIANT_IBPC>,
|
||||
cryptonight_double_hash<CRYPTONIGHT_LITE, true, VARIANT_IBPC>,
|
||||
cryptonight_triple_hash<CRYPTONIGHT_LITE, false, VARIANT_IBPC>,
|
||||
cryptonight_quad_hash<CRYPTONIGHT_LITE, false, VARIANT_IBPC>,
|
||||
cryptonight_penta_hash<CRYPTONIGHT_LITE, false, VARIANT_IBPC>,
|
||||
cryptonight_triple_hash<CRYPTONIGHT_LITE, true, VARIANT_IBPC>,
|
||||
cryptonight_quad_hash<CRYPTONIGHT_LITE, true, VARIANT_IBPC>,
|
||||
cryptonight_penta_hash<CRYPTONIGHT_LITE, true, VARIANT_IBPC>,
|
||||
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
# else
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
# endif
|
||||
|
||||
# ifndef XMRIG_NO_SUMO
|
||||
|
@ -136,7 +164,7 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
|
|||
}
|
||||
# endif
|
||||
|
||||
return func_table[20 * algorithm + 10 * variant + av - 1];
|
||||
return func_table[40 * algorithm + 10 * variant + av - 1];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -65,8 +65,12 @@ bool MultiWorker<N>::selfTest()
|
|||
# ifndef XMRIG_NO_AEON
|
||||
if (m_thread->algorithm() == xmrig::CRYPTONIGHT_LITE && memcmp(m_hash, test_output_v0_lite, sizeof m_hash) == 0) {
|
||||
m_thread->fn(xmrig::VARIANT_1)(test_input, 76, m_hash, m_ctx);
|
||||
if (memcmp(m_hash, test_output_v1_lite, sizeof m_hash) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return memcmp(m_hash, test_output_v1_lite, sizeof m_hash) == 0;
|
||||
m_thread->fn(xmrig::VARIANT_IBPC)(test_input, 76, m_hash, m_ctx);
|
||||
return memcmp(m_hash, test_output_ipbc_lite, sizeof m_hash) == 0;
|
||||
}
|
||||
# endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue