Merged features for # 1.6.3 (#114)

- Added shift+click function for multi row selection to Dashboard
- Added -DBUILD_STATIC=ON/OFF option to CMake configuration to create fully static builds
- Added current algo and list of supported_varaints to login message for future usage on proxy
- Added support for latest Stellite (XTL) and Alloy (XAO) variants
- Simplification of configuration, "force-pow-variant" and "cryptonight-lite-ipbc" parameters are now deprecated see [Coin Configuration](https://github.com/Bendr0id/xmrigCC/wiki/Coin-configurations) for guidance
- Fixed leaks in transport shutdown
This commit is contained in:
Ben Gräf 2018-05-23 23:23:49 +02:00 committed by GitHub
parent dc6bcacaed
commit f54ce3c95c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 654 additions and 431 deletions

View file

@ -34,74 +34,70 @@
#include "crypto/CryptoNight_test.h"
template <size_t NUM_HASH_BLOCKS>
static void cryptonight_aesni(Options::PowVersion powVersion, const uint8_t* input, size_t size, uint8_t* output, cryptonight_ctx *ctx) {
static void cryptonight_aesni(PowVariant powVersion, const uint8_t* input, size_t size, uint8_t* output, cryptonight_ctx *ctx) {
# if !defined(XMRIG_ARMv7)
if ((reinterpret_cast<const uint8_t*>(input)[0] > 6 && powVersion == Options::PowVersion::POW_AUTODETECT) ||
powVersion == Options::PowVersion::POW_V2) {
CryptoNightMultiHash<0x80000, MEMORY, 0x1FFFF0, false, NUM_HASH_BLOCKS>::hashPowV2(input, size, output, ctx);
if (powVersion == PowVariant::POW_V1) {
CryptoNightMultiHash<0x80000, POW_DEFAULT_INDEX_SHIFT, MEMORY, 0x1FFFF0, false, NUM_HASH_BLOCKS>::hashPowV2(input, size, output, ctx);
} else if (powVersion == PowVariant::POW_ALLOY) {
CryptoNightMultiHash<0x100000, POW_DEFAULT_INDEX_SHIFT, MEMORY, 0x1FFFF0, false, NUM_HASH_BLOCKS>::hash(input, size, output, ctx);
} else if (powVersion == PowVariant::POW_XTL) {
CryptoNightMultiHash<0x80000, POW_XLT_V4_INDEX_SHIFT, MEMORY, 0x1FFFF0, false, NUM_HASH_BLOCKS>::hashPowV2(input, size, output, ctx);
} else {
CryptoNightMultiHash<0x80000, MEMORY, 0x1FFFF0, false, NUM_HASH_BLOCKS>::hash(input, size, output, ctx);
CryptoNightMultiHash<0x80000, POW_DEFAULT_INDEX_SHIFT, MEMORY, 0x1FFFF0, false, NUM_HASH_BLOCKS>::hash(input, size, output, ctx);
}
# endif
}
template <size_t NUM_HASH_BLOCKS>
static void cryptonight_softaes(Options::PowVersion powVersion, const uint8_t* input, size_t size, uint8_t* output, cryptonight_ctx *ctx) {
if ((reinterpret_cast<const uint8_t*>(input)[0] > 6 && powVersion == Options::PowVersion::POW_AUTODETECT) ||
powVersion == Options::PowVersion::POW_V2) {
CryptoNightMultiHash<0x80000, MEMORY, 0x1FFFF0, true, NUM_HASH_BLOCKS>::hashPowV2(input, size, output, ctx);
static void cryptonight_softaes(PowVariant powVersion, const uint8_t* input, size_t size, uint8_t* output, cryptonight_ctx *ctx) {
if (powVersion == PowVariant::POW_V1) {
CryptoNightMultiHash<0x80000, POW_DEFAULT_INDEX_SHIFT, MEMORY, 0x1FFFF0, true, NUM_HASH_BLOCKS>::hashPowV2(input, size, output, ctx);
} else if (powVersion == PowVariant::POW_ALLOY) {
CryptoNightMultiHash<0x100000, POW_DEFAULT_INDEX_SHIFT, MEMORY, 0x1FFFF0, true, NUM_HASH_BLOCKS>::hash(input, size, output, ctx);
} else if (powVersion == PowVariant::POW_XTL) {
CryptoNightMultiHash<0x80000, POW_XLT_V4_INDEX_SHIFT, MEMORY, 0x1FFFF0, true, NUM_HASH_BLOCKS>::hashPowV2(input, size, output, ctx);
} else {
CryptoNightMultiHash<0x80000, MEMORY, 0x1FFFF0, true, NUM_HASH_BLOCKS>::hash(input, size, output, ctx);
CryptoNightMultiHash<0x80000, POW_DEFAULT_INDEX_SHIFT, MEMORY, 0x1FFFF0, true, NUM_HASH_BLOCKS>::hash(input, size, output, ctx);
}
}
template <size_t NUM_HASH_BLOCKS>
static void cryptonight_lite_aesni(Options::PowVersion powVersion, const uint8_t* input, size_t size, uint8_t* output, cryptonight_ctx *ctx) {
static void cryptonight_lite_aesni(PowVariant powVersion, const uint8_t* input, size_t size, uint8_t* output, cryptonight_ctx *ctx) {
# if !defined(XMRIG_ARMv7)
if ((reinterpret_cast<const uint8_t*>(input)[0] > 1 && powVersion == Options::PowVersion::POW_AUTODETECT) ||
powVersion == Options::PowVersion::POW_V2) {
CryptoNightMultiHash<0x40000, MEMORY_LITE, 0xFFFF0, false, NUM_HASH_BLOCKS>::hashPowV2(input, size, output, ctx);
if (powVersion == PowVariant::POW_V1) {
CryptoNightMultiHash<0x40000, POW_DEFAULT_INDEX_SHIFT, MEMORY_LITE, 0xFFFF0, false, NUM_HASH_BLOCKS>::hashPowV2(input, size, output, ctx);
} else if (powVersion == PowVariant::POW_IPBC) {
CryptoNightMultiHash<0x40000, POW_DEFAULT_INDEX_SHIFT, MEMORY_LITE, 0xFFFF0, false, NUM_HASH_BLOCKS>::hashLiteIpbc(input, size, output, ctx);
} else {
CryptoNightMultiHash<0x40000, MEMORY_LITE, 0xFFFF0, false, NUM_HASH_BLOCKS>::hash(input, size, output, ctx);
CryptoNightMultiHash<0x40000, POW_DEFAULT_INDEX_SHIFT, MEMORY_LITE, 0xFFFF0, false, NUM_HASH_BLOCKS>::hash(input, size, output, ctx);
}
# endif
}
template <size_t NUM_HASH_BLOCKS>
static void cryptonight_lite_softaes(Options::PowVersion powVersion, const uint8_t* input, size_t size, uint8_t* output, cryptonight_ctx *ctx) {
if ((reinterpret_cast<const uint8_t*>(input)[0] > 1 && powVersion == Options::PowVersion::POW_AUTODETECT) ||
powVersion == Options::PowVersion::POW_V2) {
CryptoNightMultiHash<0x40000, MEMORY_LITE, 0xFFFF0, true, NUM_HASH_BLOCKS>::hashPowV2(input, size, output, ctx);
static void cryptonight_lite_softaes(PowVariant powVersion, const uint8_t* input, size_t size, uint8_t* output, cryptonight_ctx *ctx) {
if (powVersion == PowVariant::POW_V1) {
CryptoNightMultiHash<0x40000, POW_DEFAULT_INDEX_SHIFT, MEMORY_LITE, 0xFFFF0, true, NUM_HASH_BLOCKS>::hashPowV2(input, size, output, ctx);
} else if (powVersion == PowVariant::POW_IPBC) {
CryptoNightMultiHash<0x40000, POW_DEFAULT_INDEX_SHIFT, MEMORY_LITE, 0xFFFF0, true, NUM_HASH_BLOCKS>::hashLiteIpbc(input, size, output, ctx);
} else {
CryptoNightMultiHash<0x40000, MEMORY_LITE, 0xFFFF0, true, NUM_HASH_BLOCKS>::hash(input, size, output, ctx);
CryptoNightMultiHash<0x40000, POW_DEFAULT_INDEX_SHIFT, MEMORY_LITE, 0xFFFF0, true, NUM_HASH_BLOCKS>::hash(input, size, output, ctx);
}
}
template <size_t NUM_HASH_BLOCKS>
static void cryptonight_lite_ipbc_aesni(Options::PowVersion powVersion, const uint8_t* input, size_t size, uint8_t* output, cryptonight_ctx *ctx) {
static void cryptonight_heavy_aesni(PowVariant powVersion, const uint8_t* input, size_t size, uint8_t* output, cryptonight_ctx *ctx) {
# if !defined(XMRIG_ARMv7)
CryptoNightMultiHash<0x40000, MEMORY_LITE, 0xFFFF0, false, NUM_HASH_BLOCKS>::hashLiteIpbc(input, size, output, ctx);
CryptoNightMultiHash<0x40000, POW_DEFAULT_INDEX_SHIFT, MEMORY_HEAVY, 0x3FFFF0, false, NUM_HASH_BLOCKS>::hashHeavy(input, size, output, ctx);
# endif
}
template <size_t NUM_HASH_BLOCKS>
static void cryptonight_lite_ipbc_softaes(Options::PowVersion powVersion, const uint8_t* input, size_t size, uint8_t* output, cryptonight_ctx *ctx) {
CryptoNightMultiHash<0x40000, MEMORY_LITE, 0xFFFF0, true, NUM_HASH_BLOCKS>::hashLiteIpbc(input, size, output, ctx);
static void cryptonight_heavy_softaes(PowVariant powVersion, const uint8_t* input, size_t size, uint8_t* output, cryptonight_ctx *ctx) {
CryptoNightMultiHash<0x40000, POW_DEFAULT_INDEX_SHIFT, MEMORY_HEAVY, 0x3FFFF0, true, NUM_HASH_BLOCKS>::hashHeavy(input, size, output, ctx);
}
template <size_t NUM_HASH_BLOCKS>
static void cryptonight_heavy_aesni(Options::PowVersion powVersion, const uint8_t* input, size_t size, uint8_t* output, cryptonight_ctx *ctx) {
# if !defined(XMRIG_ARMv7)
CryptoNightMultiHash<0x40000, MEMORY_HEAVY, 0x3FFFF0, false, NUM_HASH_BLOCKS>::hashHeavy(input, size, output, ctx);
# endif
}
template <size_t NUM_HASH_BLOCKS>
static void cryptonight_heavy_softaes(Options::PowVersion powVersion, const uint8_t* input, size_t size, uint8_t* output, cryptonight_ctx *ctx) {
CryptoNightMultiHash<0x40000, MEMORY_HEAVY, 0x3FFFF0, true, NUM_HASH_BLOCKS>::hashHeavy(input, size, output, ctx);
}
void (*cryptonight_hash_ctx[MAX_NUM_HASH_BLOCKS])(Options::PowVersion powVersion, const uint8_t* input, size_t size, uint8_t* output, cryptonight_ctx *ctx);
void (*cryptonight_hash_ctx[MAX_NUM_HASH_BLOCKS])(PowVariant powVersion, const uint8_t* input, size_t size, uint8_t* output, cryptonight_ctx *ctx);
template <size_t HASH_FACTOR>
void setCryptoNightHashMethods(Options::Algo algo, bool aesni)
@ -123,14 +119,6 @@ void setCryptoNightHashMethods(Options::Algo algo, bool aesni)
}
break;
case Options::ALGO_CRYPTONIGHT_LITE_IPBC:
if (aesni) {
cryptonight_hash_ctx[HASH_FACTOR - 1] = cryptonight_lite_ipbc_aesni<HASH_FACTOR>;
} else {
cryptonight_hash_ctx[HASH_FACTOR - 1] = cryptonight_lite_ipbc_softaes<HASH_FACTOR>;
}
break;
case Options::ALGO_CRYPTONIGHT_HEAVY:
if (aesni) {
cryptonight_hash_ctx[HASH_FACTOR - 1] = cryptonight_heavy_aesni<HASH_FACTOR>;
@ -155,7 +143,7 @@ bool CryptoNight::init(int algo, bool aesni)
return selfTest(algo);
}
void CryptoNight::hash(size_t factor, Options::PowVersion powVersion, const uint8_t* input, size_t size, uint8_t* output, cryptonight_ctx* ctx)
void CryptoNight::hash(size_t factor, PowVariant powVersion, const uint8_t* input, size_t size, uint8_t* output, cryptonight_ctx* ctx)
{
cryptonight_hash_ctx[factor-1](powVersion, input, size, output, ctx);
}
@ -184,113 +172,180 @@ bool CryptoNight::selfTest(int algo)
auto ctx = (struct cryptonight_ctx*) _mm_malloc(sizeof(struct cryptonight_ctx), 16);
ctx->memory = (uint8_t *) _mm_malloc(MEMORY * 6, 16);
bool resultV1Pow = true;
bool resultV2Pow = true;
bool resultLiteIpbc = true;
bool result = true;
bool resultLite = true;
bool resultHeavy = true;
if (algo == Options::ALGO_CRYPTONIGHT_HEAVY) {
// cn-heavy tests
// cn-heavy
cryptonight_hash_ctx[0](Options::PowVersion::POW_AUTODETECT, test_input, 76, output, ctx);
cryptonight_hash_ctx[0](PowVariant::POW_V0, test_input, 76, output, ctx);
resultHeavy = resultHeavy && memcmp(output, test_output_heavy, 32) == 0;
#if MAX_NUM_HASH_BLOCKS > 1
cryptonight_hash_ctx[1](Options::PowVersion::POW_AUTODETECT, test_input, 76, output, ctx);
cryptonight_hash_ctx[1](PowVariant::POW_V0, test_input, 76, output, ctx);
resultHeavy = resultHeavy && memcmp(output, test_output_heavy, 64) == 0;
#endif
#if MAX_NUM_HASH_BLOCKS > 2
cryptonight_hash_ctx[2](Options::PowVersion::POW_AUTODETECT, test_input, 76, output, ctx);
cryptonight_hash_ctx[2](PowVariant::POW_V0, test_input, 76, output, ctx);
resultHeavy = resultHeavy && memcmp(output, test_output_heavy, 96) == 0;
#endif
} else if (algo == Options::ALGO_CRYPTONIGHT_LITE_IPBC) {
// cn-lite-ipbc tests
} else if (algo == Options::ALGO_CRYPTONIGHT_LITE) {
// cn-lite v0
cryptonight_hash_ctx[0](Options::PowVersion::POW_AUTODETECT, test_input_lite_ipbc, 43, output, ctx);
resultLiteIpbc = resultLiteIpbc && memcmp(output, test_output_lite_ipbc, 32) == 0;
cryptonight_hash_ctx[0](PowVariant::POW_V0, test_input, 76, output, ctx);
resultLite = resultLite && memcmp(output, test_output_v0_lite, 32) == 0;
#if MAX_NUM_HASH_BLOCKS > 1
cryptonight_hash_ctx[1](Options::PowVersion::POW_AUTODETECT, test_input_lite_ipbc, 43, output, ctx);
resultLiteIpbc = resultLiteIpbc && memcmp(output, test_output_lite_ipbc, 64) == 0;
cryptonight_hash_ctx[1](PowVariant::POW_V0, test_input, 76, output, ctx);
resultLite = resultLite && memcmp(output, test_output_v0_lite, 64) == 0;
#endif
#if MAX_NUM_HASH_BLOCKS > 2
cryptonight_hash_ctx[2](Options::PowVersion::POW_AUTODETECT, test_input_lite_ipbc, 43, output, ctx);
resultLiteIpbc = resultLiteIpbc && memcmp(output, test_output_lite_ipbc, 96) == 0;
cryptonight_hash_ctx[2](PowVariant::POW_V0, test_input, 76, output, ctx);
resultLite = resultLite && memcmp(output, test_output_v0_lite, 96) == 0;
#endif
#if MAX_NUM_HASH_BLOCKS > 3
cryptonight_hash_ctx[3](Options::PowVersion::POW_AUTODETECT, test_input_lite_ipbc, 43, output, ctx);
resultLiteIpbc = resultLiteIpbc && memcmp(output, test_output_lite_ipbc, 128) == 0;
cryptonight_hash_ctx[3](PowVariant::POW_V0, test_input, 76, output, ctx);
resultLite = resultLite && memcmp(output, test_output_v0_lite, 128) == 0;
#endif
#if MAX_NUM_HASH_BLOCKS > 4
cryptonight_hash_ctx[4](Options::PowVersion::POW_AUTODETECT, test_input_lite_ipbc, 43, output, ctx);
resultLiteIpbc = resultLiteIpbc && memcmp(output, test_output_lite_ipbc, 160) == 0;
cryptonight_hash_ctx[4](PowVariant::POW_V0, test_input, 76, output, ctx);
resultLite = resultLite && memcmp(output, test_output_v0_lite, 160) == 0;
#endif
// cn-lite v7 tests
cryptonight_hash_ctx[0](PowVariant::POW_V1, test_input, 76, output, ctx);
resultLite = resultLite && memcmp(output, test_output_v1_lite, 32) == 0;
#if MAX_NUM_HASH_BLOCKS > 1
cryptonight_hash_ctx[1](PowVariant::POW_V1, test_input, 76, output, ctx);
resultLite = resultLite && memcmp(output, test_output_v1_lite, 64) == 0;
#endif
#if MAX_NUM_HASH_BLOCKS > 2
cryptonight_hash_ctx[2](PowVariant::POW_V1, test_input, 76, output, ctx);
resultLite = resultLite && memcmp(output, test_output_v1_lite, 96) == 0;
#endif
#if MAX_NUM_HASH_BLOCKS > 3
cryptonight_hash_ctx[3](PowVariant::POW_V1, test_input, 76, output, ctx);
resultLite = resultLite && memcmp(output, test_output_v1_lite, 128) == 0;
#endif
#if MAX_NUM_HASH_BLOCKS > 4
cryptonight_hash_ctx[4](PowVariant::POW_V1, test_input, 76, output, ctx);
resultLite = resultLite && memcmp(output, test_output_v1_lite, 160) == 0;
#endif
// cn-lite ibpc tests
cryptonight_hash_ctx[0](PowVariant::POW_IPBC, test_input, 76, output, ctx);
resultLite = resultLite && memcmp(output, test_output_ipbc_lite, 32) == 0;
#if MAX_NUM_HASH_BLOCKS > 1
cryptonight_hash_ctx[1](PowVariant::POW_IPBC, test_input, 76, output, ctx);
resultLite = resultLite && memcmp(output, test_output_ipbc_lite, 64) == 0;
#endif
#if MAX_NUM_HASH_BLOCKS > 2
cryptonight_hash_ctx[2](PowVariant::POW_IPBC, test_input, 76, output, ctx);
resultLite = resultLite && memcmp(output, test_output_ipbc_lite, 96) == 0;
#endif
#if MAX_NUM_HASH_BLOCKS > 3
cryptonight_hash_ctx[3](PowVariant::POW_IPBC, test_input, 76, output, ctx);
resultLite = resultLite && memcmp(output, test_output_ipbc_lite, 128) == 0;
#endif
#if MAX_NUM_HASH_BLOCKS > 4
cryptonight_hash_ctx[4](PowVariant::POW_IPBC, test_input, 76, output, ctx);
resultLite = resultLite && memcmp(output, test_output_ipbc_lite, 160) == 0;
#endif
} else {
// < v7 tests autodetect
cryptonight_hash_ctx[0](Options::PowVersion::POW_AUTODETECT,test_input, 76, output, ctx);
resultV1Pow = resultV1Pow &&
memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_light : test_output,
32) == 0;
// cn v0
cryptonight_hash_ctx[0](PowVariant::POW_V0,test_input, 76, output, ctx);
result = result && memcmp(output, test_output_v0, 32) == 0;
#if MAX_NUM_HASH_BLOCKS > 1
cryptonight_hash_ctx[1](Options::PowVersion::POW_AUTODETECT, test_input, 76, output, ctx);
resultV1Pow = resultV1Pow &&
memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_light : test_output,
64) == 0;
cryptonight_hash_ctx[1](PowVariant::POW_V0, test_input, 76, output, ctx);
result = result && memcmp(output, test_output_v0, 64) == 0;
#endif
#if MAX_NUM_HASH_BLOCKS > 2
cryptonight_hash_ctx[2](Options::PowVersion::POW_AUTODETECT, test_input, 76, output, ctx);
resultV1Pow = resultV1Pow &&
memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_light : test_output,
96) == 0;
cryptonight_hash_ctx[2](PowVariant::POW_V0, test_input, 76, output, ctx);
result = result && memcmp(output, test_output_v0, 96) == 0;
#endif
// < v7 tests force pow
#if MAX_NUM_HASH_BLOCKS > 3
cryptonight_hash_ctx[3](Options::PowVersion::POW_V1, test_input, 76, output, ctx);
resultV1Pow = resultV1Pow &&
memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_light : test_output,
128) == 0;
cryptonight_hash_ctx[3](PowVariant::POW_V0, test_input, 76, output, ctx);
result = result && memcmp(output, test_output_v0, 128) == 0;
#endif
#if MAX_NUM_HASH_BLOCKS > 4
cryptonight_hash_ctx[4](Options::PowVersion::POW_V1, test_input, 76, output, ctx);
resultV1Pow = resultV1Pow &&
memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_light : test_output,
160) == 0;
cryptonight_hash_ctx[4](PowVariant::POW_V0, test_input, 76, output, ctx);
result = result && memcmp(output, test_output_v0, 160) == 0;
#endif
// v7 tests autodetect
cryptonight_hash_ctx[0](Options::PowVersion::POW_AUTODETECT, test_input_monero_v2_pow_0,
sizeof(test_input_monero_v2_pow_0), output, ctx);
resultV2Pow = resultV2Pow && memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE
? test_output_monero_v2_pow_light[0]
: test_output_monero_v2_pow[0], 32) == 0;
// cn v7
cryptonight_hash_ctx[0](PowVariant::POW_V1, test_input, 76, output, ctx);
result = result && memcmp(output, test_output_v1, 32) == 0;
#if MAX_NUM_HASH_BLOCKS > 1
cryptonight_hash_ctx[1](Options::PowVersion::POW_AUTODETECT, test_input_monero_v2_pow_1,
sizeof(test_input_monero_v2_pow_1), output, ctx);
resultV2Pow = resultV2Pow && memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE
? test_output_monero_v2_pow_light[1]
: test_output_monero_v2_pow[1], 32) == 0;
cryptonight_hash_ctx[1](PowVariant::POW_V1, test_input, 76, output, ctx);
result = result && memcmp(output, test_output_v1, 64) == 0;
#endif
// v7 tests force pow
#if MAX_NUM_HASH_BLOCKS > 2
cryptonight_hash_ctx[2](Options::PowVersion::POW_V2, test_input_monero_v2_pow_2,
sizeof(test_input_monero_v2_pow_2), output, ctx);
resultV2Pow = resultV2Pow && memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE
? test_output_monero_v2_pow_light[2]
: test_output_monero_v2_pow[2], 32) == 0;
cryptonight_hash_ctx[2](PowVariant::POW_V1, test_input, 76, output, ctx);
result = result && memcmp(output, test_output_v1, 96) == 0;
#endif
#if MAX_NUM_HASH_BLOCKS > 3
cryptonight_hash_ctx[3](PowVariant::POW_V1, test_input, 76, output, ctx);
result = result && memcmp(output, test_output_v1, 128) == 0;
#endif
#if MAX_NUM_HASH_BLOCKS > 4
cryptonight_hash_ctx[4](PowVariant::POW_V1, test_input, 76, output, ctx);
result = result && memcmp(output, test_output_v1, 160) == 0;
#endif
// cn xtl
cryptonight_hash_ctx[0](PowVariant::POW_XTL,test_input, 76, output, ctx);
result = result && memcmp(output, test_output_xtl, 32) == 0;
#if MAX_NUM_HASH_BLOCKS > 1
cryptonight_hash_ctx[1](PowVariant::POW_XTL, test_input, 76, output, ctx);
result = result && memcmp(output, test_output_xtl, 64) == 0;
#endif
#if MAX_NUM_HASH_BLOCKS > 2
cryptonight_hash_ctx[2](PowVariant::POW_XTL, test_input, 76, output, ctx);
result = result && memcmp(output, test_output_xtl, 96) == 0;
#endif
#if MAX_NUM_HASH_BLOCKS > 3
cryptonight_hash_ctx[3](PowVariant::POW_XTL, test_input, 76, output, ctx);
result = result && memcmp(output, test_output_xtl, 128) == 0;
#endif
#if MAX_NUM_HASH_BLOCKS > 4
cryptonight_hash_ctx[4](PowVariant::POW_XTL, test_input, 76, output, ctx);
result = result && memcmp(output, test_output_xtl, 160) == 0;
#endif
}
_mm_free(ctx->memory);
_mm_free(ctx);
return resultV1Pow && resultV2Pow & resultLiteIpbc & resultHeavy;
return result && resultLite & resultHeavy;
}

View file

@ -34,6 +34,9 @@
#define MEMORY_LITE 1048576 /* 1 MiB */
#define MEMORY_HEAVY 4194304 /* 4 MiB */
#define POW_DEFAULT_INDEX_SHIFT 3
#define POW_XLT_V4_INDEX_SHIFT 4
struct cryptonight_ctx {
alignas(16) uint8_t state[MAX_NUM_HASH_BLOCKS][208]; // 208 instead of 200 to maintain aligned to 16 byte boundaries
alignas(16) uint8_t* memory;
@ -48,7 +51,7 @@ class CryptoNight
public:
static bool init(int algo, bool aesni);
static void hash(size_t factor, Options::PowVersion powVersion, const uint8_t* input, size_t size, uint8_t* output, cryptonight_ctx* ctx);
static void hash(size_t factor, PowVariant powVersion, const uint8_t* input, size_t size, uint8_t* output, cryptonight_ctx* ctx);
private:
static bool selfTest(int algo);

View file

@ -570,7 +570,7 @@ static inline void cn_implode_scratchpad_heavy(const __m128i* input, __m128i* ou
}
// n-Loop version. Seems to be little bit slower then the hardcoded one.
template<size_t ITERATIONS, size_t MEM, size_t MASK, bool SOFT_AES, size_t NUM_HASH_BLOCKS>
template<size_t ITERATIONS, size_t INDEX_SHIFT, size_t MEM, size_t MASK, bool SOFT_AES, size_t NUM_HASH_BLOCKS>
class CryptoNightMultiHash
{
public:
@ -697,7 +697,7 @@ public:
const uint8_t tmp = reinterpret_cast<const uint8_t*>(&l[hashBlock][idx[hashBlock] & MASK])[11];
static const uint32_t table = 0x75310;
const uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
const uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l[hashBlock][idx[hashBlock] & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx[hashBlock] = EXTRACT64(cx);
@ -782,7 +782,7 @@ public:
const uint8_t tmp = reinterpret_cast<const uint8_t*>(&l[hashBlock][idx[hashBlock] & MASK])[11];
static const uint32_t table = 0x75310;
const uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
const uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l[hashBlock][idx[hashBlock] & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx[hashBlock] = EXTRACT64(cx);
@ -900,8 +900,8 @@ public:
}
};
template<size_t ITERATIONS, size_t MEM, size_t MASK, bool SOFT_AES>
class CryptoNightMultiHash<ITERATIONS, MEM, MASK, SOFT_AES, 1>
template<size_t ITERATIONS, size_t INDEX_SHIFT, size_t MEM, size_t MASK, bool SOFT_AES>
class CryptoNightMultiHash<ITERATIONS, INDEX_SHIFT, MEM, MASK, SOFT_AES, 1>
{
public:
inline static void hash(const uint8_t* __restrict__ input,
@ -1008,7 +1008,7 @@ public:
_mm_store_si128((__m128i*) &l[idx & MASK], _mm_xor_si128(bx, cx));
const uint8_t tmp = reinterpret_cast<const uint8_t*>(&l[idx & MASK])[11];
static const uint32_t table = 0x75310;
const uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
const uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l[idx & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx = EXTRACT64(cx);
bx = cx;
@ -1078,7 +1078,7 @@ public:
_mm_store_si128((__m128i*) &l[idx & MASK], _mm_xor_si128(bx, cx));
const uint8_t tmp = reinterpret_cast<const uint8_t*>(&l[idx & MASK])[11];
static const uint32_t table = 0x75310;
const uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
const uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l[idx & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx = EXTRACT64(cx);
bx = cx;
@ -1178,8 +1178,8 @@ public:
}
};
template<size_t ITERATIONS, size_t MEM, size_t MASK, bool SOFT_AES>
class CryptoNightMultiHash<ITERATIONS, MEM, MASK, SOFT_AES, 2>
template<size_t ITERATIONS, size_t INDEX_SHIFT, size_t MEM, size_t MASK, bool SOFT_AES>
class CryptoNightMultiHash<ITERATIONS, INDEX_SHIFT, MEM, MASK, SOFT_AES, 2>
{
public:
inline static void hash(const uint8_t* __restrict__ input,
@ -1329,10 +1329,10 @@ public:
static const uint32_t table = 0x75310;
uint8_t tmp = reinterpret_cast<const uint8_t*>(&l0[idx0 & MASK])[11];
uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l0[idx0 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l1[idx1 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l1[idx1 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx0 = EXTRACT64(cx0);
@ -1439,10 +1439,10 @@ public:
static const uint32_t table = 0x75310;
uint8_t tmp = reinterpret_cast<const uint8_t*>(&l0[idx0 & MASK])[11];
uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l0[idx0 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l1[idx1 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l1[idx1 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx0 = EXTRACT64(cx0);
@ -1607,8 +1607,8 @@ public:
}
};
template<size_t ITERATIONS, size_t MEM, size_t MASK, bool SOFT_AES>
class CryptoNightMultiHash<ITERATIONS, MEM, MASK, SOFT_AES, 3>
template<size_t ITERATIONS, size_t INDEX_SHIFT, size_t MEM, size_t MASK, bool SOFT_AES>
class CryptoNightMultiHash<ITERATIONS, INDEX_SHIFT, MEM, MASK, SOFT_AES, 3>
{
public:
inline static void hash(const uint8_t* __restrict__ input,
@ -1808,13 +1808,13 @@ public:
static const uint32_t table = 0x75310;
uint8_t tmp = reinterpret_cast<const uint8_t*>(&l0[idx0 & MASK])[11];
uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l0[idx0 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l1[idx1 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l1[idx1 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l2[idx2 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l2[idx2 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx0 = EXTRACT64(cx0);
@ -1960,13 +1960,13 @@ public:
static const uint32_t table = 0x75310;
uint8_t tmp = reinterpret_cast<const uint8_t*>(&l0[idx0 & MASK])[11];
uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l0[idx0 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l1[idx1 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l1[idx1 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l2[idx2 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l2[idx2 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx0 = EXTRACT64(cx0);
@ -2199,8 +2199,8 @@ public:
}
};
template<size_t ITERATIONS, size_t MEM, size_t MASK, bool SOFT_AES>
class CryptoNightMultiHash<ITERATIONS, MEM, MASK, SOFT_AES, 4>
template<size_t ITERATIONS, size_t INDEX_SHIFT, size_t MEM, size_t MASK, bool SOFT_AES>
class CryptoNightMultiHash<ITERATIONS, INDEX_SHIFT, MEM, MASK, SOFT_AES, 4>
{
public:
inline static void hash(const uint8_t* __restrict__ input,
@ -2448,16 +2448,16 @@ public:
static const uint32_t table = 0x75310;
uint8_t tmp = reinterpret_cast<const uint8_t*>(&l0[idx0 & MASK])[11];
uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l0[idx0 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l1[idx1 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l1[idx1 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l2[idx2 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l2[idx2 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l3[idx3 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l3[idx3 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx0 = EXTRACT64(cx0);
@ -2640,16 +2640,16 @@ public:
static const uint32_t table = 0x75310;
uint8_t tmp = reinterpret_cast<const uint8_t*>(&l0[idx0 & MASK])[11];
uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l0[idx0 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l1[idx1 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l1[idx1 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l2[idx2 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l2[idx2 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l3[idx3 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l3[idx3 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx0 = EXTRACT64(cx0);
@ -2946,8 +2946,8 @@ public:
}
};
template<size_t ITERATIONS, size_t MEM, size_t MASK, bool SOFT_AES>
class CryptoNightMultiHash<ITERATIONS, MEM, MASK, SOFT_AES, 5>
template<size_t ITERATIONS, size_t INDEX_SHIFT, size_t MEM, size_t MASK, bool SOFT_AES>
class CryptoNightMultiHash<ITERATIONS, INDEX_SHIFT, MEM, MASK, SOFT_AES, 5>
{
public:
inline static void hash(const uint8_t* __restrict__ input,
@ -3243,19 +3243,19 @@ public:
static const uint32_t table = 0x75310;
uint8_t tmp = reinterpret_cast<const uint8_t*>(&l0[idx0 & MASK])[11];
uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l0[idx0 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l1[idx1 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l1[idx1 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l2[idx2 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l2[idx2 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l3[idx3 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l3[idx3 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l4[idx4 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l4[idx4 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx0 = EXTRACT64(cx0);
@ -3475,19 +3475,19 @@ public:
static const uint32_t table = 0x75310;
uint8_t tmp = reinterpret_cast<const uint8_t*>(&l0[idx0 & MASK])[11];
uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l0[idx0 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l1[idx1 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l1[idx1 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l2[idx2 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l2[idx2 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l3[idx3 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l3[idx3 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l4[idx4 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l4[idx4 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx0 = EXTRACT64(cx0);

View file

@ -5,6 +5,7 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2016-2017 XMRig <support@xmrig.com>
* Copyright 2018 BenDroid <ben@graef.in>
*
*
* This program is free software: you can redistribute it and/or modify
@ -24,177 +25,136 @@
#ifndef __CRYPTONIGHT_TEST_H__
#define __CRYPTONIGHT_TEST_H__
const static uint8_t test_input[] = {
0x01, 0x00, 0xFB, 0x8E, 0x8A, 0xC8, 0x05, 0x89, 0x93, 0x23, 0x37, 0x1B, 0xB7, 0x90, 0xDB, 0x19,
0x21, 0x8A, 0xFD, 0x8D, 0xB8, 0xE3, 0x75, 0x5D, 0x8B, 0x90, 0xF3, 0x9B, 0x3D, 0x55, 0x06, 0xA9,
0xAB, 0xCE, 0x4F, 0xA9, 0x12, 0x24, 0x45, 0x00, 0x00, 0x00, 0x00, 0xEE, 0x81, 0x46, 0xD4, 0x9F,
0xA9, 0x3E, 0xE7, 0x24, 0xDE, 0xB5, 0x7D, 0x12, 0xCB, 0xC6, 0xC6, 0xF3, 0xB9, 0x24, 0xD9, 0x46,
0x12, 0x7C, 0x7A, 0x97, 0x41, 0x8F, 0x93, 0x48, 0x82, 0x8F, 0x0F, 0x02,
0x03, 0x05, 0xA0, 0xDB, 0xD6, 0xBF, 0x05, 0xCF, 0x16, 0xE5, 0x03, 0xF3, 0xA6, 0x6F, 0x78, 0x00,
0x7C, 0xBF, 0x34, 0x14, 0x43, 0x32, 0xEC, 0xBF, 0xC2, 0x2E, 0xD9, 0x5C, 0x87, 0x00, 0x38, 0x3B,
0x30, 0x9A, 0xCE, 0x19, 0x23, 0xA0, 0x96, 0x4B, 0x00, 0x00, 0x00, 0x08, 0xBA, 0x93, 0x9A, 0x62,
0x72, 0x4C, 0x0D, 0x75, 0x81, 0xFC, 0xE5, 0x76, 0x1E, 0x9D, 0x8A, 0x0E, 0x6A, 0x1C, 0x3F, 0x92,
0x4F, 0xDD, 0x84, 0x93, 0xD1, 0x11, 0x56, 0x49, 0xC0, 0x5E, 0xB6, 0x01,
0x01, 0x00, 0xFB, 0x8E, 0x8A, 0xC8, 0x05, 0x89, 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, 0x00, 0x00, 0xEE, 0x81, 0x46, 0xD4, 0x9F,
0xA9, 0x3E, 0xE7, 0x24, 0xDE, 0xB5, 0x7D, 0x12, 0xCB, 0xC6, 0xC6, 0xF3, 0xB9, 0x24, 0xD9, 0x46,
0x12, 0x7C, 0x7A, 0x97, 0x41, 0x8F, 0x93, 0x48, 0x82, 0x8F, 0x0F, 0x02,
0x03, 0x05, 0xA0, 0xDB, 0xD6, 0xBF, 0x05, 0xCF, 0x16, 0xE5, 0x03, 0xF3, 0xA6, 0x6F, 0x78, 0x00,
0x7C, 0xBF, 0x34, 0x14, 0x43, 0x32, 0xEC, 0xBF, 0xC2, 0x2E, 0xD9, 0x5C, 0x87, 0x00, 0x38, 0x3B,
0x30, 0x9A, 0xCE, 0x19, 0x23, 0xA0, 0x96, 0x4B, 0x00, 0x00, 0x00, 0x08, 0xBA, 0x93, 0x9A, 0x62,
0x72, 0x4C, 0x0D, 0x75, 0x81, 0xFC, 0xE5, 0x76, 0x1E, 0x9D, 0x8A, 0x0E, 0x6A, 0x1C, 0x3F, 0x92,
0x4F, 0xDD, 0x84, 0x93, 0xD1, 0x11, 0x56, 0x49, 0xC0, 0x5E, 0xB6, 0x01
const static uint8_t test_input[380] = {
0x03, 0x05, 0xA0, 0xDB, 0xD6, 0xBF, 0x05, 0xCF, 0x16, 0xE5, 0x03, 0xF3, 0xA6, 0x6F, 0x78, 0x00,
0x7C, 0xBF, 0x34, 0x14, 0x43, 0x32, 0xEC, 0xBF, 0xC2, 0x2E, 0xD9, 0x5C, 0x87, 0x00, 0x38, 0x3B,
0x30, 0x9A, 0xCE, 0x19, 0x23, 0xA0, 0x96, 0x4B, 0x00, 0x00, 0x00, 0x08, 0xBA, 0x93, 0x9A, 0x62,
0x72, 0x4C, 0x0D, 0x75, 0x81, 0xFC, 0xE5, 0x76, 0x1E, 0x9D, 0x8A, 0x0E, 0x6A, 0x1C, 0x3F, 0x92,
0x4F, 0xDD, 0x84, 0x93, 0xD1, 0x11, 0x56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 0xa7, 0x40, 0x55, 0x89
};
const static uint8_t test_input_monero_v2_pow_1[] = {
0x37, 0xa6, 0x36, 0xd7, 0xda, 0xfd, 0xf2, 0x59, 0xb7, 0x28, 0x7e, 0xdd, 0xca, 0x2f, 0x58, 0x09,
0x9e, 0x98, 0x61, 0x9d, 0x2f, 0x99, 0xbd, 0xb8, 0x96, 0x9d, 0x7b, 0x14, 0x49, 0x81, 0x02, 0xcc,
0x06, 0x52, 0x01, 0xc8, 0xbe, 0x90, 0xbd, 0x77, 0x73, 0x23, 0xf4, 0x49, 0x84, 0x8b, 0x21, 0x5d,
0x29, 0x77, 0xc9, 0x2c, 0x4c, 0x1c, 0x2d, 0xa3, 0x6a, 0xb4, 0x6b, 0x2e, 0x38, 0x96, 0x89, 0xed,
0x97, 0xc1, 0x8f, 0xec, 0x08, 0xcd, 0x3b, 0x03, 0x23, 0x5c, 0x5e, 0x4c, 0x62, 0xa3, 0x7a, 0xd8,
0x8c, 0x7b, 0x67, 0x93, 0x24, 0x95, 0xa7, 0x10, 0x90, 0xe8, 0x5d, 0xd4, 0x02, 0x0a, 0x93, 0x00
};
const static uint8_t test_input_monero_v2_pow_2[] = {
0x38, 0x27, 0x4c, 0x97, 0xc4, 0x5a, 0x17, 0x2c, 0xfc, 0x97, 0x67, 0x98, 0x70, 0x42, 0x2e, 0x3a,
0x1a, 0xb0, 0x78, 0x49, 0x60, 0xc6, 0x05, 0x14, 0xd8, 0x16, 0x27, 0x14, 0x15, 0xc3, 0x06, 0xee,
0x3a, 0x3e, 0xd1, 0xa7, 0x7e, 0x31, 0xf6, 0xa8, 0x85, 0xc3, 0xcb
};
const static uint8_t test_output_monero_v2_pow[3][32] = {
{0x5b, 0xb4, 0x0c, 0x58, 0x80, 0xce, 0xf2, 0xf7, 0x39, 0xbd, 0xb6, 0xaa, 0xaf, 0x16, 0x16, 0x1e,
0xaa, 0xe5, 0x55, 0x30, 0xe7, 0xb1, 0x0d, 0x7e, 0xa9, 0x96, 0xb7, 0x51, 0xa2, 0x99, 0xe9, 0x49},
{0x61, 0x3e, 0x63, 0x85, 0x05, 0xba, 0x1f, 0xd0, 0x5f, 0x42, 0x8d, 0x5c, 0x9f, 0x8e, 0x08, 0xf8,
0x16, 0x56, 0x14, 0x34, 0x2d, 0xac, 0x41, 0x9a, 0xdc, 0x6a, 0x47, 0xdc, 0xe2, 0x57, 0xeb, 0x3e},
{0xed, 0x08, 0x2e, 0x49, 0xdb, 0xd5, 0xbb, 0xe3, 0x4a, 0x37, 0x26, 0xa0, 0xd1, 0xda, 0xd9, 0x81,
0x14, 0x60, 0x62, 0xb3, 0x9d, 0x36, 0xd6, 0x2c, 0x71, 0xeb, 0x1e, 0xd8, 0xab, 0x49, 0x45, 0x9b}
};
const static uint8_t test_output_monero_v2_pow_light[3][32] = {
{0xbb, 0x19, 0x6c, 0x4c, 0x0c, 0x9d, 0xc1, 0xc4, 0xe4, 0x4c, 0x2a, 0x6f, 0x9e, 0x61, 0x20, 0x0f,
0xe3, 0xc8, 0xb4, 0xef, 0x23, 0x21, 0x34, 0xe6, 0x5c, 0x3c, 0x78, 0x62, 0xc7, 0xd3, 0xdf, 0x6a},
{0x45, 0x21, 0x03, 0x73, 0x1d, 0xd8, 0xd7, 0x0c, 0xe3, 0x2f, 0x72, 0x6b, 0x8e, 0x71, 0xfc, 0xd9,
0x10, 0x05, 0xfb, 0x3c, 0xb2, 0xab, 0xd7, 0x8f, 0x2b, 0x73, 0x57, 0xbb, 0x07, 0xf8, 0xc8, 0xbc},
{0x4e, 0x78, 0x53, 0x76, 0xed, 0x27, 0x33, 0x26, 0x2d, 0x83, 0xcc, 0x25, 0x32, 0x1a, 0x9d, 0x00,
0x03, 0xf5, 0x39, 0x53, 0x15, 0xde, 0x91, 0x9a, 0xcf, 0x1b, 0x97, 0xf0, 0xa8, 0x4f, 0xbd, 0x2d}
};
const static uint8_t test_input_lite_ipbc[] = {
0x38, 0x27, 0x4c, 0x97, 0xc4, 0x5a, 0x17, 0x2c, 0x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0x68, 0xDC, 0x26, 0x8D, 0x1B, 0x08, 0xC6
};
// CN-Lite 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
};
// CN-Heavy
const static uint8_t test_output_heavy[160] = {
0x99, 0x83, 0xF2, 0x1B, 0xDF, 0x20, 0x10, 0xA8, 0xD7, 0x07, 0xBB, 0x2F, 0x14, 0xD7, 0x86, 0x64,
0xBB, 0xE1, 0x18, 0x7F, 0x55, 0x01, 0x4B, 0x39, 0xE5, 0xF3, 0xD6, 0x93, 0x28, 0xE4, 0x8F, 0xC2,
0x4D, 0x94, 0x7D, 0xD6, 0xDB, 0x6E, 0x07, 0x48, 0x26, 0x4A, 0x51, 0x2E, 0xAC, 0xF3, 0x25, 0x4A,
0x1F, 0x1A, 0xA2, 0x5B, 0xFC, 0x0A, 0xAD, 0x82, 0xDE, 0xA8, 0x99, 0x96, 0x88, 0x52, 0xD2, 0x7D,
0x3E, 0xE1, 0x23, 0x03, 0x5A, 0x63, 0x7B, 0x66, 0xF6, 0xD7, 0xC2, 0x2A, 0x34, 0x5E, 0x88, 0xE7,
0xFA, 0xC4, 0x25, 0x36, 0x54, 0xCB, 0xD2, 0x5C, 0x2F, 0x80, 0x2A, 0xF9, 0xCC, 0x43, 0xF7, 0xCD,
0xE5, 0x18, 0xA8, 0x05, 0x60, 0x18, 0xA5, 0x73, 0x72, 0x9B, 0x32, 0xDC, 0x69, 0x83, 0xC1, 0xE1,
0x1F, 0xDB, 0xDA, 0x6B, 0xAC, 0xEC, 0x9F, 0x67, 0xF8, 0x27, 0x1D, 0xC7, 0xE6, 0x46, 0x42, 0xF9,
0x53, 0x62, 0x0A, 0x54, 0x7D, 0x43, 0xEA, 0x18, 0x94, 0xED, 0xD8, 0x92, 0x06, 0x6A, 0xA1, 0x51,
0xAD, 0xB1, 0xFD, 0x89, 0xFB, 0x5C, 0xB4, 0x25, 0x6A, 0xDD, 0xB0, 0x09, 0xC5, 0x72, 0x87, 0xEB
};
#endif /* __CRYPTONIGHT_TEST_H__ */

View file

@ -468,7 +468,7 @@ static inline void cn_implode_scratchpad_heavy(const __m128i* input, __m128i* ou
}
// n-Loop version. Seems to be little bit slower then the hardcoded one.
template<size_t ITERATIONS, size_t MEM, size_t MASK, bool SOFT_AES, size_t NUM_HASH_BLOCKS>
template<size_t ITERATIONS, size_t INDEX_SHIFT, size_t MEM, size_t MASK, bool SOFT_AES, size_t NUM_HASH_BLOCKS>
class CryptoNightMultiHash
{
public:
@ -570,8 +570,7 @@ public:
al[hashBlock] = h[hashBlock][0] ^ h[hashBlock][4];
ah[hashBlock] = h[hashBlock][1] ^ h[hashBlock][5];
bx[hashBlock] =
_mm_set_epi64x(h[hashBlock][3] ^ h[hashBlock][7], h[hashBlock][2] ^ h[hashBlock][6]);
bx[hashBlock] = _mm_set_epi64x(h[hashBlock][3] ^ h[hashBlock][7], h[hashBlock][2] ^ h[hashBlock][6]);
idx[hashBlock] = h[hashBlock][0] ^ h[hashBlock][4];
}
@ -586,12 +585,11 @@ public:
cx = _mm_aesenc_si128(cx, _mm_set_epi64x(ah[hashBlock], al[hashBlock]));
}
_mm_store_si128((__m128i*) &l[hashBlock][idx[hashBlock] & MASK],
_mm_xor_si128(bx[hashBlock], cx));
_mm_store_si128((__m128i*) &l[hashBlock][idx[hashBlock] & MASK], _mm_xor_si128(bx[hashBlock], cx));
const uint8_t tmp = reinterpret_cast<const uint8_t*>(&l[hashBlock][idx[hashBlock] & MASK])[11];
static const uint32_t table = 0x75310;
const uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
const uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l[hashBlock][idx[hashBlock] & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx[hashBlock] = EXTRACT64(cx);
@ -674,7 +672,7 @@ public:
const uint8_t tmp = reinterpret_cast<const uint8_t*>(&l[hashBlock][idx[hashBlock] & MASK])[11];
static const uint32_t table = 0x75310;
const uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
const uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l[hashBlock][idx[hashBlock] & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx[hashBlock] = EXTRACT64(cx);
@ -790,8 +788,8 @@ public:
};
template<size_t ITERATIONS, size_t MEM, size_t MASK, bool SOFT_AES>
class CryptoNightMultiHash<ITERATIONS, MEM, MASK, SOFT_AES, 1>
template<size_t ITERATIONS, size_t INDEX_SHIFT, size_t MEM, size_t MASK, bool SOFT_AES>
class CryptoNightMultiHash<ITERATIONS, INDEX_SHIFT, MEM, MASK, SOFT_AES, 1>
{
public:
inline static void hash(const uint8_t* __restrict__ input,
@ -892,7 +890,7 @@ public:
_mm_store_si128((__m128i*) &l[idx & MASK], _mm_xor_si128(bx, cx));
const uint8_t tmp = reinterpret_cast<const uint8_t*>(&l[idx & MASK])[11];
static const uint32_t table = 0x75310;
const uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
const uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l[idx & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx = EXTRACT64(cx);
bx = cx;
@ -959,7 +957,7 @@ public:
_mm_store_si128((__m128i*) &l[idx & MASK], _mm_xor_si128(bx, cx));
const uint8_t tmp = reinterpret_cast<const uint8_t*>(&l[idx & MASK])[11];
static const uint32_t table = 0x75310;
const uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
const uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l[idx & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx = EXTRACT64(cx);
bx = cx;
@ -1056,8 +1054,8 @@ public:
}
};
template<size_t ITERATIONS, size_t MEM, size_t MASK, bool SOFT_AES>
class CryptoNightMultiHash<ITERATIONS, MEM, MASK, SOFT_AES, 2>
template<size_t ITERATIONS, size_t INDEX_SHIFT, size_t MEM, size_t MASK, bool SOFT_AES>
class CryptoNightMultiHash<ITERATIONS, INDEX_SHIFT, MEM, MASK, SOFT_AES, 2>
{
public:
inline static void hash(const uint8_t* __restrict__ input,
@ -1203,10 +1201,10 @@ public:
static const uint32_t table = 0x75310;
uint8_t tmp = reinterpret_cast<const uint8_t*>(&l0[idx0 & MASK])[11];
uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l0[idx0 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l1[idx1 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l1[idx1 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx0 = EXTRACT64(cx0);
@ -1311,10 +1309,10 @@ public:
static const uint32_t table = 0x75310;
uint8_t tmp = reinterpret_cast<const uint8_t*>(&l0[idx0 & MASK])[11];
uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l0[idx0 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l1[idx1 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l1[idx1 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx0 = EXTRACT64(cx0);
@ -1478,8 +1476,8 @@ public:
}
};
template<size_t ITERATIONS, size_t MEM, size_t MASK, bool SOFT_AES>
class CryptoNightMultiHash<ITERATIONS, MEM, MASK, SOFT_AES, 3>
template<size_t ITERATIONS, size_t INDEX_SHIFT, size_t MEM, size_t MASK, bool SOFT_AES>
class CryptoNightMultiHash<ITERATIONS, INDEX_SHIFT, MEM, MASK, SOFT_AES, 3>
{
public:
inline static void hash(const uint8_t* __restrict__ input,
@ -1675,13 +1673,13 @@ public:
static const uint32_t table = 0x75310;
uint8_t tmp = reinterpret_cast<const uint8_t*>(&l0[idx0 & MASK])[11];
uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l0[idx0 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l1[idx1 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l1[idx1 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l2[idx2 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l2[idx2 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx0 = EXTRACT64(cx0);
@ -1825,13 +1823,13 @@ public:
static const uint32_t table = 0x75310;
uint8_t tmp = reinterpret_cast<const uint8_t*>(&l0[idx0 & MASK])[11];
uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l0[idx0 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l1[idx1 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l1[idx1 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l2[idx2 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l2[idx2 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx0 = EXTRACT64(cx0);
@ -2062,8 +2060,8 @@ public:
}
};
template<size_t ITERATIONS, size_t MEM, size_t MASK, bool SOFT_AES>
class CryptoNightMultiHash<ITERATIONS, MEM, MASK, SOFT_AES, 4>
template<size_t ITERATIONS, size_t INDEX_SHIFT, size_t MEM, size_t MASK, bool SOFT_AES>
class CryptoNightMultiHash<ITERATIONS, INDEX_SHIFT, MEM, MASK, SOFT_AES, 4>
{
public:
inline static void hash(const uint8_t* __restrict__ input,
@ -2307,16 +2305,16 @@ public:
static const uint32_t table = 0x75310;
uint8_t tmp = reinterpret_cast<const uint8_t*>(&l0[idx0 & MASK])[11];
uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l0[idx0 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l1[idx1 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l1[idx1 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l2[idx2 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l2[idx2 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l3[idx3 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l3[idx3 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx0 = EXTRACT64(cx0);
@ -2497,16 +2495,16 @@ public:
static const uint32_t table = 0x75310;
uint8_t tmp = reinterpret_cast<const uint8_t*>(&l0[idx0 & MASK])[11];
uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l0[idx0 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l1[idx1 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l1[idx1 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l2[idx2 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l2[idx2 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l3[idx3 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l3[idx3 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx0 = EXTRACT64(cx0);
@ -2801,8 +2799,8 @@ public:
}
};
template<size_t ITERATIONS, size_t MEM, size_t MASK, bool SOFT_AES>
class CryptoNightMultiHash<ITERATIONS, MEM, MASK, SOFT_AES, 5>
template<size_t ITERATIONS, size_t INDEX_SHIFT, size_t MEM, size_t MASK, bool SOFT_AES>
class CryptoNightMultiHash<ITERATIONS, INDEX_SHIFT, MEM, MASK, SOFT_AES, 5>
{
public:
inline static void hash(const uint8_t* __restrict__ input,
@ -3094,19 +3092,19 @@ public:
static const uint32_t table = 0x75310;
uint8_t tmp = reinterpret_cast<const uint8_t*>(&l0[idx0 & MASK])[11];
uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l0[idx0 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l1[idx1 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l1[idx1 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l2[idx2 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l2[idx2 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l3[idx3 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l3[idx3 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l4[idx4 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l4[idx4 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx0 = EXTRACT64(cx0);
@ -3324,19 +3322,19 @@ public:
static const uint32_t table = 0x75310;
uint8_t tmp = reinterpret_cast<const uint8_t*>(&l0[idx0 & MASK])[11];
uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
uint8_t index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l0[idx0 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l1[idx1 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l1[idx1 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l2[idx2 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l2[idx2 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l3[idx3 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l3[idx3 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
tmp = reinterpret_cast<const uint8_t*>(&l4[idx4 & MASK])[11];
index = (((tmp >> 3) & 6) | (tmp & 1)) << 1;
index = (((tmp >> INDEX_SHIFT) & 6) | (tmp & 1)) << 1;
((uint8_t*)(&l4[idx4 & MASK]))[11] = tmp ^ ((table >> index) & 0x30);
idx0 = EXTRACT64(cx0);