mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-18 18:11:05 +00:00
Merge branch 'dev'
This commit is contained in:
commit
b736f0a558
17 changed files with 388 additions and 175 deletions
|
@ -1,3 +1,10 @@
|
|||
# v2.6.4
|
||||
- [#700](https://github.com/xmrig/xmrig/issues/700) `cryptonight-lite/ipbc` replaced to `cryptonight-heavy/tube` for **Bittube (TUBE)**.
|
||||
- Added `cryptonight/rto` (cryptonight variant 1 with IPBC/TUBE mod) variant for **Arto (RTO)** coin.
|
||||
- Added `cryptonight/xao` (original cryptonight with bigger iteration count) variant for **Alloy (XAO)** coin.
|
||||
- Better variant detection for **nicehash.com** and **minergate.com**.
|
||||
- [#692](https://github.com/xmrig/xmrig/issues/692) Added support for specify both algorithm and variant via single `algo` option.
|
||||
|
||||
# v2.6.3
|
||||
- **Added support for new cryptonight-heavy variant xhv** (`cn-heavy/xhv`) for upcoming Haven Protocol fork.
|
||||
- **Added support for new cryptonight variant msr** (`cn/msr`) also known as `cryptonight-fast` for upcoming Masari fork.
|
||||
|
|
|
@ -6,36 +6,7 @@ Algorithm selection splitted to 2 parts:
|
|||
|
||||
* Global base algorithm per miner or proxy instance, `algo` option. Possible values: `cryptonight`, `cryptonight-lite`, `cryptonight-heavy`.
|
||||
* Algorithm variant specified separately for each pool, `variant` option.
|
||||
|
||||
Possible variants for `cryptonight`:
|
||||
|
||||
* `0` Original cryptonight.
|
||||
* `1` cryptonight variant 1, also known as cryptonight v7 or monero7.
|
||||
* `"xtl"` Stellite coin variant.
|
||||
|
||||
Possible variants for `cryptonight-lite`:
|
||||
|
||||
* `0` Original cryptonight-lite.
|
||||
* `1` cryptonight-lite variant 1, also known as cryptonight-lite v7 or aeon7.
|
||||
* `"ipbc"` IPBC coin variant.
|
||||
|
||||
For `cryptonight-heavy` currently no variants.
|
||||
|
||||
|
||||
### Cheatsheet
|
||||
|
||||
You mine **Sumokoin** or **Haven Protocol**?
|
||||
Your algorithm is `cryptonight-heavy` no variant option need.
|
||||
|
||||
You mine **Aeon**, **TurtleCoin** or **IPBC**?
|
||||
Your base algorithm is `cryptonight-lite`:
|
||||
|
||||
Variants:
|
||||
* Aeon: `-1` autodetect. `0` right now, `1` after fork.
|
||||
* TurtleCoin: `1`.
|
||||
* IPBC: `"ipbc"`.
|
||||
|
||||
In all other cases base algorithm is `cryptonight`.
|
||||
* [Full table for supported algorithm and variants.](https://github.com/xmrig/xmrig-proxy/blob/master/doc/STRATUM_EXT.md#14-algorithm-names-and-variants)
|
||||
|
||||
### Mining algorithm negotiation
|
||||
If your pool support [mining algorithm negotiation](https://github.com/xmrig/xmrig-proxy/issues/168) miner will choice proper variant automaticaly and if you choice wrong base algorithm you will see error message.
|
||||
|
|
|
@ -123,7 +123,7 @@ bool xmrig::CommonConfig::finalize()
|
|||
}
|
||||
|
||||
for (Pool &pool : m_pools) {
|
||||
pool.adjust(m_algorithm.algo());
|
||||
pool.adjust(m_algorithm);
|
||||
|
||||
if (pool.isValid() && pool.algorithm().isValid()) {
|
||||
m_activePools.push_back(std::move(pool));
|
||||
|
|
|
@ -58,19 +58,21 @@ static AlgoData const algorithms[] = {
|
|||
{ "cryptonight/1", "cn/1", xmrig::CRYPTONIGHT, xmrig::VARIANT_1 },
|
||||
{ "cryptonight/xtl", "cn/xtl", xmrig::CRYPTONIGHT, xmrig::VARIANT_XTL },
|
||||
{ "cryptonight/msr", "cn/msr", xmrig::CRYPTONIGHT, xmrig::VARIANT_MSR },
|
||||
{ "cryptonight/xao", "cn/xao", xmrig::CRYPTONIGHT, xmrig::VARIANT_XAO },
|
||||
{ "cryptonight/rto", "cn/rto", xmrig::CRYPTONIGHT, xmrig::VARIANT_RTO },
|
||||
|
||||
# ifndef XMRIG_NO_AEON
|
||||
{ "cryptonight-lite", "cn-lite", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_AUTO },
|
||||
{ "cryptonight-light", "cn-light", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_AUTO },
|
||||
{ "cryptonight-lite/0", "cn-lite/0", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_0 },
|
||||
{ "cryptonight-lite/1", "cn-lite/1", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_1 },
|
||||
{ "cryptonight-lite/ipbc", "cn-lite/ipbc", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_IPBC },
|
||||
# endif
|
||||
|
||||
# ifndef XMRIG_NO_SUMO
|
||||
{ "cryptonight-heavy", "cn-heavy", xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_0 },
|
||||
{ "cryptonight-heavy", "cn-heavy", xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_AUTO },
|
||||
{ "cryptonight-heavy/0", "cn-heavy/0", xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_0 },
|
||||
{ "cryptonight-heavy/xhv", "cn-heavy/xhv", xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_XHV },
|
||||
{ "cryptonight-heavy/tube", "cn-heavy/tube", xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_TUBE },
|
||||
# endif
|
||||
};
|
||||
|
||||
|
@ -83,7 +85,12 @@ static AlgoData const xmrStakAlgorithms[] = {
|
|||
{ "cryptonight_lite", nullptr, xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_0 },
|
||||
{ "cryptonight-aeonv7", nullptr, xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_1 },
|
||||
{ "cryptonight_lite_v7", nullptr, xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_1 },
|
||||
{ "cryptonight_lite_v7_xor", nullptr, xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_IPBC },
|
||||
{ "cryptonight_heavy", nullptr, xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_0 },
|
||||
{ "cryptonight_haven", nullptr, xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_XHV },
|
||||
{ "cryptonight_masari", nullptr, xmrig::CRYPTONIGHT, xmrig::VARIANT_MSR },
|
||||
{ "cryptonight_masari", nullptr, xmrig::CRYPTONIGHT, xmrig::VARIANT_MSR },
|
||||
{ "cryptonight-bittube2", nullptr, xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_TUBE }, // bittube-miner
|
||||
{ "cryptonight_alloy", nullptr, xmrig::CRYPTONIGHT, xmrig::VARIANT_XAO }, // xmr-stak-alloy
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -91,10 +98,12 @@ static AlgoData const xmrStakAlgorithms[] = {
|
|||
static const char *variants[] = {
|
||||
"0",
|
||||
"1",
|
||||
"ipbc",
|
||||
"tube",
|
||||
"xtl",
|
||||
"msr",
|
||||
"xhv"
|
||||
"xhv",
|
||||
"xao",
|
||||
"rto"
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -332,6 +332,12 @@ bool Client::parseLogin(const rapidjson::Value &result, int *code)
|
|||
|
||||
bool Client::verifyAlgorithm(const xmrig::Algorithm &algorithm) const
|
||||
{
|
||||
# ifdef XMRIG_PROXY_PROJECT
|
||||
if (m_pool.algorithm().variant() == xmrig::VARIANT_AUTO) {
|
||||
return true;
|
||||
}
|
||||
# endif
|
||||
|
||||
if (m_pool.isCompatible(algorithm)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -478,6 +484,10 @@ void Client::login()
|
|||
params.AddMember("rigid", StringRef(m_pool.rigId()), allocator);
|
||||
}
|
||||
|
||||
# ifdef XMRIG_PROXY_PROJECT
|
||||
if (m_pool.algorithm().variant() != xmrig::VARIANT_AUTO)
|
||||
# endif
|
||||
{
|
||||
Value algo(kArrayType);
|
||||
|
||||
for (const auto &a : m_pool.algorithms()) {
|
||||
|
@ -485,6 +495,8 @@ void Client::login()
|
|||
}
|
||||
|
||||
params.AddMember("algo", algo, allocator);
|
||||
}
|
||||
|
||||
doc.AddMember("params", params, allocator);
|
||||
|
||||
send(doc);
|
||||
|
|
|
@ -223,37 +223,15 @@ rapidjson::Value Pool::toJSON(rapidjson::Document &doc) const
|
|||
}
|
||||
|
||||
|
||||
void Pool::adjust(xmrig::Algo algorithm)
|
||||
void Pool::adjust(const xmrig::Algorithm &algorithm)
|
||||
{
|
||||
if (!isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_algorithm.isValid()) {
|
||||
m_algorithm.setAlgo(algorithm);
|
||||
|
||||
if (m_algorithm.variant() == xmrig::VARIANT_AUTO) {
|
||||
if (algorithm == xmrig::CRYPTONIGHT_HEAVY) {
|
||||
m_algorithm.setVariant(xmrig::VARIANT_0);
|
||||
}
|
||||
else {
|
||||
m_algorithm.setVariant(xmrig::VARIANT_1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (strstr(m_host.data(), ".nicehash.com")) {
|
||||
m_keepAlive = false;
|
||||
m_nicehash = true;
|
||||
|
||||
if (strstr(m_host.data(), "cryptonightv7.")) {
|
||||
m_algorithm.setVariant(xmrig::VARIANT_1);
|
||||
}
|
||||
}
|
||||
|
||||
if (strstr(m_host.data(), ".minergate.com")) {
|
||||
m_keepAlive = false;
|
||||
m_algorithm.setVariant(xmrig::VARIANT_1);
|
||||
m_algorithm.setAlgo(algorithm.algo());
|
||||
adjustVariant(algorithm.variant());
|
||||
}
|
||||
|
||||
rebuild();
|
||||
|
@ -318,18 +296,95 @@ void Pool::addVariant(xmrig::Variant variant)
|
|||
}
|
||||
|
||||
|
||||
void Pool::adjustVariant(const xmrig::Variant variantHint)
|
||||
{
|
||||
# ifndef XMRIG_PROXY_PROJECT
|
||||
using namespace xmrig;
|
||||
|
||||
if (m_host.contains(".nicehash.com")) {
|
||||
m_keepAlive = false;
|
||||
m_nicehash = true;
|
||||
bool valid = true;
|
||||
|
||||
if (m_host.contains("cryptonight.") && m_port == 3355) {
|
||||
valid = m_algorithm.algo() == CRYPTONIGHT;
|
||||
m_algorithm.setVariant(VARIANT_0);
|
||||
}
|
||||
else if (m_host.contains("cryptonightv7.") && m_port == 3363) {
|
||||
valid = m_algorithm.algo() == CRYPTONIGHT;
|
||||
m_algorithm.setVariant(VARIANT_1);
|
||||
}
|
||||
else if (m_host.contains("cryptonightheavy.") && m_port == 3364) {
|
||||
valid = m_algorithm.algo() == CRYPTONIGHT_HEAVY;
|
||||
m_algorithm.setVariant(VARIANT_0);
|
||||
}
|
||||
|
||||
if (!valid) {
|
||||
m_algorithm.setAlgo(INVALID_ALGO);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_host.contains(".minergate.com")) {
|
||||
m_keepAlive = false;
|
||||
bool valid = true;
|
||||
m_algorithm.setVariant(VARIANT_1);
|
||||
|
||||
if (m_host.contains("xmr.pool.")) {
|
||||
valid = m_algorithm.algo() == CRYPTONIGHT;
|
||||
m_algorithm.setVariant(m_port == 45700 ? VARIANT_1 : VARIANT_0);
|
||||
}
|
||||
else if (m_host.contains("aeon.pool.") && m_port == 45690) {
|
||||
valid = m_algorithm.algo() == CRYPTONIGHT_LITE;
|
||||
m_algorithm.setVariant(VARIANT_1);
|
||||
}
|
||||
|
||||
if (!valid) {
|
||||
m_algorithm.setAlgo(INVALID_ALGO);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (variantHint != VARIANT_AUTO) {
|
||||
m_algorithm.setVariant(variantHint);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_algorithm.variant() != VARIANT_AUTO) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_algorithm.algo() == CRYPTONIGHT_HEAVY) {
|
||||
m_algorithm.setVariant(VARIANT_0);
|
||||
}
|
||||
else {
|
||||
m_algorithm.setVariant(VARIANT_1);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
void Pool::rebuild()
|
||||
{
|
||||
m_algorithms.clear();
|
||||
|
||||
if (!m_algorithm.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_algorithms.push_back(m_algorithm);
|
||||
|
||||
# ifndef XMRIG_PROXY_PROJECT
|
||||
addVariant(xmrig::VARIANT_1);
|
||||
addVariant(xmrig::VARIANT_0);
|
||||
addVariant(xmrig::VARIANT_XTL);
|
||||
addVariant(xmrig::VARIANT_IPBC);
|
||||
addVariant(xmrig::VARIANT_TUBE);
|
||||
addVariant(xmrig::VARIANT_MSR);
|
||||
addVariant(xmrig::VARIANT_XHV);
|
||||
addVariant(xmrig::VARIANT_XAO);
|
||||
addVariant(xmrig::VARIANT_RTO);
|
||||
addVariant(xmrig::VARIANT_AUTO);
|
||||
# endif
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
bool parse(const char *url);
|
||||
bool setUserpass(const char *userpass);
|
||||
rapidjson::Value toJSON(rapidjson::Document &doc) const;
|
||||
void adjust(xmrig::Algo algorithm);
|
||||
void adjust(const xmrig::Algorithm &algorithm);
|
||||
void setAlgo(const xmrig::Algorithm &algorithm);
|
||||
|
||||
# ifdef APP_DEBUG
|
||||
|
@ -87,6 +87,7 @@ public:
|
|||
private:
|
||||
bool parseIPv6(const char *addr);
|
||||
void addVariant(xmrig::Variant variant);
|
||||
void adjustVariant(const xmrig::Variant variantHint);
|
||||
void rebuild();
|
||||
|
||||
bool m_nicehash;
|
||||
|
|
|
@ -72,6 +72,12 @@ public:
|
|||
}
|
||||
|
||||
|
||||
inline bool contains(const char *str) const
|
||||
{
|
||||
return strstr(m_data, str) != nullptr;
|
||||
}
|
||||
|
||||
|
||||
inline bool isNull() const { return m_data == nullptr; }
|
||||
inline const char *data() const { return m_data; }
|
||||
inline size_t size() const { return m_data == nullptr ? 0 : strlen(m_data); }
|
||||
|
|
|
@ -61,10 +61,12 @@ enum Variant {
|
|||
VARIANT_AUTO = -1, // Autodetect
|
||||
VARIANT_0 = 0, // Original CryptoNight or CryptoNight-Heavy
|
||||
VARIANT_1 = 1, // CryptoNight variant 1 also known as Monero7 and CryptoNightV7
|
||||
VARIANT_IPBC = 2, // Modified CryptoNight Lite variant 1 with XOR (IPBC/TUBE only)
|
||||
VARIANT_TUBE = 2, // Modified CryptoNight-Heavy (TUBE only)
|
||||
VARIANT_XTL = 3, // Modified CryptoNight variant 1 (Stellite only)
|
||||
VARIANT_MSR = 4, // Modified CryptoNight variant 1 (Masari only)
|
||||
VARIANT_XHV = 5, // Modified CryptoNight-Heavy (Haven Protocol only)
|
||||
VARIANT_XAO = 6, // Modified CryptoNight variant 1 (Alloy only)
|
||||
VARIANT_RTO = 7, // Modified CryptoNight variant 1 (Arto only)
|
||||
VARIANT_MAX
|
||||
};
|
||||
|
||||
|
|
|
@ -382,6 +382,28 @@ static inline void cn_implode_scratchpad(const __m128i *input, __m128i *output)
|
|||
}
|
||||
|
||||
|
||||
static inline __m128i aes_round_tweak_div(const __m128i &in, const __m128i &key)
|
||||
{
|
||||
alignas(16) uint32_t k[4];
|
||||
alignas(16) uint32_t x[4];
|
||||
|
||||
_mm_store_si128((__m128i*) k, key);
|
||||
_mm_store_si128((__m128i*) x, _mm_xor_si128(in, _mm_set_epi64x(0xffffffffffffffff, 0xffffffffffffffff)));
|
||||
|
||||
#define BYTE(p, i) ((unsigned char*)&x[p])[i]
|
||||
k[0] ^= saes_table[0][BYTE(0, 0)] ^ saes_table[1][BYTE(1, 1)] ^ saes_table[2][BYTE(2, 2)] ^ saes_table[3][BYTE(3, 3)];
|
||||
x[0] ^= k[0];
|
||||
k[1] ^= saes_table[0][BYTE(1, 0)] ^ saes_table[1][BYTE(2, 1)] ^ saes_table[2][BYTE(3, 2)] ^ saes_table[3][BYTE(0, 3)];
|
||||
x[1] ^= k[1];
|
||||
k[2] ^= saes_table[0][BYTE(2, 0)] ^ saes_table[1][BYTE(3, 1)] ^ saes_table[2][BYTE(0, 2)] ^ saes_table[3][BYTE(1, 3)];
|
||||
x[2] ^= k[2];
|
||||
k[3] ^= saes_table[0][BYTE(3, 0)] ^ saes_table[1][BYTE(0, 1)] ^ saes_table[2][BYTE(1, 2)] ^ saes_table[3][BYTE(2, 3)];
|
||||
#undef BYTE
|
||||
|
||||
return _mm_load_si128((__m128i*)k);
|
||||
}
|
||||
|
||||
|
||||
template<int SHIFT>
|
||||
static inline void cryptonight_monero_tweak(uint64_t* mem_out, __m128i tmp)
|
||||
{
|
||||
|
@ -428,12 +450,17 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si
|
|||
|
||||
for (size_t i = 0; i < ITERATIONS; i++) {
|
||||
__m128i cx;
|
||||
if (VARIANT == xmrig::VARIANT_TUBE || !SOFT_AES) {
|
||||
cx = _mm_load_si128((__m128i *) &l0[idx0 & MASK]);
|
||||
}
|
||||
|
||||
if (SOFT_AES) {
|
||||
if (VARIANT == xmrig::VARIANT_TUBE) {
|
||||
cx = aes_round_tweak_div(cx, _mm_set_epi64x(ah0, al0));
|
||||
}
|
||||
else if (SOFT_AES) {
|
||||
cx = soft_aesenc((uint32_t*)&l0[idx0 & MASK], _mm_set_epi64x(ah0, al0));
|
||||
}
|
||||
else {
|
||||
cx = _mm_load_si128((__m128i *) &l0[idx0 & MASK]);
|
||||
cx = _mm_aesenc_si128(cx, _mm_set_epi64x(ah0, al0));
|
||||
}
|
||||
|
||||
|
@ -457,7 +484,7 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si
|
|||
((uint64_t*)&l0[idx0 & MASK])[0] = al0;
|
||||
|
||||
if (IS_MONERO) {
|
||||
if (VARIANT == xmrig::VARIANT_IPBC) {
|
||||
if (VARIANT == xmrig::VARIANT_TUBE || VARIANT == xmrig::VARIANT_RTO) {
|
||||
((uint64_t*)&l0[idx0 & MASK])[1] = ah0 ^ tweak1_2_0 ^ al0;
|
||||
}
|
||||
else {
|
||||
|
@ -536,14 +563,20 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
|
|||
|
||||
for (size_t i = 0; i < ITERATIONS; i++) {
|
||||
__m128i cx0, cx1;
|
||||
if (VARIANT == xmrig::VARIANT_TUBE || !SOFT_AES) {
|
||||
cx0 = _mm_load_si128((__m128i *) &l0[idx0 & MASK]);
|
||||
cx1 = _mm_load_si128((__m128i *) &l1[idx1 & MASK]);
|
||||
}
|
||||
|
||||
if (SOFT_AES) {
|
||||
if (VARIANT == xmrig::VARIANT_TUBE) {
|
||||
cx0 = aes_round_tweak_div(cx0, _mm_set_epi64x(ah0, al0));
|
||||
cx1 = aes_round_tweak_div(cx1, _mm_set_epi64x(ah1, al1));
|
||||
}
|
||||
else if (SOFT_AES) {
|
||||
cx0 = soft_aesenc((uint32_t*)&l0[idx0 & MASK], _mm_set_epi64x(ah0, al0));
|
||||
cx1 = soft_aesenc((uint32_t*)&l1[idx1 & MASK], _mm_set_epi64x(ah1, al1));
|
||||
}
|
||||
else {
|
||||
cx0 = _mm_load_si128((__m128i *) &l0[idx0 & MASK]);
|
||||
cx1 = _mm_load_si128((__m128i *) &l1[idx1 & MASK]);
|
||||
cx0 = _mm_aesenc_si128(cx0, _mm_set_epi64x(ah0, al0));
|
||||
cx1 = _mm_aesenc_si128(cx1, _mm_set_epi64x(ah1, al1));
|
||||
}
|
||||
|
@ -573,7 +606,7 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
|
|||
((uint64_t*)&l0[idx0 & MASK])[0] = al0;
|
||||
|
||||
if (IS_MONERO) {
|
||||
if (VARIANT == xmrig::VARIANT_IPBC) {
|
||||
if (VARIANT == xmrig::VARIANT_TUBE || VARIANT == xmrig::VARIANT_RTO) {
|
||||
((uint64_t*)&l0[idx0 & MASK])[1] = ah0 ^ tweak1_2_0 ^ al0;
|
||||
}
|
||||
else {
|
||||
|
@ -614,7 +647,7 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
|
|||
((uint64_t*)&l1[idx1 & MASK])[0] = al1;
|
||||
|
||||
if (IS_MONERO) {
|
||||
if (VARIANT == xmrig::VARIANT_IPBC) {
|
||||
if (VARIANT == xmrig::VARIANT_TUBE || VARIANT == xmrig::VARIANT_RTO) {
|
||||
((uint64_t*)&l1[idx1 & MASK])[1] = ah1 ^ tweak1_2_1 ^ al1;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -39,6 +39,7 @@ constexpr const size_t CRYPTONIGHT_MEMORY = 2 * 1024 * 1024;
|
|||
constexpr const uint32_t CRYPTONIGHT_MASK = 0x1FFFF0;
|
||||
constexpr const uint32_t CRYPTONIGHT_ITER = 0x80000;
|
||||
constexpr const uint32_t CRYPTONIGHT_MSR_ITER = 0x40000;
|
||||
constexpr const uint32_t CRYPTONIGHT_XAO_ITER = 0x100000;
|
||||
|
||||
constexpr const size_t CRYPTONIGHT_LITE_MEMORY = 1 * 1024 * 1024;
|
||||
constexpr const uint32_t CRYPTONIGHT_LITE_MASK = 0xFFFF0;
|
||||
|
@ -108,19 +109,32 @@ template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT, VARIANT_0>()
|
|||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT, VARIANT_1>() { return CRYPTONIGHT_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT, VARIANT_XTL>() { return CRYPTONIGHT_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT, VARIANT_MSR>() { return CRYPTONIGHT_MSR_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT, VARIANT_XAO>() { return CRYPTONIGHT_XAO_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT, VARIANT_RTO>() { return CRYPTONIGHT_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_LITE, VARIANT_0>() { return CRYPTONIGHT_LITE_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_LITE, VARIANT_1>() { return CRYPTONIGHT_LITE_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_LITE, VARIANT_IPBC>() { return CRYPTONIGHT_LITE_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_HEAVY, VARIANT_0>() { return CRYPTONIGHT_HEAVY_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_HEAVY, VARIANT_XHV>() { return CRYPTONIGHT_HEAVY_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_HEAVY, VARIANT_TUBE>() { return CRYPTONIGHT_HEAVY_ITER; }
|
||||
|
||||
|
||||
inline uint32_t cn_select_iter(Algo algorithm, Variant variant)
|
||||
{
|
||||
switch (variant) {
|
||||
case VARIANT_MSR:
|
||||
return CRYPTONIGHT_MSR_ITER;
|
||||
|
||||
case VARIANT_RTO:
|
||||
return CRYPTONIGHT_XAO_ITER;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch(algorithm)
|
||||
{
|
||||
case CRYPTONIGHT:
|
||||
return variant == VARIANT_MSR ? CRYPTONIGHT_MSR_ITER : CRYPTONIGHT_ITER;
|
||||
return CRYPTONIGHT_ITER;
|
||||
|
||||
case CRYPTONIGHT_LITE:
|
||||
return CRYPTONIGHT_LITE_ITER;
|
||||
|
@ -139,15 +153,25 @@ inline uint32_t cn_select_iter(Algo algorithm, Variant variant)
|
|||
template<Variant variant> inline constexpr bool cn_is_monero() { return false; }
|
||||
template<> inline constexpr bool cn_is_monero<VARIANT_0>() { return false; }
|
||||
template<> inline constexpr bool cn_is_monero<VARIANT_1>() { return true; }
|
||||
template<> inline constexpr bool cn_is_monero<VARIANT_IPBC>() { return true; }
|
||||
template<> inline constexpr bool cn_is_monero<VARIANT_TUBE>() { return true; }
|
||||
template<> inline constexpr bool cn_is_monero<VARIANT_XTL>() { return true; }
|
||||
template<> inline constexpr bool cn_is_monero<VARIANT_MSR>() { return true; }
|
||||
template<> inline constexpr bool cn_is_monero<VARIANT_XHV>() { return false; }
|
||||
template<> inline constexpr bool cn_is_monero<VARIANT_XAO>() { return false; }
|
||||
template<> inline constexpr bool cn_is_monero<VARIANT_RTO>() { return true; }
|
||||
|
||||
|
||||
inline bool cn_is_monero(Variant variant)
|
||||
{
|
||||
return variant > VARIANT_0 && variant < VARIANT_XHV;
|
||||
switch (variant) {
|
||||
case VARIANT_0:
|
||||
case VARIANT_XHV:
|
||||
case VARIANT_RTO:
|
||||
return false;
|
||||
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -114,6 +114,36 @@ const static uint8_t test_output_msr[160] = {
|
|||
};
|
||||
|
||||
|
||||
// Alloy (XAO)
|
||||
const static uint8_t test_output_xao[160] = {
|
||||
0x9A, 0x29, 0xD0, 0xC4, 0xAF, 0xDC, 0x63, 0x9B, 0x65, 0x53, 0xB1, 0xC8, 0x37, 0x35, 0x11, 0x4C,
|
||||
0x5D, 0x77, 0x16, 0x21, 0x42, 0x97, 0x5C, 0xB8, 0x50, 0xC0, 0xA5, 0x1F, 0x64, 0x07, 0xBD, 0x33,
|
||||
0xF1, 0xC9, 0x98, 0x40, 0x42, 0xDE, 0x39, 0xD1, 0xBA, 0x2D, 0xAD, 0xEC, 0xFE, 0xEA, 0xD8, 0x46,
|
||||
0x56, 0x1C, 0x32, 0x90, 0x42, 0x63, 0x10, 0x80, 0xD7, 0x01, 0xE4, 0xE6, 0x20, 0xB3, 0x60, 0x45,
|
||||
0x05, 0xE5, 0xC2, 0x18, 0xCD, 0x07, 0xA4, 0x40, 0x42, 0x91, 0xE2, 0xA4, 0x52, 0x54, 0x79, 0xBA,
|
||||
0xCD, 0x7E, 0x61, 0x2D, 0x7F, 0x7E, 0x69, 0x5E, 0xD7, 0xC0, 0x06, 0x65, 0xD7, 0xA1, 0xB8, 0xB8,
|
||||
0x1E, 0x31, 0x1C, 0xD3, 0xB7, 0xBC, 0x78, 0x3C, 0x01, 0xAF, 0x77, 0xAA, 0xF3, 0x0F, 0x4C, 0xF2,
|
||||
0xD1, 0x8B, 0x58, 0xC7, 0xEB, 0x99, 0x91, 0x53, 0x43, 0x71, 0x47, 0x99, 0x9E, 0x04, 0xA4, 0xEA,
|
||||
0xB8, 0xA3, 0xB0, 0x9E, 0x09, 0xF5, 0x57, 0x5C, 0xCF, 0x8A, 0xC6, 0xCA, 0x88, 0x51, 0x9A, 0x01,
|
||||
0x31, 0xCC, 0x0C, 0xA6, 0x53, 0xB5, 0x5F, 0xFD, 0x7D, 0x29, 0x3A, 0x35, 0xE9, 0x0E, 0x25, 0x6C
|
||||
};
|
||||
|
||||
|
||||
// Arto (RTO)
|
||||
const static uint8_t test_output_rto[160] = {
|
||||
0x82, 0x66, 0x1E, 0x1C, 0x6E, 0x64, 0x36, 0x66, 0x84, 0x06, 0x32, 0x7A, 0x9B, 0xB1, 0x13, 0x19,
|
||||
0xA5, 0x56, 0x16, 0x15, 0xDF, 0xEC, 0x1C, 0x9E, 0xE3, 0x88, 0x4A, 0x6C, 0x1C, 0xEB, 0x76, 0xA5,
|
||||
0xB3, 0xFB, 0xF4, 0x3F, 0x2B, 0x6A, 0x3A, 0x39, 0xA3, 0x6E, 0x08, 0x33, 0x67, 0x90, 0x31, 0xB9,
|
||||
0x3F, 0x27, 0xE4, 0x79, 0x32, 0x61, 0x6B, 0x5C, 0x8A, 0xF8, 0xAF, 0xC0, 0x60, 0xFD, 0x83, 0xB7,
|
||||
0x11, 0x11, 0x89, 0xB4, 0xDC, 0xAE, 0x40, 0xC8, 0x64, 0xAA, 0x4D, 0x19, 0x23, 0x7B, 0xD3, 0x27,
|
||||
0xB2, 0x0F, 0xA7, 0x50, 0x7D, 0xCA, 0xF5, 0x03, 0x06, 0xB2, 0x26, 0x62, 0xF3, 0x68, 0x2D, 0x30,
|
||||
0x6F, 0x93, 0x1E, 0xFF, 0xCD, 0x85, 0x40, 0x28, 0x5F, 0xC3, 0x8C, 0x76, 0x51, 0x9E, 0xD5, 0x06,
|
||||
0x32, 0xD6, 0x35, 0x83, 0xF6, 0x3B, 0x54, 0x4F, 0xA1, 0x9C, 0x13, 0xD8, 0xC4, 0x0E, 0x01, 0x2F,
|
||||
0x29, 0xDB, 0x8C, 0x1C, 0xB7, 0x06, 0x86, 0x79, 0x6D, 0xFF, 0x9F, 0x89, 0x3B, 0x3A, 0xA5, 0x79,
|
||||
0xE7, 0x81, 0x4E, 0x2A, 0xBD, 0x62, 0xC1, 0x1B, 0x7C, 0xB9, 0x33, 0x7B, 0xEE, 0x95, 0x80, 0xB3
|
||||
};
|
||||
|
||||
|
||||
#ifndef XMRIG_NO_AEON
|
||||
const static uint8_t test_output_v0_lite[160] = {
|
||||
0x36, 0x95, 0xB4, 0xB5, 0x3B, 0xB0, 0x03, 0x58, 0xB0, 0xAD, 0x38, 0xDC, 0x16, 0x0F, 0xEB, 0x9E,
|
||||
|
@ -142,21 +172,6 @@ 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
|
||||
|
||||
|
||||
|
@ -186,6 +201,21 @@ const static uint8_t test_output_xhv_heavy[160] = {
|
|||
0x13, 0x91, 0x89, 0xB4, 0x5B, 0xA9, 0x2A, 0x7A, 0x09, 0x65, 0x14, 0x20, 0x76, 0x24, 0x6C, 0x80,
|
||||
0x1D, 0x3F, 0x9F, 0xCD, 0x68, 0x39, 0xA9, 0x42, 0x27, 0xC1, 0x0C, 0x53, 0x98, 0x35, 0x60, 0x7A
|
||||
};
|
||||
|
||||
|
||||
// TUBE
|
||||
const static uint8_t test_output_tube_heavy[160] = {
|
||||
0xFE, 0x53, 0x35, 0x20, 0x76, 0xEA, 0xE6, 0x89, 0xFA, 0x3B, 0x4F, 0xDA, 0x61, 0x46, 0x34, 0xCF,
|
||||
0xC3, 0x12, 0xEE, 0x0C, 0x38, 0x7D, 0xF2, 0xB8, 0xB7, 0x4D, 0xA2, 0xA1, 0x59, 0x74, 0x12, 0x35,
|
||||
0xCD, 0x3F, 0x29, 0xDF, 0x07, 0x4A, 0x14, 0xAD, 0x0B, 0x98, 0x99, 0x37, 0xCA, 0x14, 0x68, 0xA3,
|
||||
0x8D, 0xAE, 0x86, 0xC1, 0xA3, 0x54, 0x05, 0xBE, 0xEA, 0x6D, 0x29, 0x24, 0x0C, 0x82, 0x97, 0x74,
|
||||
0xA0, 0x64, 0x77, 0xCD, 0x8D, 0x8A, 0xC3, 0x10, 0xB4, 0x89, 0x0E, 0xBB, 0x7D, 0xE6, 0x32, 0x8F,
|
||||
0xF4, 0x2D, 0xB6, 0x9E, 0x8A, 0xF9, 0xF8, 0xEE, 0x2C, 0xD0, 0x74, 0xED, 0xA9, 0xAA, 0xA1, 0xFB,
|
||||
0xE2, 0xC9, 0x89, 0x66, 0xD6, 0x66, 0x52, 0xA2, 0x16, 0xDA, 0x36, 0xA0, 0x10, 0x62, 0xD2, 0xB1,
|
||||
0x76, 0xD1, 0x31, 0xE9, 0x1C, 0x08, 0xB6, 0xCA, 0xAF, 0x89, 0xB9, 0x3D, 0x2C, 0xFA, 0x9A, 0x30,
|
||||
0x74, 0x6A, 0x96, 0xA1, 0x95, 0x6C, 0xBB, 0x46, 0x4D, 0xE0, 0xEB, 0x28, 0xBE, 0x2A, 0x8C, 0x34,
|
||||
0x57, 0x79, 0xBE, 0x52, 0xFB, 0xBC, 0x68, 0x43, 0x45, 0xF4, 0xDF, 0xA5, 0xA8, 0xFD, 0x55, 0xA6
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -386,6 +386,28 @@ static inline void cn_implode_scratchpad(const __m128i *input, __m128i *output)
|
|||
}
|
||||
|
||||
|
||||
static inline __m128i aes_round_tweak_div(const __m128i &in, const __m128i &key)
|
||||
{
|
||||
alignas(16) uint32_t k[4];
|
||||
alignas(16) uint32_t x[4];
|
||||
|
||||
_mm_store_si128((__m128i*) k, key);
|
||||
_mm_store_si128((__m128i*) x, _mm_xor_si128(in, _mm_set_epi64x(0xffffffffffffffff, 0xffffffffffffffff)));
|
||||
|
||||
#define BYTE(p, i) ((unsigned char*)&x[p])[i]
|
||||
k[0] ^= saes_table[0][BYTE(0, 0)] ^ saes_table[1][BYTE(1, 1)] ^ saes_table[2][BYTE(2, 2)] ^ saes_table[3][BYTE(3, 3)];
|
||||
x[0] ^= k[0];
|
||||
k[1] ^= saes_table[0][BYTE(1, 0)] ^ saes_table[1][BYTE(2, 1)] ^ saes_table[2][BYTE(3, 2)] ^ saes_table[3][BYTE(0, 3)];
|
||||
x[1] ^= k[1];
|
||||
k[2] ^= saes_table[0][BYTE(2, 0)] ^ saes_table[1][BYTE(3, 1)] ^ saes_table[2][BYTE(0, 2)] ^ saes_table[3][BYTE(1, 3)];
|
||||
x[2] ^= k[2];
|
||||
k[3] ^= saes_table[0][BYTE(3, 0)] ^ saes_table[1][BYTE(0, 1)] ^ saes_table[2][BYTE(1, 2)] ^ saes_table[3][BYTE(2, 3)];
|
||||
#undef BYTE
|
||||
|
||||
return _mm_load_si128((__m128i*)k);
|
||||
}
|
||||
|
||||
|
||||
template<int SHIFT>
|
||||
static inline void cryptonight_monero_tweak(uint64_t* mem_out, __m128i tmp)
|
||||
{
|
||||
|
@ -433,12 +455,17 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si
|
|||
|
||||
for (size_t i = 0; i < ITERATIONS; i++) {
|
||||
__m128i cx;
|
||||
if (VARIANT == xmrig::VARIANT_TUBE || !SOFT_AES) {
|
||||
cx = _mm_load_si128((__m128i *) &l0[idx0 & MASK]);
|
||||
}
|
||||
|
||||
if (SOFT_AES) {
|
||||
if (VARIANT == xmrig::VARIANT_TUBE) {
|
||||
cx = aes_round_tweak_div(cx, _mm_set_epi64x(ah0, al0));
|
||||
}
|
||||
else if (SOFT_AES) {
|
||||
cx = soft_aesenc((uint32_t*)&l0[idx0 & MASK], _mm_set_epi64x(ah0, al0));
|
||||
}
|
||||
else {
|
||||
cx = _mm_load_si128((__m128i *) &l0[idx0 & MASK]);
|
||||
cx = _mm_aesenc_si128(cx, _mm_set_epi64x(ah0, al0));
|
||||
}
|
||||
|
||||
|
@ -462,7 +489,7 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si
|
|||
((uint64_t*)&l0[idx0 & MASK])[0] = al0;
|
||||
|
||||
if (IS_MONERO) {
|
||||
if (VARIANT == xmrig::VARIANT_IPBC) {
|
||||
if (VARIANT == xmrig::VARIANT_TUBE || VARIANT == xmrig::VARIANT_RTO) {
|
||||
((uint64_t*)&l0[idx0 & MASK])[1] = ah0 ^ tweak1_2_0 ^ al0;
|
||||
}
|
||||
else {
|
||||
|
@ -485,13 +512,12 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si
|
|||
((int64_t*)&l0[idx0 & MASK])[0] = n ^ q;
|
||||
|
||||
if (VARIANT == xmrig::VARIANT_XHV) {
|
||||
idx0 = (~d) ^ q;
|
||||
d = ~d;
|
||||
}
|
||||
else {
|
||||
|
||||
idx0 = d ^ q;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cn_implode_scratchpad<ALGO, MEM, SOFT_AES>((__m128i*) ctx[0]->memory, (__m128i*) ctx[0]->state);
|
||||
|
||||
|
@ -540,14 +566,20 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
|
|||
|
||||
for (size_t i = 0; i < ITERATIONS; i++) {
|
||||
__m128i cx0, cx1;
|
||||
if (VARIANT == xmrig::VARIANT_TUBE || !SOFT_AES) {
|
||||
cx0 = _mm_load_si128((__m128i *) &l0[idx0 & MASK]);
|
||||
cx1 = _mm_load_si128((__m128i *) &l1[idx1 & MASK]);
|
||||
}
|
||||
|
||||
if (SOFT_AES) {
|
||||
if (VARIANT == xmrig::VARIANT_TUBE) {
|
||||
cx0 = aes_round_tweak_div(cx0, _mm_set_epi64x(ah0, al0));
|
||||
cx1 = aes_round_tweak_div(cx1, _mm_set_epi64x(ah1, al1));
|
||||
}
|
||||
else if (SOFT_AES) {
|
||||
cx0 = soft_aesenc((uint32_t*)&l0[idx0 & MASK], _mm_set_epi64x(ah0, al0));
|
||||
cx1 = soft_aesenc((uint32_t*)&l1[idx1 & MASK], _mm_set_epi64x(ah1, al1));
|
||||
}
|
||||
else {
|
||||
cx0 = _mm_load_si128((__m128i *) &l0[idx0 & MASK]);
|
||||
cx1 = _mm_load_si128((__m128i *) &l1[idx1 & MASK]);
|
||||
cx0 = _mm_aesenc_si128(cx0, _mm_set_epi64x(ah0, al0));
|
||||
cx1 = _mm_aesenc_si128(cx1, _mm_set_epi64x(ah1, al1));
|
||||
}
|
||||
|
@ -577,7 +609,7 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
|
|||
((uint64_t*)&l0[idx0 & MASK])[0] = al0;
|
||||
|
||||
if (IS_MONERO) {
|
||||
if (VARIANT == xmrig::VARIANT_IPBC) {
|
||||
if (VARIANT == xmrig::VARIANT_TUBE || VARIANT == xmrig::VARIANT_RTO) {
|
||||
((uint64_t*)&l0[idx0 & MASK])[1] = ah0 ^ tweak1_2_0 ^ al0;
|
||||
}
|
||||
else {
|
||||
|
@ -600,12 +632,11 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
|
|||
((int64_t*)&l0[idx0 & MASK])[0] = n ^ q;
|
||||
|
||||
if (VARIANT == xmrig::VARIANT_XHV) {
|
||||
idx0 = (~d) ^ q;
|
||||
d = ~d;
|
||||
}
|
||||
else {
|
||||
|
||||
idx0 = d ^ q;
|
||||
}
|
||||
}
|
||||
|
||||
cl = ((uint64_t*) &l1[idx1 & MASK])[0];
|
||||
ch = ((uint64_t*) &l1[idx1 & MASK])[1];
|
||||
|
@ -617,7 +648,7 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
|
|||
((uint64_t*)&l1[idx1 & MASK])[0] = al1;
|
||||
|
||||
if (IS_MONERO) {
|
||||
if (VARIANT == xmrig::VARIANT_IPBC) {
|
||||
if (VARIANT == xmrig::VARIANT_TUBE || VARIANT == xmrig::VARIANT_RTO) {
|
||||
((uint64_t*)&l1[idx1 & MASK])[1] = ah1 ^ tweak1_2_1 ^ al1;
|
||||
}
|
||||
else {
|
||||
|
@ -640,13 +671,12 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
|
|||
((int64_t*)&l1[idx1 & MASK])[0] = n ^ q;
|
||||
|
||||
if (VARIANT == xmrig::VARIANT_XHV) {
|
||||
idx1 = (~d) ^ q;
|
||||
d = ~d;
|
||||
}
|
||||
else {
|
||||
|
||||
idx1 = d ^ q;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cn_implode_scratchpad<ALGO, MEM, SOFT_AES>((__m128i*) l0, (__m128i*) h0);
|
||||
cn_implode_scratchpad<ALGO, MEM, SOFT_AES>((__m128i*) l1, (__m128i*) h1);
|
||||
|
@ -665,7 +695,10 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
|
|||
|
||||
|
||||
#define CN_STEP2(a, b, c, l, ptr, idx) \
|
||||
if (SOFT_AES) { \
|
||||
if (VARIANT == xmrig::VARIANT_TUBE) { \
|
||||
c = aes_round_tweak_div(c, a); \
|
||||
} \
|
||||
else if (SOFT_AES) { \
|
||||
c = soft_aesenc(c, a); \
|
||||
} else { \
|
||||
c = _mm_aesenc_si128(c, a); \
|
||||
|
@ -693,7 +726,8 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
|
|||
if (IS_MONERO) { \
|
||||
_mm_store_si128(ptr, _mm_xor_si128(a, mc)); \
|
||||
\
|
||||
if (VARIANT == xmrig::VARIANT_IPBC) { \
|
||||
if (VARIANT == xmrig::VARIANT_TUBE || \
|
||||
VARIANT == xmrig::VARIANT_RTO) { \
|
||||
((uint64_t*)ptr)[1] ^= ((uint64_t*)ptr)[0]; \
|
||||
} \
|
||||
} else { \
|
||||
|
@ -709,11 +743,10 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
|
|||
int64_t q = n / (d | 0x5); \
|
||||
((int64_t*)&l[idx & MASK])[0] = n ^ q; \
|
||||
if (VARIANT == xmrig::VARIANT_XHV) { \
|
||||
idx = (~d) ^ q; \
|
||||
d = ~d; \
|
||||
} \
|
||||
else { \
|
||||
\
|
||||
idx = d ^ q; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ DonateStrategy::DonateStrategy(int level, const char *user, xmrig::Algo algo, IS
|
|||
}
|
||||
|
||||
for (Pool &pool : m_pools) {
|
||||
pool.adjust(algo);
|
||||
pool.adjust(xmrig::Algorithm(algo, xmrig::VARIANT_AUTO));
|
||||
}
|
||||
|
||||
if (m_pools.size() > 1) {
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#define APP_ID "xmrig"
|
||||
#define APP_NAME "XMRig"
|
||||
#define APP_DESC "XMRig CPU miner"
|
||||
#define APP_VERSION "2.6.3"
|
||||
#define APP_VERSION "2.6.4-dev"
|
||||
#define APP_DOMAIN "xmrig.com"
|
||||
#define APP_SITE "www.xmrig.com"
|
||||
#define APP_COPYRIGHT "Copyright (C) 2016-2018 xmrig.com"
|
||||
|
@ -35,7 +35,7 @@
|
|||
|
||||
#define APP_VER_MAJOR 2
|
||||
#define APP_VER_MINOR 6
|
||||
#define APP_VER_PATCH 3
|
||||
#define APP_VER_PATCH 4
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# if (_MSC_VER >= 1910)
|
||||
|
|
|
@ -62,15 +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 ||
|
||||
variant == VARIANT_IPBC ||
|
||||
variant == VARIANT_XTL ||
|
||||
variant == VARIANT_MSR ||
|
||||
variant == VARIANT_XHV
|
||||
);
|
||||
assert(variant >= VARIANT_0 && variant < VARIANT_MAX);
|
||||
|
||||
static const cn_hash_fun func_table[180] = {
|
||||
static const cn_hash_fun func_table[VARIANT_MAX * 10 * 3] = {
|
||||
cryptonight_single_hash<CRYPTONIGHT, false, VARIANT_0>,
|
||||
cryptonight_double_hash<CRYPTONIGHT, false, VARIANT_0>,
|
||||
cryptonight_single_hash<CRYPTONIGHT, true, VARIANT_0>,
|
||||
|
@ -93,7 +87,7 @@ 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, // VARIANT_IPBC
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_TUBE
|
||||
|
||||
cryptonight_single_hash<CRYPTONIGHT, false, VARIANT_XTL>,
|
||||
cryptonight_double_hash<CRYPTONIGHT, false, VARIANT_XTL>,
|
||||
|
@ -119,6 +113,28 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
|
|||
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_XHV
|
||||
|
||||
cryptonight_single_hash<CRYPTONIGHT, false, VARIANT_XAO>,
|
||||
cryptonight_double_hash<CRYPTONIGHT, false, VARIANT_XAO>,
|
||||
cryptonight_single_hash<CRYPTONIGHT, true, VARIANT_XAO>,
|
||||
cryptonight_double_hash<CRYPTONIGHT, true, VARIANT_XAO>,
|
||||
cryptonight_triple_hash<CRYPTONIGHT, false, VARIANT_XAO>,
|
||||
cryptonight_quad_hash<CRYPTONIGHT, false, VARIANT_XAO>,
|
||||
cryptonight_penta_hash<CRYPTONIGHT, false, VARIANT_XAO>,
|
||||
cryptonight_triple_hash<CRYPTONIGHT, true, VARIANT_XAO>,
|
||||
cryptonight_quad_hash<CRYPTONIGHT, true, VARIANT_XAO>,
|
||||
cryptonight_penta_hash<CRYPTONIGHT, true, VARIANT_XAO>,
|
||||
|
||||
cryptonight_single_hash<CRYPTONIGHT, false, VARIANT_RTO>,
|
||||
cryptonight_double_hash<CRYPTONIGHT, false, VARIANT_RTO>,
|
||||
cryptonight_single_hash<CRYPTONIGHT, true, VARIANT_RTO>,
|
||||
cryptonight_double_hash<CRYPTONIGHT, true, VARIANT_RTO>,
|
||||
cryptonight_triple_hash<CRYPTONIGHT, false, VARIANT_RTO>,
|
||||
cryptonight_quad_hash<CRYPTONIGHT, false, VARIANT_RTO>,
|
||||
cryptonight_penta_hash<CRYPTONIGHT, false, VARIANT_RTO>,
|
||||
cryptonight_triple_hash<CRYPTONIGHT, true, VARIANT_RTO>,
|
||||
cryptonight_quad_hash<CRYPTONIGHT, true, VARIANT_RTO>,
|
||||
cryptonight_penta_hash<CRYPTONIGHT, true, VARIANT_RTO>,
|
||||
|
||||
# ifndef XMRIG_NO_AEON
|
||||
cryptonight_single_hash<CRYPTONIGHT_LITE, false, VARIANT_0>,
|
||||
cryptonight_double_hash<CRYPTONIGHT_LITE, false, VARIANT_0>,
|
||||
|
@ -142,20 +158,12 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
|
|||
cryptonight_quad_hash<CRYPTONIGHT_LITE, true, VARIANT_1>,
|
||||
cryptonight_penta_hash<CRYPTONIGHT_LITE, true, VARIANT_1>,
|
||||
|
||||
cryptonight_single_hash<CRYPTONIGHT_LITE, false, VARIANT_IPBC>,
|
||||
cryptonight_double_hash<CRYPTONIGHT_LITE, false, VARIANT_IPBC>,
|
||||
cryptonight_single_hash<CRYPTONIGHT_LITE, true, VARIANT_IPBC>,
|
||||
cryptonight_double_hash<CRYPTONIGHT_LITE, true, VARIANT_IPBC>,
|
||||
cryptonight_triple_hash<CRYPTONIGHT_LITE, false, VARIANT_IPBC>,
|
||||
cryptonight_quad_hash<CRYPTONIGHT_LITE, false, VARIANT_IPBC>,
|
||||
cryptonight_penta_hash<CRYPTONIGHT_LITE, false, VARIANT_IPBC>,
|
||||
cryptonight_triple_hash<CRYPTONIGHT_LITE, true, VARIANT_IPBC>,
|
||||
cryptonight_quad_hash<CRYPTONIGHT_LITE, true, VARIANT_IPBC>,
|
||||
cryptonight_penta_hash<CRYPTONIGHT_LITE, true, VARIANT_IPBC>,
|
||||
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_TUBE
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_XTL
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_MSR
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_XHV
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_XAO
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_RTO
|
||||
# else
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
|
@ -163,6 +171,8 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
|
|||
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,
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
# endif
|
||||
|
||||
# ifndef XMRIG_NO_SUMO
|
||||
|
@ -178,7 +188,18 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
|
|||
cryptonight_penta_hash<CRYPTONIGHT_HEAVY, true, VARIANT_0>,
|
||||
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_1
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_IPBC
|
||||
|
||||
cryptonight_single_hash<CRYPTONIGHT_HEAVY, false, VARIANT_TUBE>,
|
||||
cryptonight_double_hash<CRYPTONIGHT_HEAVY, false, VARIANT_TUBE>,
|
||||
cryptonight_single_hash<CRYPTONIGHT_HEAVY, true, VARIANT_TUBE>,
|
||||
cryptonight_double_hash<CRYPTONIGHT_HEAVY, true, VARIANT_TUBE>,
|
||||
cryptonight_triple_hash<CRYPTONIGHT_HEAVY, false, VARIANT_TUBE>,
|
||||
cryptonight_quad_hash<CRYPTONIGHT_HEAVY, false, VARIANT_TUBE>,
|
||||
cryptonight_penta_hash<CRYPTONIGHT_HEAVY, false, VARIANT_TUBE>,
|
||||
cryptonight_triple_hash<CRYPTONIGHT_HEAVY, true, VARIANT_TUBE>,
|
||||
cryptonight_quad_hash<CRYPTONIGHT_HEAVY, true, VARIANT_TUBE>,
|
||||
cryptonight_penta_hash<CRYPTONIGHT_HEAVY, true, VARIANT_TUBE>,
|
||||
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_XTL
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_MSR
|
||||
|
||||
|
@ -192,6 +213,9 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
|
|||
cryptonight_triple_hash<CRYPTONIGHT_HEAVY, true, VARIANT_XHV>,
|
||||
cryptonight_quad_hash<CRYPTONIGHT_HEAVY, true, VARIANT_XHV>,
|
||||
cryptonight_penta_hash<CRYPTONIGHT_HEAVY, true, VARIANT_XHV>,
|
||||
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_XAO
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_RTO
|
||||
# else
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
|
@ -199,6 +223,8 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a
|
|||
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,
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
# endif
|
||||
};
|
||||
|
||||
|
|
|
@ -50,25 +50,29 @@ MultiWorker<N>::~MultiWorker()
|
|||
template<size_t N>
|
||||
bool MultiWorker<N>::selfTest()
|
||||
{
|
||||
if (m_thread->algorithm() == xmrig::CRYPTONIGHT) {
|
||||
return verify(xmrig::VARIANT_0, test_output_v0) &&
|
||||
verify(xmrig::VARIANT_1, test_output_v1) &&
|
||||
verify(xmrig::VARIANT_XTL, test_output_xtl) &&
|
||||
verify(xmrig::VARIANT_MSR, test_output_msr);
|
||||
using namespace xmrig;
|
||||
|
||||
if (m_thread->algorithm() == CRYPTONIGHT) {
|
||||
return verify(VARIANT_0, test_output_v0) &&
|
||||
verify(VARIANT_1, test_output_v1) &&
|
||||
verify(VARIANT_XTL, test_output_xtl) &&
|
||||
verify(VARIANT_MSR, test_output_msr) &&
|
||||
verify(VARIANT_XAO, test_output_xao) &&
|
||||
verify(VARIANT_RTO, test_output_rto);
|
||||
}
|
||||
|
||||
# ifndef XMRIG_NO_AEON
|
||||
if (m_thread->algorithm() == xmrig::CRYPTONIGHT_LITE) {
|
||||
return verify(xmrig::VARIANT_0, test_output_v0_lite) &&
|
||||
verify(xmrig::VARIANT_1, test_output_v1_lite) &&
|
||||
verify(xmrig::VARIANT_IPBC, test_output_ipbc_lite);
|
||||
if (m_thread->algorithm() == CRYPTONIGHT_LITE) {
|
||||
return verify(VARIANT_0, test_output_v0_lite) &&
|
||||
verify(VARIANT_1, test_output_v1_lite);
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifndef XMRIG_NO_SUMO
|
||||
if (m_thread->algorithm() == xmrig::CRYPTONIGHT_HEAVY) {
|
||||
return verify(xmrig::VARIANT_0, test_output_v0_heavy) &&
|
||||
verify(xmrig::VARIANT_XHV, test_output_xhv_heavy);
|
||||
if (m_thread->algorithm() == CRYPTONIGHT_HEAVY) {
|
||||
return verify(VARIANT_0, test_output_v0_heavy) &&
|
||||
verify(VARIANT_XHV, test_output_xhv_heavy) &&
|
||||
verify(VARIANT_TUBE, test_output_tube_heavy);
|
||||
}
|
||||
# endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue