1
0
mirror of https://github.com/xmrig/xmrig.git synced 2025-12-06 23:52:38 -05:00

Compare commits

...

30 Commits

Author SHA1 Message Date
XMRig
11ed37ea63 v6.2.0-beta 2020-06-09 00:18:22 +07:00
XMRig
1afec10c7c Merge branch 'evo' into beta 2020-06-09 00:17:58 +07:00
xmrig
7ec14f249d Update CHANGELOG.md 2020-06-08 02:12:01 +07:00
XMRig
e2a5b40793 Merge branch 'dev' into evo 2020-06-08 02:08:43 +07:00
xmrig
d30bf207e9 Update CHANGELOG.md 2020-06-08 02:00:22 +07:00
XMRig
dbc8e20e53 Merge branch 'dev' into evo 2020-06-07 21:25:31 +07:00
xmrig
2170b58b6f Merge pull request #1720 from SChernykh/dev
Fixed GCC 10.1 issues
2020-06-07 21:24:15 +07:00
SChernykh
75c57f7563 Fixed GCC 10.1 issues
- Fixed uninitialized `state->x` warning
- Fixed broken code with `-O3` or `-Ofast`
2020-06-07 16:23:17 +02:00
XMRig
5e1199ea48 Merge branch 'dev' into evo 2020-06-07 20:15:12 +07:00
XMRig
5c5d841776 Merge branch 'noexecstack' of https://github.com/gentoo-monero/xmrig into dev 2020-06-07 20:11:37 +07:00
Matt Smith
a28bddcbdf Stop linker from making stack executable
Add .note.GNU-stack section to end of AstroBWT ASM.

Signed-off-by: Matt Smith <matt@offtopica.uk>
2020-06-07 13:57:37 +01:00
XMRig
0bfe501dac Add "cn/conceal" alias for hashvault.pro pool. 2020-06-07 15:22:05 +07:00
XMRig
3f237ae348 v6.2.0-evo 2020-06-07 15:13:46 +07:00
XMRig
f4f88ea1f7 Merge branch 'beta' into evo 2020-06-07 15:10:13 +07:00
xmrig
0e7bf5913b Merge pull request #1717 from SChernykh/evo
Conceal (CCX) support
2020-06-07 15:09:19 +07:00
SChernykh
7f00cb59d2 Conceal (CCX) support 2020-06-07 01:01:45 +02:00
XMRig
2198beff59 v6.0.1-beta 2020-06-06 15:09:41 +07:00
XMRig
0b304c1584 Merge branch 'evo' into beta 2020-06-06 15:08:53 +07:00
xmrig
5ea0de2410 Update CHANGELOG.md 2020-06-06 15:08:01 +07:00
XMRig
958224255a Merge branch 'evo' of github.com:xmrig/xmrig into evo 2020-06-06 00:25:41 +07:00
XMRig
ea72052f50 #1708 Added "title" option. 2020-06-06 00:24:58 +07:00
xmrig
9a02caf248 Update CHANGELOG.md 2020-06-05 19:45:31 +07:00
XMRig
33bfecd49b Merge branch 'pr1713' into evo 2020-06-05 19:17:48 +07:00
XMRig
f18bfeb77d Merge branch 'evo' of https://github.com/SChernykh/xmrig into pr1713 2020-06-05 19:17:01 +07:00
XMRig
ba017708bb Add tag to error message. 2020-06-05 19:02:32 +07:00
SChernykh
0dbf41f761 Reduced memory for KawPow 2020-06-05 14:01:49 +02:00
xmrig
936670f0fd Merge pull request #1711 from SChernykh/evo
Print errors from KawPow DAG initialization
2020-06-05 15:55:42 +07:00
SChernykh
ba405d1984 Print errors from KawPow DAG initialization 2020-06-05 09:33:36 +02:00
XMRig
e17f686d4f v6.0.1-evo 2020-06-05 00:42:48 +07:00
XMRig
74aff6b8f4 Merge branch 'beta' into evo 2020-06-05 00:40:53 +07:00
39 changed files with 2334 additions and 1964 deletions

View File

@@ -1,8 +1,22 @@
# v6.2.0-beta
- [#1717](https://github.com/xmrig/xmrig/pull/1717) Added new algorithm `cn/ccx` for Conceal.
- [#1718](https://github.com/xmrig/xmrig/pull/1718) Fixed, linker on Linux was marking entire executable as having an executable stack.
- [#1720](https://github.com/xmrig/xmrig/pull/1720) Fixed broken CryptoNight algorithms family with gcc 10.1.
# v6.0.1-beta
- [#1708](https://github.com/xmrig/xmrig/issues/1708) Added `title` option.
- [#1711](https://github.com/xmrig/xmrig/pull/1711) [cuda] Print errors from KawPow DAG initialization.
- [#1713](https://github.com/xmrig/xmrig/pull/1713) [cuda] Reduced memory usage for KawPow, minimum CUDA plugin version now is 6.1.0.
# v6.0.0-beta # v6.0.0-beta
- [#1694](https://github.com/xmrig/xmrig/pull/1694) Added support for KawPow algorithm (Ravencoin) on AMD/NVIDIA. - [#1694](https://github.com/xmrig/xmrig/pull/1694) Added support for KawPow algorithm (Ravencoin) on AMD/NVIDIA.
- Removed previously deprecated `cn/gpu` algorithm. - Removed previously deprecated `cn/gpu` algorithm.
- Default donation level reduced to 1% but you still can increase it if you like. - Default donation level reduced to 1% but you still can increase it if you like.
# v5.11.3
- [#1718](https://github.com/xmrig/xmrig/pull/1718) Fixed, linker on Linux was marking entire executable as having an executable stack.
- [#1720](https://github.com/xmrig/xmrig/pull/1720) Fixed broken CryptoNight algorithms family with gcc 10.1.
# v5.11.2 # v5.11.2
- [#1664](https://github.com/xmrig/xmrig/pull/1664) Improved JSON config error reporting. - [#1664](https://github.com/xmrig/xmrig/pull/1664) Improved JSON config error reporting.
- [#1668](https://github.com/xmrig/xmrig/pull/1668) Optimized RandomX dataset initialization. - [#1668](https://github.com/xmrig/xmrig/pull/1668) Optimized RandomX dataset initialization.

View File

@@ -7,7 +7,7 @@
[![GitHub stars](https://img.shields.io/github/stars/xmrig/xmrig.svg)](https://github.com/xmrig/xmrig/stargazers) [![GitHub stars](https://img.shields.io/github/stars/xmrig/xmrig.svg)](https://github.com/xmrig/xmrig/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/xmrig/xmrig.svg)](https://github.com/xmrig/xmrig/network) [![GitHub forks](https://img.shields.io/github/forks/xmrig/xmrig.svg)](https://github.com/xmrig/xmrig/network)
XMRig High performance, open source, cross platform RandomX, CryptoNight, AstroBWT and Argon2 CPU/GPU miner, with official support for Windows. XMRig High performance, open source, cross platform RandomX, KawPow, CryptoNight, AstroBWT and Argon2 CPU/GPU miner, with official support for Windows.
## Mining backends ## Mining backends
- **CPU** (x64/x86/ARM) - **CPU** (x64/x86/ARM)
@@ -118,6 +118,8 @@ Misc:
-h, --help display this help and exit -h, --help display this help and exit
--dry-run test configuration and exit --dry-run test configuration and exit
--export-topology export hwloc topology to a XML file and exit --export-topology export hwloc topology to a XML file and exit
--title set custom console window title
--no-title disable setting console window title
``` ```
## Donations ## Donations

View File

@@ -146,6 +146,7 @@ bool xmrig::CpuWorker<N>::selfTest()
verify2(Algorithm::CN_R, test_output_r) && verify2(Algorithm::CN_R, test_output_r) &&
verify(Algorithm::CN_RWZ, test_output_rwz) && verify(Algorithm::CN_RWZ, test_output_rwz) &&
verify(Algorithm::CN_ZLS, test_output_zls) && verify(Algorithm::CN_ZLS, test_output_zls) &&
verify(Algorithm::CN_CCX, test_output_ccx) &&
verify(Algorithm::CN_DOUBLE, test_output_double); verify(Algorithm::CN_DOUBLE, test_output_double);
return rc; return rc;

View File

@@ -238,7 +238,7 @@ public:
# ifdef XMRIG_ALGO_KAWPOW # ifdef XMRIG_ALGO_KAWPOW
if (algo.family() == Algorithm::KAWPOW) { if (algo.family() == Algorithm::KAWPOW) {
const uint32_t epoch = job.height() / KPHash::EPOCH_LENGTH; const uint32_t epoch = job.height() / KPHash::EPOCH_LENGTH;
mem_used = (KPCache::cache_size(epoch) + KPCache::dag_size(epoch)) / oneMiB; mem_used = (KPCache::dag_size(epoch) + oneMiB - 1) / oneMiB;
} }
# endif # endif

View File

@@ -66,11 +66,15 @@ bool xmrig::CudaKawPowRunner::set(const Job &job, uint8_t *blob)
const uint64_t start_ms = Chrono::steadyMSecs(); const uint64_t start_ms = Chrono::steadyMSecs();
const bool result = CudaLib::kawPowPrepare(m_ctx, cache.data(), cache.size(), cache.dag_size(epoch), height, dag_sizes); const bool result = CudaLib::kawPowPrepare(m_ctx, cache.data(), cache.size(), cache.l1_cache(), cache.dag_size(epoch), height, dag_sizes);
if (!result) {
const int64_t dt = Chrono::steadyMSecs() - start_ms; LOG_ERR("%s " YELLOW("KawPow") RED(" failed to initialize DAG: ") RED_BOLD("%s"), Tags::nvidia(), CudaLib::lastError(m_ctx));
if (dt > 500) { }
LOG_INFO("%s " YELLOW("KawPow") " DAG for epoch " WHITE_BOLD("%u") " calculated " BLACK_BOLD("(%" PRIu64 "ms)"), Tags::nvidia(), epoch, dt); else {
const int64_t dt = Chrono::steadyMSecs() - start_ms;
if (dt > 1000) {
LOG_INFO("%s " YELLOW("KawPow") " DAG for epoch " WHITE_BOLD("%u") " calculated " BLACK_BOLD("(%" PRIu64 "ms)"), Tags::nvidia(), epoch, dt);
}
} }
return result; return result;

View File

@@ -66,7 +66,7 @@ static const char *kRelease = "release";
static const char *kRxHash = "rxHash"; static const char *kRxHash = "rxHash";
static const char *kRxPrepare = "rxPrepare"; static const char *kRxPrepare = "rxPrepare";
static const char *kKawPowHash = "kawPowHash"; static const char *kKawPowHash = "kawPowHash";
static const char *kKawPowPrepare = "kawPowPrepare"; static const char *kKawPowPrepare_v2 = "kawPowPrepare_v2";
static const char *kKawPowStopHash = "kawPowStopHash"; static const char *kKawPowStopHash = "kawPowStopHash";
static const char *kSetJob = "setJob"; static const char *kSetJob = "setJob";
static const char *kSetJob_v2 = "setJob_v2"; static const char *kSetJob_v2 = "setJob_v2";
@@ -92,7 +92,7 @@ using release_t = void (*)(nvid_ctx *);
using rxHash_t = bool (*)(nvid_ctx *, uint32_t, uint64_t, uint32_t *, uint32_t *); using rxHash_t = bool (*)(nvid_ctx *, uint32_t, uint64_t, uint32_t *, uint32_t *);
using rxPrepare_t = bool (*)(nvid_ctx *, const void *, size_t, bool, uint32_t); using rxPrepare_t = bool (*)(nvid_ctx *, const void *, size_t, bool, uint32_t);
using kawPowHash_t = bool (*)(nvid_ctx *, uint8_t*, uint64_t, uint32_t *, uint32_t *, uint32_t *); using kawPowHash_t = bool (*)(nvid_ctx *, uint8_t*, uint64_t, uint32_t *, uint32_t *, uint32_t *);
using kawPowPrepare_t = bool (*)(nvid_ctx *, const void *, size_t, size_t, uint32_t, const uint64_t*); using kawPowPrepare_v2_t = bool (*)(nvid_ctx *, const void *, size_t, const void *, size_t, uint32_t, const uint64_t*);
using kawPowStopHash_t = bool (*)(nvid_ctx *); using kawPowStopHash_t = bool (*)(nvid_ctx *);
using setJob_t = bool (*)(nvid_ctx *, const void *, size_t, int32_t); using setJob_t = bool (*)(nvid_ctx *, const void *, size_t, int32_t);
using setJob_v2_t = bool (*)(nvid_ctx *, const void *, size_t, const char *); using setJob_v2_t = bool (*)(nvid_ctx *, const void *, size_t, const char *);
@@ -118,7 +118,7 @@ static release_t pRelease = nullptr;
static rxHash_t pRxHash = nullptr; static rxHash_t pRxHash = nullptr;
static rxPrepare_t pRxPrepare = nullptr; static rxPrepare_t pRxPrepare = nullptr;
static kawPowHash_t pKawPowHash = nullptr; static kawPowHash_t pKawPowHash = nullptr;
static kawPowPrepare_t pKawPowPrepare = nullptr; static kawPowPrepare_v2_t pKawPowPrepare_v2 = nullptr;
static kawPowStopHash_t pKawPowStopHash = nullptr; static kawPowStopHash_t pKawPowStopHash = nullptr;
static setJob_t pSetJob = nullptr; static setJob_t pSetJob = nullptr;
static setJob_v2_t pSetJob_v2 = nullptr; static setJob_v2_t pSetJob_v2 = nullptr;
@@ -214,9 +214,9 @@ bool xmrig::CudaLib::kawPowHash(nvid_ctx *ctx, uint8_t* job_blob, uint64_t targe
} }
bool xmrig::CudaLib::kawPowPrepare(nvid_ctx *ctx, const void* cache, size_t cache_size, size_t dag_size, uint32_t height, const uint64_t* dag_sizes) noexcept bool xmrig::CudaLib::kawPowPrepare(nvid_ctx *ctx, const void* cache, size_t cache_size, const void* dag_precalc, size_t dag_size, uint32_t height, const uint64_t* dag_sizes) noexcept
{ {
return pKawPowPrepare(ctx, cache, cache_size, dag_size, height, dag_sizes); return pKawPowPrepare_v2(ctx, cache, cache_size, dag_precalc, dag_size, height, dag_sizes);
} }
@@ -375,7 +375,7 @@ bool xmrig::CudaLib::load()
DLSYM(AstroBWTHash); DLSYM(AstroBWTHash);
DLSYM(AstroBWTPrepare); DLSYM(AstroBWTPrepare);
DLSYM(KawPowHash); DLSYM(KawPowHash);
DLSYM(KawPowPrepare); DLSYM(KawPowPrepare_v2);
DLSYM(KawPowStopHash); DLSYM(KawPowStopHash);
DLSYM(Version); DLSYM(Version);

View File

@@ -81,7 +81,7 @@ public:
static bool rxHash(nvid_ctx *ctx, uint32_t startNonce, uint64_t target, uint32_t *rescount, uint32_t *resnonce) noexcept; static bool rxHash(nvid_ctx *ctx, uint32_t startNonce, uint64_t target, uint32_t *rescount, uint32_t *resnonce) noexcept;
static bool rxPrepare(nvid_ctx *ctx, const void *dataset, size_t datasetSize, bool dataset_host, uint32_t batchSize) noexcept; static bool rxPrepare(nvid_ctx *ctx, const void *dataset, size_t datasetSize, bool dataset_host, uint32_t batchSize) noexcept;
static bool kawPowHash(nvid_ctx *ctx, uint8_t* job_blob, uint64_t target, uint32_t *rescount, uint32_t *resnonce, uint32_t *skipped_hashes) noexcept; static bool kawPowHash(nvid_ctx *ctx, uint8_t* job_blob, uint64_t target, uint32_t *rescount, uint32_t *resnonce, uint32_t *skipped_hashes) noexcept;
static bool kawPowPrepare(nvid_ctx *ctx, const void* cache, size_t cache_size, size_t dag_size, uint32_t height, const uint64_t* dag_sizes) noexcept; static bool kawPowPrepare(nvid_ctx *ctx, const void* cache, size_t cache_size, const void* dag_precalc, size_t dag_size, uint32_t height, const uint64_t* dag_sizes) noexcept;
static bool kawPowStopHash(nvid_ctx *ctx) noexcept; static bool kawPowStopHash(nvid_ctx *ctx) noexcept;
static bool setJob(nvid_ctx *ctx, const void *data, size_t size, const Algorithm &algorithm) noexcept; static bool setJob(nvid_ctx *ctx, const void *data, size_t size, const Algorithm &algorithm) noexcept;
static const char *deviceName(nvid_ctx *ctx) noexcept; static const char *deviceName(nvid_ctx *ctx) noexcept;

View File

@@ -16,16 +16,17 @@
#define ALGO_CN_HEAVY_XHV 15 #define ALGO_CN_HEAVY_XHV 15
#define ALGO_CN_PICO_0 16 #define ALGO_CN_PICO_0 16
#define ALGO_CN_PICO_TLO 17 #define ALGO_CN_PICO_TLO 17
#define ALGO_RX_0 18 #define ALGO_CN_CCX 18
#define ALGO_RX_WOW 19 #define ALGO_RX_0 19
#define ALGO_RX_LOKI 20 #define ALGO_RX_WOW 20
#define ALGO_RX_ARQMA 21 #define ALGO_RX_LOKI 21
#define ALGO_RX_SFX 22 #define ALGO_RX_ARQMA 22
#define ALGO_RX_KEVA 23 #define ALGO_RX_SFX 23
#define ALGO_AR2_CHUKWA 24 #define ALGO_RX_KEVA 24
#define ALGO_AR2_WRKZ 25 #define ALGO_AR2_CHUKWA 25
#define ALGO_ASTROBWT_DERO 26 #define ALGO_AR2_WRKZ 26
#define ALGO_KAWPOW_RVN 27 #define ALGO_ASTROBWT_DERO 27
#define ALGO_KAWPOW_RVN 28
#define FAMILY_UNKNOWN 0 #define FAMILY_UNKNOWN 0
#define FAMILY_CN 1 #define FAMILY_CN 1

View File

@@ -253,11 +253,34 @@ __kernel void cn1(__global ulong *input, __global uint4 *Scratchpad, __global ul
{ {
uint idx0 = a[0]; uint idx0 = a[0];
# if (ALGO == ALGO_CN_CCX)
float4 conc_var = (float4)(0.0f);
const uint4 conc_t = (uint4)(0x807FFFFFU);
const uint4 conc_u = (uint4)(0x40000000U);
const uint4 conc_v = (uint4)(0x4DFFFFFFU);
# endif
#pragma unroll CN_UNROLL #pragma unroll CN_UNROLL
for (int i = 0; i < ITERATIONS; ++i) { for (int i = 0; i < ITERATIONS; ++i) {
ulong c[2]; ulong c[2];
((uint4 *)c)[0] = Scratchpad[IDX((idx0 & MASK) >> 4)]; ((uint4 *)c)[0] = Scratchpad[IDX((idx0 & MASK) >> 4)];
# if (ALGO == ALGO_CN_CCX)
{
float4 r = convert_float4_rte(((int4 *)c)[0]) + conc_var;
r = r * r * r;
r = as_float4((as_uint4(r) & conc_t) | conc_u);
float4 c_old = conc_var;
conc_var += r;
c_old = as_float4((as_uint4(c_old) & conc_t) | conc_u);
((int4 *)c)[0] ^= convert_int4_rtz(c_old * as_float4(conc_v));
}
# endif
((uint4 *)c)[0] = AES_Round_Two_Tables(AES0, AES1, ((uint4 *)c)[0], ((uint4 *)a)[0]); ((uint4 *)c)[0] = AES_Round_Two_Tables(AES0, AES1, ((uint4 *)c)[0], ((uint4 *)a)[0]);
Scratchpad[IDX((idx0 & MASK) >> 4)] = b_x ^ ((uint4 *)c)[0]; Scratchpad[IDX((idx0 & MASK) >> 4)] = b_x ^ ((uint4 *)c)[0];

File diff suppressed because it is too large Load Diff

View File

@@ -19,6 +19,7 @@ set(HEADERS_BASE
src/base/kernel/Base.h src/base/kernel/Base.h
src/base/kernel/config/BaseConfig.h src/base/kernel/config/BaseConfig.h
src/base/kernel/config/BaseTransform.h src/base/kernel/config/BaseTransform.h
src/base/kernel/config/Title.h
src/base/kernel/Entry.h src/base/kernel/Entry.h
src/base/kernel/interfaces/IBaseListener.h src/base/kernel/interfaces/IBaseListener.h
src/base/kernel/interfaces/IClient.h src/base/kernel/interfaces/IClient.h
@@ -87,6 +88,7 @@ set(SOURCES_BASE
src/base/kernel/Base.cpp src/base/kernel/Base.cpp
src/base/kernel/config/BaseConfig.cpp src/base/kernel/config/BaseConfig.cpp
src/base/kernel/config/BaseTransform.cpp src/base/kernel/config/BaseTransform.cpp
src/base/kernel/config/Title.cpp
src/base/kernel/Entry.cpp src/base/kernel/Entry.cpp
src/base/kernel/Platform.cpp src/base/kernel/Platform.cpp
src/base/kernel/Process.cpp src/base/kernel/Process.cpp

View File

@@ -127,6 +127,8 @@ static AlgoName const algorithm_names[] = {
{ "kawpow", nullptr, Algorithm::KAWPOW_RVN }, { "kawpow", nullptr, Algorithm::KAWPOW_RVN },
{ "kawpow/rvn", nullptr, Algorithm::KAWPOW_RVN }, { "kawpow/rvn", nullptr, Algorithm::KAWPOW_RVN },
# endif # endif
{ "cryptonight/ccx", "cn/ccx", Algorithm::CN_CCX },
{ "cryptonight/conceal", "cn/conceal", Algorithm::CN_CCX },
}; };
@@ -292,6 +294,7 @@ xmrig::Algorithm::Family xmrig::Algorithm::family(Id id)
case CN_RWZ: case CN_RWZ:
case CN_ZLS: case CN_ZLS:
case CN_DOUBLE: case CN_DOUBLE:
case CN_CCX:
return CN; return CN;
# ifdef XMRIG_ALGO_CN_LITE # ifdef XMRIG_ALGO_CN_LITE

View File

@@ -63,6 +63,7 @@ public:
CN_HEAVY_XHV, // "cn-heavy/xhv" CryptoNight-Heavy (modified, Haven Protocol only). CN_HEAVY_XHV, // "cn-heavy/xhv" CryptoNight-Heavy (modified, Haven Protocol only).
CN_PICO_0, // "cn-pico" CryptoNight-Pico CN_PICO_0, // "cn-pico" CryptoNight-Pico
CN_PICO_TLO, // "cn-pico/tlo" CryptoNight-Pico (TLO) CN_PICO_TLO, // "cn-pico/tlo" CryptoNight-Pico (TLO)
CN_CCX, // "cn/ccx" Conceal (CCX)
RX_0, // "rx/0" RandomX (reference configuration). RX_0, // "rx/0" RandomX (reference configuration).
RX_WOW, // "rx/wow" RandomWOW (Wownero). RX_WOW, // "rx/wow" RandomWOW (Wownero).
RX_LOKI, // "rx/loki" RandomXL (Loki). RX_LOKI, // "rx/loki" RandomXL (Loki).

View File

@@ -47,15 +47,16 @@ struct CoinName
static CoinName const coin_names[] = { static CoinName const coin_names[] = {
{ "monero", Coin::MONERO }, { "monero", Coin::MONERO },
{ "xmr", Coin::MONERO }, { "xmr", Coin::MONERO },
{ "arqma", Coin::ARQMA }, { "arqma", Coin::ARQMA },
{ "arq", Coin::ARQMA }, { "arq", Coin::ARQMA },
{ "dero", Coin::DERO }, { "dero", Coin::DERO },
{ "keva", Coin::KEVA }, { "keva", Coin::KEVA },
{ "ravencoin", Coin::RAVEN }, { "ravencoin", Coin::RAVEN },
{ "raven", Coin::RAVEN }, { "raven", Coin::RAVEN },
{ "rvn", Coin::RAVEN } { "rvn", Coin::RAVEN },
{ "conceal", Coin::CONCEAL }
}; };
@@ -81,6 +82,9 @@ xmrig::Algorithm::Id xmrig::Coin::algorithm(uint8_t blobVersion) const
case RAVEN: case RAVEN:
return Algorithm::KAWPOW_RVN; return Algorithm::KAWPOW_RVN;
case CONCEAL:
return Algorithm::CN_CCX;
case INVALID: case INVALID:
break; break;
} }

View File

@@ -43,7 +43,8 @@ public:
ARQMA, ARQMA,
DERO, DERO,
KEVA, KEVA,
RAVEN RAVEN,
CONCEAL
}; };

View File

@@ -6,8 +6,8 @@
* Copyright 2016 Jay D Dee <jayddee246@gmail.com> * Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt> * Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2019 Spudz76 <https://github.com/Spudz76> * Copyright 2019 Spudz76 <https://github.com/Spudz76>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh> * Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com> * Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -28,12 +28,13 @@
#include "base/io/log/backends/ConsoleLog.h" #include "base/io/log/backends/ConsoleLog.h"
#include "base/tools/Handle.h"
#include "base/io/log/Log.h" #include "base/io/log/Log.h"
#include "base/kernel/config/Title.h"
#include "base/tools/Handle.h"
#include "version.h" #include "version.h"
xmrig::ConsoleLog::ConsoleLog() xmrig::ConsoleLog::ConsoleLog(const Title &title)
{ {
if (!isSupported()) { if (!isSupported()) {
Log::setColors(false); Log::setColors(false);
@@ -61,7 +62,9 @@ xmrig::ConsoleLog::ConsoleLog()
} }
} }
SetConsoleTitleA(APP_NAME " " APP_VERSION); if (title.isEnabled()) {
SetConsoleTitleA(title.value());
}
# endif # endif
} }

View File

@@ -6,8 +6,8 @@
* Copyright 2016 Jay D Dee <jayddee246@gmail.com> * Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt> * Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2019 Spudz76 <https://github.com/Spudz76> * Copyright 2019 Spudz76 <https://github.com/Spudz76>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh> * Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com> * Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -38,12 +38,15 @@ using uv_tty_t = struct uv_tty_s;
namespace xmrig { namespace xmrig {
class Title;
class ConsoleLog : public ILogBackend class ConsoleLog : public ILogBackend
{ {
public: public:
XMRIG_DISABLE_COPY_MOVE(ConsoleLog) XMRIG_DISABLE_COPY_MOVE(ConsoleLog)
ConsoleLog(); ConsoleLog(const Title &title);
~ConsoleLog() override; ~ConsoleLog() override;
protected: protected:

View File

@@ -184,7 +184,7 @@ int xmrig::Base::init()
Log::setBackground(true); Log::setBackground(true);
} }
else { else {
Log::add(new ConsoleLog()); Log::add(new ConsoleLog(config()->title()));
} }
if (config()->logFile()) { if (config()->logFile()) {

View File

@@ -63,6 +63,7 @@ const char *BaseConfig::kHttp = "http";
const char *BaseConfig::kLogFile = "log-file"; const char *BaseConfig::kLogFile = "log-file";
const char *BaseConfig::kPrintTime = "print-time"; const char *BaseConfig::kPrintTime = "print-time";
const char *BaseConfig::kSyslog = "syslog"; const char *BaseConfig::kSyslog = "syslog";
const char *BaseConfig::kTitle = "title";
const char *BaseConfig::kUserAgent = "user-agent"; const char *BaseConfig::kUserAgent = "user-agent";
const char *BaseConfig::kVerbose = "verbose"; const char *BaseConfig::kVerbose = "verbose";
const char *BaseConfig::kWatch = "watch"; const char *BaseConfig::kWatch = "watch";
@@ -92,6 +93,7 @@ bool xmrig::BaseConfig::read(const IJsonReader &reader, const char *fileName)
m_logFile = reader.getString(kLogFile); m_logFile = reader.getString(kLogFile);
m_userAgent = reader.getString(kUserAgent); m_userAgent = reader.getString(kUserAgent);
m_printTime = std::min(reader.getUint(kPrintTime, m_printTime), 3600U); m_printTime = std::min(reader.getUint(kPrintTime, m_printTime), 3600U);
m_title = reader.getValue(kTitle);
# ifdef XMRIG_FEATURE_TLS # ifdef XMRIG_FEATURE_TLS
m_tls = reader.getValue(kTls); m_tls = reader.getValue(kTls);

View File

@@ -26,6 +26,7 @@
#define XMRIG_BASECONFIG_H #define XMRIG_BASECONFIG_H
#include "base/kernel/config/Title.h"
#include "base/kernel/interfaces/IConfig.h" #include "base/kernel/interfaces/IConfig.h"
#include "base/net/http/Http.h" #include "base/net/http/Http.h"
#include "base/net/stratum/Pools.h" #include "base/net/stratum/Pools.h"
@@ -56,6 +57,7 @@ public:
static const char *kLogFile; static const char *kLogFile;
static const char *kPrintTime; static const char *kPrintTime;
static const char *kSyslog; static const char *kSyslog;
static const char *kTitle;
static const char *kUserAgent; static const char *kUserAgent;
static const char *kVerbose; static const char *kVerbose;
static const char *kWatch; static const char *kWatch;
@@ -76,6 +78,7 @@ public:
inline const Pools &pools() const { return m_pools; } inline const Pools &pools() const { return m_pools; }
inline const String &apiId() const { return m_apiId; } inline const String &apiId() const { return m_apiId; }
inline const String &apiWorkerId() const { return m_apiWorkerId; } inline const String &apiWorkerId() const { return m_apiWorkerId; }
inline const Title &title() const { return m_title; }
inline uint32_t printTime() const { return m_printTime; } inline uint32_t printTime() const { return m_printTime; }
# ifdef XMRIG_FEATURE_TLS # ifdef XMRIG_FEATURE_TLS
@@ -105,6 +108,7 @@ protected:
String m_fileName; String m_fileName;
String m_logFile; String m_logFile;
String m_userAgent; String m_userAgent;
Title m_title;
uint32_t m_printTime = 60; uint32_t m_printTime = 60;
# ifdef XMRIG_FEATURE_TLS # ifdef XMRIG_FEATURE_TLS

View File

@@ -204,6 +204,9 @@ void xmrig::BaseTransform::transform(rapidjson::Document &doc, int key, const ch
case IConfig::UserAgentKey: /* --user-agent */ case IConfig::UserAgentKey: /* --user-agent */
return set(doc, BaseConfig::kUserAgent, arg); return set(doc, BaseConfig::kUserAgent, arg);
case IConfig::TitleKey: /* --title */
return set(doc, BaseConfig::kTitle, arg);
# ifdef XMRIG_FEATURE_TLS # ifdef XMRIG_FEATURE_TLS
case IConfig::TlsCertKey: /* --tls-cert */ case IConfig::TlsCertKey: /* --tls-cert */
return set(doc, BaseConfig::kTls, TlsConfig::kCert, arg); return set(doc, BaseConfig::kTls, TlsConfig::kCert, arg);
@@ -248,6 +251,7 @@ void xmrig::BaseTransform::transform(rapidjson::Document &doc, int key, const ch
case IConfig::ColorKey: /* --no-color */ case IConfig::ColorKey: /* --no-color */
case IConfig::HttpRestrictedKey: /* --http-no-restricted */ case IConfig::HttpRestrictedKey: /* --http-no-restricted */
case IConfig::NoTitleKey: /* --no-title */
return transformBoolean(doc, key, false); return transformBoolean(doc, key, false);
default: default:
@@ -298,6 +302,9 @@ void xmrig::BaseTransform::transformBoolean(rapidjson::Document &doc, int key, b
case IConfig::VerboseKey: /* --verbose */ case IConfig::VerboseKey: /* --verbose */
return set(doc, BaseConfig::kVerbose, enable); return set(doc, BaseConfig::kVerbose, enable);
case IConfig::NoTitleKey: /* --no-title */
return set(doc, BaseConfig::kTitle, enable);
default: default:
break; break;
} }

View File

@@ -0,0 +1,58 @@
/* XMRig
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "base/kernel/config/Title.h"
#include "3rdparty/rapidjson/document.h"
#include "base/io/Env.h"
#include "version.h"
xmrig::Title::Title(const rapidjson::Value &value)
{
if (value.IsBool()) {
m_enabled = value.GetBool();
}
else if (value.IsString()) {
m_value = value.GetString();
}
}
rapidjson::Value xmrig::Title::toJSON() const
{
if (isEnabled() && !m_value.isNull()) {
return m_value.toJSON();
}
return rapidjson::Value(m_enabled);
}
xmrig::String xmrig::Title::value() const
{
if (!isEnabled()) {
return {};
}
if (m_value.isNull()) {
return APP_NAME " " APP_VERSION;
}
return Env::expand(m_value);
}

View File

@@ -0,0 +1,50 @@
/* XMRig
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef XMRIG_TITLE_H
#define XMRIG_TITLE_H
#include "3rdparty/rapidjson/fwd.h"
#include "base/tools/String.h"
namespace xmrig {
class Title
{
public:
Title() = default;
Title(const rapidjson::Value &value);
inline bool isEnabled() const { return m_enabled; }
rapidjson::Value toJSON() const;
String value() const;
private:
bool m_enabled = true;
String m_value;
};
} // namespace xmrig
#endif /* XMRIG_TITLE_H */

View File

@@ -74,6 +74,8 @@ public:
DaemonPollKey = 1019, DaemonPollKey = 1019,
SelfSelectKey = 1028, SelfSelectKey = 1028,
DataDirKey = 1035, DataDirKey = 1035,
TitleKey = 1037,
NoTitleKey = 1038,
// xmrig common // xmrig common
CPUPriorityKey = 1021, CPUPriorityKey = 1021,

View File

@@ -13,6 +13,7 @@
"autosave": true, "autosave": true,
"background": false, "background": false,
"colors": true, "colors": true,
"title": true,
"randomx": { "randomx": {
"init": -1, "init": -1,
"mode": "auto", "mode": "auto",

View File

@@ -217,6 +217,7 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const
doc.AddMember(StringRef(kAutosave), isAutoSave(), allocator); doc.AddMember(StringRef(kAutosave), isAutoSave(), allocator);
doc.AddMember(StringRef(kBackground), isBackground(), allocator); doc.AddMember(StringRef(kBackground), isBackground(), allocator);
doc.AddMember(StringRef(kColors), Log::isColors(), allocator); doc.AddMember(StringRef(kColors), Log::isColors(), allocator);
doc.AddMember(StringRef(kTitle), title().toJSON(), allocator);
# ifdef XMRIG_ALGO_RANDOMX # ifdef XMRIG_ALGO_RANDOMX
doc.AddMember(StringRef(kRandomX), rx().toJSON(doc), allocator); doc.AddMember(StringRef(kRandomX), rx().toJSON(doc), allocator);

View File

@@ -90,6 +90,8 @@ static const option options[] = {
{ "verbose", 0, nullptr, IConfig::VerboseKey }, { "verbose", 0, nullptr, IConfig::VerboseKey },
{ "proxy", 1, nullptr, IConfig::ProxyKey }, { "proxy", 1, nullptr, IConfig::ProxyKey },
{ "data-dir", 1, nullptr, IConfig::DataDirKey }, { "data-dir", 1, nullptr, IConfig::DataDirKey },
{ "title", 1, nullptr, IConfig::TitleKey },
{ "no-title", 0, nullptr, IConfig::NoTitleKey },
# ifdef XMRIG_FEATURE_TLS # ifdef XMRIG_FEATURE_TLS
{ "tls", 0, nullptr, IConfig::TlsKey }, { "tls", 0, nullptr, IConfig::TlsKey },
{ "tls-fingerprint", 1, nullptr, IConfig::FingerprintKey }, { "tls-fingerprint", 1, nullptr, IConfig::FingerprintKey },

View File

@@ -168,6 +168,11 @@ static inline const std::string &usage()
u += " --export-topology export hwloc topology to a XML file and exit\n"; u += " --export-topology export hwloc topology to a XML file and exit\n";
# endif # endif
# ifdef XMRIG_OS_WIN
u += " --title set custom console window title\n";
u += " --no-title disable setting console window title\n";
# endif
return u; return u;
} }

View File

@@ -51,3 +51,7 @@ KeccakF1600_AVX2_ASM:
lea r10,[rip+rndc] lea r10,[rip+rndc]
#include "sha3_256_keccakf1600_avx2.inc" #include "sha3_256_keccakf1600_avx2.inc"
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@@ -79,6 +79,7 @@ public:
case Algorithm::CN_HEAVY_TUBE: case Algorithm::CN_HEAVY_TUBE:
case Algorithm::CN_HEAVY_XHV: case Algorithm::CN_HEAVY_XHV:
# endif # endif
case Algorithm::CN_CCX:
return CN_ITER / 2; return CN_ITER / 2;
case Algorithm::CN_RWZ: case Algorithm::CN_RWZ:
@@ -125,6 +126,7 @@ public:
case Algorithm::CN_HEAVY_0: case Algorithm::CN_HEAVY_0:
case Algorithm::CN_HEAVY_XHV: case Algorithm::CN_HEAVY_XHV:
# endif # endif
case Algorithm::CN_CCX:
return Algorithm::CN_0; return Algorithm::CN_0;
case Algorithm::CN_1: case Algorithm::CN_1:
@@ -168,6 +170,7 @@ template<> constexpr inline Algorithm::Id CnAlgo<Algorithm::CN_XAO>::base() cons
template<> constexpr inline Algorithm::Id CnAlgo<Algorithm::CN_LITE_0>::base() const { return Algorithm::CN_0; } template<> constexpr inline Algorithm::Id CnAlgo<Algorithm::CN_LITE_0>::base() const { return Algorithm::CN_0; }
template<> constexpr inline Algorithm::Id CnAlgo<Algorithm::CN_HEAVY_0>::base() const { return Algorithm::CN_0; } template<> constexpr inline Algorithm::Id CnAlgo<Algorithm::CN_HEAVY_0>::base() const { return Algorithm::CN_0; }
template<> constexpr inline Algorithm::Id CnAlgo<Algorithm::CN_HEAVY_XHV>::base() const { return Algorithm::CN_0; } template<> constexpr inline Algorithm::Id CnAlgo<Algorithm::CN_HEAVY_XHV>::base() const { return Algorithm::CN_0; }
template<> constexpr inline Algorithm::Id CnAlgo<Algorithm::CN_CCX>::base() const { return Algorithm::CN_0; }
template<> constexpr inline Algorithm::Id CnAlgo<Algorithm::CN_1>::base() const { return Algorithm::CN_1; } template<> constexpr inline Algorithm::Id CnAlgo<Algorithm::CN_1>::base() const { return Algorithm::CN_1; }
template<> constexpr inline Algorithm::Id CnAlgo<Algorithm::CN_FAST>::base() const { return Algorithm::CN_1; } template<> constexpr inline Algorithm::Id CnAlgo<Algorithm::CN_FAST>::base() const { return Algorithm::CN_1; }
template<> constexpr inline Algorithm::Id CnAlgo<Algorithm::CN_RTO>::base() const { return Algorithm::CN_1; } template<> constexpr inline Algorithm::Id CnAlgo<Algorithm::CN_RTO>::base() const { return Algorithm::CN_1; }
@@ -188,6 +191,7 @@ template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_RWZ>::iterations() con
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_ZLS>::iterations() const { return 0x60000; } template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_ZLS>::iterations() const { return 0x60000; }
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_PICO_0>::iterations() const { return CN_ITER / 8; } template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_PICO_0>::iterations() const { return CN_ITER / 8; }
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_PICO_TLO>::iterations() const { return CN_ITER / 8; } template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_PICO_TLO>::iterations() const { return CN_ITER / 8; }
template<> constexpr inline uint32_t CnAlgo<Algorithm::CN_CCX>::iterations() const { return CN_ITER / 2; }
template<> constexpr inline size_t CnAlgo<Algorithm::CN_LITE_0>::memory() const { return CN_MEMORY / 2; } template<> constexpr inline size_t CnAlgo<Algorithm::CN_LITE_0>::memory() const { return CN_MEMORY / 2; }

View File

@@ -270,6 +270,8 @@ xmrig::CnHash::CnHash()
ADD_FN_ASM(Algorithm::CN_PICO_TLO); ADD_FN_ASM(Algorithm::CN_PICO_TLO);
# endif # endif
ADD_FN(Algorithm::CN_CCX);
# ifdef XMRIG_ALGO_ARGON2 # ifdef XMRIG_ALGO_ARGON2
m_map[Algorithm::AR2_CHUKWA][AV_SINGLE][Assembly::NONE] = argon2::single_hash<Algorithm::AR2_CHUKWA>; m_map[Algorithm::AR2_CHUKWA][AV_SINGLE][Assembly::NONE] = argon2::single_hash<Algorithm::AR2_CHUKWA>;
m_map[Algorithm::AR2_CHUKWA][AV_SINGLE_SOFT][Assembly::NONE] = argon2::single_hash<Algorithm::AR2_CHUKWA>; m_map[Algorithm::AR2_CHUKWA][AV_SINGLE_SOFT][Assembly::NONE] = argon2::single_hash<Algorithm::AR2_CHUKWA>;

View File

@@ -442,6 +442,24 @@ static inline void cryptonight_monero_tweak(const uint8_t* l, uint64_t idx, __m1
} }
static inline void cryptonight_conceal_tweak(__m128i& cx, __m128& conc_var)
{
__m128 r = _mm_add_ps(_mm_cvtepi32_ps(cx), conc_var);
r = _mm_mul_ps(r, _mm_mul_ps(r, r));
r = _mm_and_ps(_mm_castsi128_ps(_mm_set1_epi32(0x807FFFFF)), r);
r = _mm_or_ps(_mm_castsi128_ps(_mm_set1_epi32(0x40000000)), r);
__m128 c_old = conc_var;
conc_var = _mm_add_ps(conc_var, r);
c_old = _mm_and_ps(_mm_castsi128_ps(_mm_set1_epi32(0x807FFFFF)), c_old);
c_old = _mm_or_ps(_mm_castsi128_ps(_mm_set1_epi32(0x40000000)), c_old);
__m128 nc = _mm_mul_ps(c_old, _mm_set1_ps(536870880.0f));
cx = _mm_xor_si128(cx, _mm_cvttps_epi32(nc));
}
template<Algorithm::Id ALGO, bool SOFT_AES> template<Algorithm::Id ALGO, bool SOFT_AES>
inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t size, uint8_t *__restrict__ output, cryptonight_ctx **__restrict__ ctx, uint64_t height) inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t size, uint8_t *__restrict__ output, cryptonight_ctx **__restrict__ ctx, uint64_t height)
{ {
@@ -475,12 +493,20 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si
__m128i bx0 = _mm_set_epi64x(h0[3] ^ h0[7], h0[2] ^ h0[6]); __m128i bx0 = _mm_set_epi64x(h0[3] ^ h0[7], h0[2] ^ h0[6]);
__m128i bx1 = _mm_set_epi64x(h0[9] ^ h0[11], h0[8] ^ h0[10]); __m128i bx1 = _mm_set_epi64x(h0[9] ^ h0[11], h0[8] ^ h0[10]);
__m128 conc_var;
if (ALGO == Algorithm::CN_CCX) {
conc_var = _mm_setzero_ps();
}
uint64_t idx0 = al0; uint64_t idx0 = al0;
for (size_t i = 0; i < props.iterations(); i++) { for (size_t i = 0; i < props.iterations(); i++) {
__m128i cx; __m128i cx;
if (IS_CN_HEAVY_TUBE || !SOFT_AES) { if (IS_CN_HEAVY_TUBE || !SOFT_AES) {
cx = _mm_load_si128(reinterpret_cast<const __m128i *>(&l0[idx0 & MASK])); cx = _mm_load_si128(reinterpret_cast<const __m128i *>(&l0[idx0 & MASK]));
if (ALGO == Algorithm::CN_CCX) {
cryptonight_conceal_tweak(cx, conc_var);
}
} }
const __m128i ax0 = _mm_set_epi64x(ah0, al0); const __m128i ax0 = _mm_set_epi64x(ah0, al0);
@@ -488,7 +514,14 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si
cx = aes_round_tweak_div(cx, ax0); cx = aes_round_tweak_div(cx, ax0);
} }
else if (SOFT_AES) { else if (SOFT_AES) {
cx = soft_aesenc((uint32_t*)&l0[idx0 & MASK], ax0); if (ALGO == Algorithm::CN_CCX) {
cx = _mm_load_si128(reinterpret_cast<const __m128i*>(&l0[idx0 & MASK]));
cryptonight_conceal_tweak(cx, conc_var);
cx = soft_aesenc((uint32_t*)&cx, ax0);
}
else {
cx = soft_aesenc((uint32_t*)&l0[idx0 & MASK], ax0);
}
} }
else { else {
cx = _mm_aesenc_si128(cx, ax0); cx = _mm_aesenc_si128(cx, ax0);
@@ -622,6 +655,12 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
__m128i bx10 = _mm_set_epi64x(h1[3] ^ h1[7], h1[2] ^ h1[6]); __m128i bx10 = _mm_set_epi64x(h1[3] ^ h1[7], h1[2] ^ h1[6]);
__m128i bx11 = _mm_set_epi64x(h1[9] ^ h1[11], h1[8] ^ h1[10]); __m128i bx11 = _mm_set_epi64x(h1[9] ^ h1[11], h1[8] ^ h1[10]);
__m128 conc_var0, conc_var1;
if (ALGO == Algorithm::CN_CCX) {
conc_var0 = _mm_setzero_ps();
conc_var1 = _mm_setzero_ps();
}
uint64_t idx0 = al0; uint64_t idx0 = al0;
uint64_t idx1 = al1; uint64_t idx1 = al1;
@@ -630,6 +669,10 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
if (IS_CN_HEAVY_TUBE || !SOFT_AES) { if (IS_CN_HEAVY_TUBE || !SOFT_AES) {
cx0 = _mm_load_si128((__m128i *) &l0[idx0 & MASK]); cx0 = _mm_load_si128((__m128i *) &l0[idx0 & MASK]);
cx1 = _mm_load_si128((__m128i *) &l1[idx1 & MASK]); cx1 = _mm_load_si128((__m128i *) &l1[idx1 & MASK]);
if (ALGO == Algorithm::CN_CCX) {
cryptonight_conceal_tweak(cx0, conc_var0);
cryptonight_conceal_tweak(cx1, conc_var1);
}
} }
const __m128i ax0 = _mm_set_epi64x(ah0, al0); const __m128i ax0 = _mm_set_epi64x(ah0, al0);
@@ -639,8 +682,18 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
cx1 = aes_round_tweak_div(cx1, ax1); cx1 = aes_round_tweak_div(cx1, ax1);
} }
else if (SOFT_AES) { else if (SOFT_AES) {
cx0 = soft_aesenc((uint32_t*)&l0[idx0 & MASK], ax0); if (ALGO == Algorithm::CN_CCX) {
cx1 = soft_aesenc((uint32_t*)&l1[idx1 & MASK], ax1); cx0 = _mm_load_si128((__m128i *) &l0[idx0 & MASK]);
cx1 = _mm_load_si128((__m128i *) &l1[idx1 & MASK]);
cryptonight_conceal_tweak(cx0, conc_var0);
cryptonight_conceal_tweak(cx1, conc_var1);
cx0 = soft_aesenc((uint32_t*)&cx0, ax0);
cx1 = soft_aesenc((uint32_t*)&cx1, ax1);
}
else {
cx0 = soft_aesenc((uint32_t*)&l0[idx0 & MASK], ax0);
cx1 = soft_aesenc((uint32_t*)&l1[idx1 & MASK], ax1);
}
} }
else { else {
cx0 = _mm_aesenc_si128(cx0, ax0); cx0 = _mm_aesenc_si128(cx0, ax0);

View File

@@ -67,8 +67,10 @@
#ifdef _MSC_VER #ifdef _MSC_VER
# define VARIANT2_SET_ROUNDING_MODE() if (BASE == Algorithm::CN_2) { _control87(RC_DOWN, MCW_RC); } # define VARIANT2_SET_ROUNDING_MODE() if (BASE == Algorithm::CN_2) { _control87(RC_DOWN, MCW_RC); }
# define RESTORE_ROUNDING_MODE() _control87(RC_NEAR, MCW_RC);
#else #else
# define VARIANT2_SET_ROUNDING_MODE() if (BASE == Algorithm::CN_2) { fesetround(FE_DOWNWARD); } # define VARIANT2_SET_ROUNDING_MODE() if (BASE == Algorithm::CN_2) { fesetround(FE_DOWNWARD); }
# define RESTORE_ROUNDING_MODE() fesetround(FE_TONEAREST);
#endif #endif
# define VARIANT2_INTEGER_MATH(part, cl, cx) \ # define VARIANT2_INTEGER_MATH(part, cl, cx) \

View File

@@ -231,6 +231,20 @@ const static uint8_t test_output_zls[160] = {
0x00, 0x08, 0x64, 0xF0, 0xA6, 0xC8, 0x94, 0x45, 0x08, 0xED, 0x03, 0x95, 0x52, 0xE9, 0xBC, 0x5F 0x00, 0x08, 0x64, 0xF0, 0xA6, 0xC8, 0x94, 0x45, 0x08, 0xED, 0x03, 0x95, 0x52, 0xE9, 0xBC, 0x5F
}; };
// "cn/ccx"
const static uint8_t test_output_ccx[160] = {
0xB3, 0xA1, 0x67, 0x86, 0xD2, 0xC9, 0x85, 0xEC, 0xAD, 0xC4, 0x5F, 0x91, 0x05, 0x27, 0xC7, 0xA1,
0x96, 0xF0, 0xE1, 0xE9, 0x7C, 0x87, 0x09, 0x38, 0x1D, 0x7D, 0x41, 0x93, 0x35, 0xF8, 0x16, 0x72,
0xC3, 0xBD, 0x8D, 0xE8, 0xD5, 0xAE, 0xB8, 0x59, 0x0A, 0x6C, 0xCB, 0x7B, 0x41, 0x30, 0xF7, 0x04,
0xA5, 0x7C, 0xF9, 0xCA, 0x20, 0x49, 0x9C, 0xFD, 0xE8, 0x43, 0xCF, 0x66, 0x78, 0xEA, 0x76, 0xDD,
0x91, 0x0C, 0xDE, 0x29, 0x2A, 0xE0, 0xA8, 0xCA, 0xBC, 0xAA, 0x53, 0x4C, 0x93, 0x3E, 0x7B, 0x2C,
0xF1, 0xF9, 0xE1, 0x98, 0xB2, 0x92, 0x1E, 0x19, 0x93, 0x2A, 0x74, 0x9D, 0xDB, 0x10, 0x0F, 0x16,
0xD5, 0x3D, 0xE4, 0xC4, 0x23, 0xD9, 0x2E, 0xFD, 0x79, 0x8D, 0x1E, 0x48, 0x4E, 0x46, 0x08, 0x6C,
0xFF, 0x8A, 0x49, 0xFA, 0x1E, 0xB0, 0xB6, 0x9A, 0x47, 0x1C, 0xC6, 0x30, 0x36, 0x5D, 0xFD, 0x76,
0x10, 0x07, 0x44, 0xE6, 0xC8, 0x20, 0x2A, 0x84, 0x9D, 0x70, 0x22, 0x00, 0x8B, 0x9B, 0xBD, 0x8D,
0x27, 0x49, 0xA6, 0x06, 0xDC, 0xF0, 0xA1, 0x4B, 0x50, 0xA0, 0x12, 0xCD, 0x77, 0x01, 0x4C, 0x28
};
// "cn/double" // "cn/double"
const static uint8_t test_output_double[160] = { const static uint8_t test_output_double[160] = {
0xAE, 0xFB, 0xB3, 0xF0, 0xCC, 0x88, 0x04, 0x6D, 0x11, 0x9F, 0x6C, 0x54, 0xB9, 0x6D, 0x90, 0xC9, 0xAE, 0xFB, 0xB3, 0xF0, 0xCC, 0x88, 0x04, 0x6D, 0x11, 0x9F, 0x6C, 0x54, 0xB9, 0x6D, 0x90, 0xC9,

View File

@@ -541,6 +541,23 @@ static inline void cryptonight_monero_tweak(uint64_t *mem_out, const uint8_t *l,
} }
static inline void cryptonight_conceal_tweak(__m128i& cx, __m128& conc_var)
{
__m128 r = _mm_add_ps(_mm_cvtepi32_ps(cx), conc_var);
r = _mm_mul_ps(r, _mm_mul_ps(r, r));
r = _mm_and_ps(_mm_castsi128_ps(_mm_set1_epi32(0x807FFFFF)), r);
r = _mm_or_ps(_mm_castsi128_ps(_mm_set1_epi32(0x40000000)), r);
__m128 c_old = conc_var;
conc_var = _mm_add_ps(conc_var, r);
c_old = _mm_and_ps(_mm_castsi128_ps(_mm_set1_epi32(0x807FFFFF)), c_old);
c_old = _mm_or_ps(_mm_castsi128_ps(_mm_set1_epi32(0x40000000)), c_old);
__m128 nc = _mm_mul_ps(c_old, _mm_set1_ps(536870880.0f));
cx = _mm_xor_si128(cx, _mm_cvttps_epi32(nc));
}
template<Algorithm::Id ALGO, bool SOFT_AES> template<Algorithm::Id ALGO, bool SOFT_AES>
inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t size, uint8_t *__restrict__ output, cryptonight_ctx **__restrict__ ctx, uint64_t height) inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t size, uint8_t *__restrict__ output, cryptonight_ctx **__restrict__ ctx, uint64_t height)
{ {
@@ -594,10 +611,19 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si
__m128i bx0 = _mm_set_epi64x(static_cast<int64_t>(h0[3] ^ h0[7]), static_cast<int64_t>(h0[2] ^ h0[6])); __m128i bx0 = _mm_set_epi64x(static_cast<int64_t>(h0[3] ^ h0[7]), static_cast<int64_t>(h0[2] ^ h0[6]));
__m128i bx1 = _mm_set_epi64x(static_cast<int64_t>(h0[9] ^ h0[11]), static_cast<int64_t>(h0[8] ^ h0[10])); __m128i bx1 = _mm_set_epi64x(static_cast<int64_t>(h0[9] ^ h0[11]), static_cast<int64_t>(h0[8] ^ h0[10]));
__m128 conc_var;
if (ALGO == Algorithm::CN_CCX) {
conc_var = _mm_setzero_ps();
RESTORE_ROUNDING_MODE();
}
for (size_t i = 0; i < props.iterations(); i++) { for (size_t i = 0; i < props.iterations(); i++) {
__m128i cx; __m128i cx;
if (IS_CN_HEAVY_TUBE || !SOFT_AES) { if (IS_CN_HEAVY_TUBE || !SOFT_AES) {
cx = _mm_load_si128(reinterpret_cast<const __m128i *>(&l0[idx0 & MASK])); cx = _mm_load_si128(reinterpret_cast<const __m128i *>(&l0[idx0 & MASK]));
if (ALGO == Algorithm::CN_CCX) {
cryptonight_conceal_tweak(cx, conc_var);
}
} }
const __m128i ax0 = _mm_set_epi64x(static_cast<int64_t>(ah0), static_cast<int64_t>(al0)); const __m128i ax0 = _mm_set_epi64x(static_cast<int64_t>(ah0), static_cast<int64_t>(al0));
@@ -605,7 +631,14 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si
cx = aes_round_tweak_div(cx, ax0); cx = aes_round_tweak_div(cx, ax0);
} }
else if (SOFT_AES) { else if (SOFT_AES) {
cx = soft_aesenc(&l0[idx0 & MASK], ax0, reinterpret_cast<const uint32_t*>(saes_table)); if (ALGO == Algorithm::CN_CCX) {
cx = _mm_load_si128(reinterpret_cast<const __m128i*>(&l0[idx0 & MASK]));
cryptonight_conceal_tweak(cx, conc_var);
cx = soft_aesenc(&cx, ax0, reinterpret_cast<const uint32_t*>(saes_table));
}
else {
cx = soft_aesenc(&l0[idx0 & MASK], ax0, reinterpret_cast<const uint32_t*>(saes_table));
}
} }
else { else {
cx = _mm_aesenc_si128(cx, ax0); cx = _mm_aesenc_si128(cx, ax0);
@@ -971,6 +1004,13 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
__m128i bx10 = _mm_set_epi64x(h1[3] ^ h1[7], h1[2] ^ h1[6]); __m128i bx10 = _mm_set_epi64x(h1[3] ^ h1[7], h1[2] ^ h1[6]);
__m128i bx11 = _mm_set_epi64x(h1[9] ^ h1[11], h1[8] ^ h1[10]); __m128i bx11 = _mm_set_epi64x(h1[9] ^ h1[11], h1[8] ^ h1[10]);
__m128 conc_var0, conc_var1;
if (ALGO == Algorithm::CN_CCX) {
conc_var0 = _mm_setzero_ps();
conc_var1 = _mm_setzero_ps();
RESTORE_ROUNDING_MODE();
}
uint64_t idx0 = al0; uint64_t idx0 = al0;
uint64_t idx1 = al1; uint64_t idx1 = al1;
@@ -979,6 +1019,10 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
if (IS_CN_HEAVY_TUBE || !SOFT_AES) { if (IS_CN_HEAVY_TUBE || !SOFT_AES) {
cx0 = _mm_load_si128(reinterpret_cast<const __m128i *>(&l0[idx0 & MASK])); cx0 = _mm_load_si128(reinterpret_cast<const __m128i *>(&l0[idx0 & MASK]));
cx1 = _mm_load_si128(reinterpret_cast<const __m128i *>(&l1[idx1 & MASK])); cx1 = _mm_load_si128(reinterpret_cast<const __m128i *>(&l1[idx1 & MASK]));
if (ALGO == Algorithm::CN_CCX) {
cryptonight_conceal_tweak(cx0, conc_var0);
cryptonight_conceal_tweak(cx1, conc_var1);
}
} }
const __m128i ax0 = _mm_set_epi64x(ah0, al0); const __m128i ax0 = _mm_set_epi64x(ah0, al0);
@@ -988,8 +1032,18 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
cx1 = aes_round_tweak_div(cx1, ax1); cx1 = aes_round_tweak_div(cx1, ax1);
} }
else if (SOFT_AES) { else if (SOFT_AES) {
cx0 = soft_aesenc(&l0[idx0 & MASK], ax0, reinterpret_cast<const uint32_t*>(saes_table)); if (ALGO == Algorithm::CN_CCX) {
cx1 = soft_aesenc(&l1[idx1 & MASK], ax1, reinterpret_cast<const uint32_t*>(saes_table)); cx0 = _mm_load_si128(reinterpret_cast<const __m128i*>(&l0[idx0 & MASK]));
cx1 = _mm_load_si128(reinterpret_cast<const __m128i*>(&l1[idx1 & MASK]));
cryptonight_conceal_tweak(cx0, conc_var0);
cryptonight_conceal_tweak(cx1, conc_var1);
cx0 = soft_aesenc(&cx0, ax0, reinterpret_cast<const uint32_t*>(saes_table));
cx1 = soft_aesenc(&cx1, ax1, reinterpret_cast<const uint32_t*>(saes_table));
}
else {
cx0 = soft_aesenc(&l0[idx0 & MASK], ax0, reinterpret_cast<const uint32_t*>(saes_table));
cx1 = soft_aesenc(&l1[idx1 & MASK], ax1, reinterpret_cast<const uint32_t*>(saes_table));
}
} }
else { else {
cx0 = _mm_aesenc_si128(cx0, ax0); cx0 = _mm_aesenc_si128(cx0, ax0);
@@ -1144,9 +1198,13 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
} }
#define CN_STEP1(a, b0, b1, c, l, ptr, idx) \ #define CN_STEP1(a, b0, b1, c, l, ptr, idx, conc_var) \
ptr = reinterpret_cast<__m128i*>(&l[idx & MASK]); \ ptr = reinterpret_cast<__m128i*>(&l[idx & MASK]); \
c = _mm_load_si128(ptr); c = _mm_load_si128(ptr); \
if (ALGO == Algorithm::CN_CCX) { \
cryptonight_conceal_tweak(c, conc_var); \
}
#define CN_STEP2(a, b0, b1, c, l, ptr, idx) \ #define CN_STEP2(a, b0, b1, c, l, ptr, idx) \
@@ -1246,6 +1304,10 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
__m128i bx##n##0 = _mm_set_epi64x(h##n[3] ^ h##n[7], h##n[2] ^ h##n[6]); \ __m128i bx##n##0 = _mm_set_epi64x(h##n[3] ^ h##n[7], h##n[2] ^ h##n[6]); \
__m128i bx##n##1 = _mm_set_epi64x(h##n[9] ^ h##n[11], h##n[8] ^ h##n[10]); \ __m128i bx##n##1 = _mm_set_epi64x(h##n[9] ^ h##n[11], h##n[8] ^ h##n[10]); \
__m128i cx##n = _mm_setzero_si128(); \ __m128i cx##n = _mm_setzero_si128(); \
__m128 conc_var##n; \
if (ALGO == Algorithm::CN_CCX) { \
conc_var##n = _mm_setzero_ps(); \
} \
VARIANT4_RANDOM_MATH_INIT(n); VARIANT4_RANDOM_MATH_INIT(n);
@@ -1285,6 +1347,9 @@ inline void cryptonight_triple_hash(const uint8_t *__restrict__ input, size_t si
CONST_INIT(ctx[1], 1); CONST_INIT(ctx[1], 1);
CONST_INIT(ctx[2], 2); CONST_INIT(ctx[2], 2);
VARIANT2_SET_ROUNDING_MODE(); VARIANT2_SET_ROUNDING_MODE();
if (ALGO == Algorithm::CN_CCX) {
RESTORE_ROUNDING_MODE();
}
uint64_t idx0, idx1, idx2; uint64_t idx0, idx1, idx2;
idx0 = _mm_cvtsi128_si64(ax0); idx0 = _mm_cvtsi128_si64(ax0);
@@ -1295,9 +1360,9 @@ inline void cryptonight_triple_hash(const uint8_t *__restrict__ input, size_t si
uint64_t hi, lo; uint64_t hi, lo;
__m128i *ptr0, *ptr1, *ptr2; __m128i *ptr0, *ptr1, *ptr2;
CN_STEP1(ax0, bx00, bx01, cx0, l0, ptr0, idx0); CN_STEP1(ax0, bx00, bx01, cx0, l0, ptr0, idx0, conc_var0);
CN_STEP1(ax1, bx10, bx11, cx1, l1, ptr1, idx1); CN_STEP1(ax1, bx10, bx11, cx1, l1, ptr1, idx1, conc_var1);
CN_STEP1(ax2, bx20, bx21, cx2, l2, ptr2, idx2); CN_STEP1(ax2, bx20, bx21, cx2, l2, ptr2, idx2, conc_var2);
CN_STEP2(ax0, bx00, bx01, cx0, l0, ptr0, idx0); CN_STEP2(ax0, bx00, bx01, cx0, l0, ptr0, idx0);
CN_STEP2(ax1, bx10, bx11, cx1, l1, ptr1, idx1); CN_STEP2(ax1, bx10, bx11, cx1, l1, ptr1, idx1);
@@ -1359,6 +1424,9 @@ inline void cryptonight_quad_hash(const uint8_t *__restrict__ input, size_t size
CONST_INIT(ctx[2], 2); CONST_INIT(ctx[2], 2);
CONST_INIT(ctx[3], 3); CONST_INIT(ctx[3], 3);
VARIANT2_SET_ROUNDING_MODE(); VARIANT2_SET_ROUNDING_MODE();
if (ALGO == Algorithm::CN_CCX) {
RESTORE_ROUNDING_MODE();
}
uint64_t idx0, idx1, idx2, idx3; uint64_t idx0, idx1, idx2, idx3;
idx0 = _mm_cvtsi128_si64(ax0); idx0 = _mm_cvtsi128_si64(ax0);
@@ -1370,10 +1438,10 @@ inline void cryptonight_quad_hash(const uint8_t *__restrict__ input, size_t size
uint64_t hi, lo; uint64_t hi, lo;
__m128i *ptr0, *ptr1, *ptr2, *ptr3; __m128i *ptr0, *ptr1, *ptr2, *ptr3;
CN_STEP1(ax0, bx00, bx01, cx0, l0, ptr0, idx0); CN_STEP1(ax0, bx00, bx01, cx0, l0, ptr0, idx0, conc_var0);
CN_STEP1(ax1, bx10, bx11, cx1, l1, ptr1, idx1); CN_STEP1(ax1, bx10, bx11, cx1, l1, ptr1, idx1, conc_var1);
CN_STEP1(ax2, bx20, bx21, cx2, l2, ptr2, idx2); CN_STEP1(ax2, bx20, bx21, cx2, l2, ptr2, idx2, conc_var2);
CN_STEP1(ax3, bx30, bx31, cx3, l3, ptr3, idx3); CN_STEP1(ax3, bx30, bx31, cx3, l3, ptr3, idx3, conc_var3);
CN_STEP2(ax0, bx00, bx01, cx0, l0, ptr0, idx0); CN_STEP2(ax0, bx00, bx01, cx0, l0, ptr0, idx0);
CN_STEP2(ax1, bx10, bx11, cx1, l1, ptr1, idx1); CN_STEP2(ax1, bx10, bx11, cx1, l1, ptr1, idx1);
@@ -1441,6 +1509,9 @@ inline void cryptonight_penta_hash(const uint8_t *__restrict__ input, size_t siz
CONST_INIT(ctx[3], 3); CONST_INIT(ctx[3], 3);
CONST_INIT(ctx[4], 4); CONST_INIT(ctx[4], 4);
VARIANT2_SET_ROUNDING_MODE(); VARIANT2_SET_ROUNDING_MODE();
if (ALGO == Algorithm::CN_CCX) {
RESTORE_ROUNDING_MODE();
}
uint64_t idx0, idx1, idx2, idx3, idx4; uint64_t idx0, idx1, idx2, idx3, idx4;
idx0 = _mm_cvtsi128_si64(ax0); idx0 = _mm_cvtsi128_si64(ax0);
@@ -1453,11 +1524,11 @@ inline void cryptonight_penta_hash(const uint8_t *__restrict__ input, size_t siz
uint64_t hi, lo; uint64_t hi, lo;
__m128i *ptr0, *ptr1, *ptr2, *ptr3, *ptr4; __m128i *ptr0, *ptr1, *ptr2, *ptr3, *ptr4;
CN_STEP1(ax0, bx00, bx01, cx0, l0, ptr0, idx0); CN_STEP1(ax0, bx00, bx01, cx0, l0, ptr0, idx0, conc_var0);
CN_STEP1(ax1, bx10, bx11, cx1, l1, ptr1, idx1); CN_STEP1(ax1, bx10, bx11, cx1, l1, ptr1, idx1, conc_var1);
CN_STEP1(ax2, bx20, bx21, cx2, l2, ptr2, idx2); CN_STEP1(ax2, bx20, bx21, cx2, l2, ptr2, idx2, conc_var2);
CN_STEP1(ax3, bx30, bx31, cx3, l3, ptr3, idx3); CN_STEP1(ax3, bx30, bx31, cx3, l3, ptr3, idx3, conc_var3);
CN_STEP1(ax4, bx40, bx41, cx4, l4, ptr4, idx4); CN_STEP1(ax4, bx40, bx41, cx4, l4, ptr4, idx4, conc_var4);
CN_STEP2(ax0, bx00, bx01, cx0, l0, ptr0, idx0); CN_STEP2(ax0, bx00, bx01, cx0, l0, ptr0, idx0);
CN_STEP2(ax1, bx10, bx11, cx1, l1, ptr1, idx1); CN_STEP2(ax1, bx10, bx11, cx1, l1, ptr1, idx1);

View File

@@ -213,16 +213,17 @@ static void E8(hashState *state)
/*The compression function F8 */ /*The compression function F8 */
static void F8(hashState *state) static void F8(hashState *state)
{ {
uint64 i; uint64_t* x = (uint64_t*)state->x;
const uint64_t* buf = (uint64*)state->buffer;
/*xor the 512-bit message with the fist half of the 1024-bit hash state*/ /*xor the 512-bit message with the fist half of the 1024-bit hash state*/
for (i = 0; i < 8; i++) state->x[i >> 1][i & 1] ^= ((uint64*)state->buffer)[i]; for (int i = 0; i < 8; ++i) x[i] ^= buf[i];
/*the bijective function E8 */ /*the bijective function E8 */
E8(state); E8(state);
/*xor the 512-bit message with the second half of the 1024-bit hash state*/ /*xor the 512-bit message with the second half of the 1024-bit hash state*/
for (i = 0; i < 8; i++) state->x[(8+i) >> 1][(8+i) & 1] ^= ((uint64*)state->buffer)[i]; for (int i = 0; i < 8; ++i) x[i + 8] ^= buf[i];
} }
/*before hashing a message, initialize the hash state as H0 */ /*before hashing a message, initialize the hash state as H0 */
@@ -240,6 +241,7 @@ static HashReturn Init(hashState *state, int hashbitlen)
case 224: memcpy(state->x,JH224_H0,128); break; case 224: memcpy(state->x,JH224_H0,128); break;
case 256: memcpy(state->x,JH256_H0,128); break; case 256: memcpy(state->x,JH256_H0,128); break;
case 384: memcpy(state->x,JH384_H0,128); break; case 384: memcpy(state->x,JH384_H0,128); break;
default:
case 512: memcpy(state->x,JH512_H0,128); break; case 512: memcpy(state->x,JH512_H0,128); break;
} }

View File

@@ -1,14 +1,6 @@
/* XMRig /* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com> * Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org> * Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
* Copyright 2018-2019 tevador <tevador@gmail.com>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -26,6 +18,8 @@
#include <cinttypes> #include <cinttypes>
#include <algorithm>
#include <thread>
#include "crypto/kawpow/KPCache.h" #include "crypto/kawpow/KPCache.h"
#include "3rdparty/libethash/data_sizes.h" #include "3rdparty/libethash/data_sizes.h"
@@ -83,8 +77,30 @@ bool KPCache::init(uint32_t epoch)
cache.num_parent_nodes = cache.cache_size / sizeof(node); cache.num_parent_nodes = cache.cache_size / sizeof(node);
calculate_fast_mod_data(cache.num_parent_nodes, cache.reciprocal, cache.increment, cache.shift); calculate_fast_mod_data(cache.num_parent_nodes, cache.reciprocal, cache.increment, cache.shift);
for (uint32_t i = 0; i < sizeof(m_l1Cache) / sizeof(node); ++i) { const uint64_t cache_nodes = (size + sizeof(node) * 4 - 1) / sizeof(node);
ethash_calculate_dag_item_opt(((node*)m_l1Cache) + i, i, num_dataset_parents, &cache); m_DAGCache.resize(cache_nodes * (sizeof(node) / sizeof(uint32_t)));
// Init DAG cache
{
const uint64_t n = std::max(std::thread::hardware_concurrency(), 1U);
std::vector<std::thread> threads;
threads.reserve(n);
for (uint64_t i = 0; i < n; ++i) {
const uint32_t a = (cache_nodes * i) / n;
const uint32_t b = (cache_nodes * (i + 1)) / n;
threads.emplace_back([this, a, b, cache_nodes, &cache]() {
for (uint32_t j = a; j < b; ++j) {
ethash_calculate_dag_item_opt(((node*)m_DAGCache.data()) + j, j, num_dataset_parents, &cache);
}
});
}
for (auto& t : threads) {
t.join();
}
} }
m_size = size; m_size = size;

View File

@@ -1,14 +1,6 @@
/* XMRig /* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
* Copyright 2018-2019 tevador <tevador@gmail.com>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh> * Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com> * Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -30,6 +22,7 @@
#include "base/tools/Object.h" #include "base/tools/Object.h"
#include <mutex> #include <mutex>
#include <vector>
namespace xmrig namespace xmrig
@@ -57,7 +50,7 @@ public:
size_t size() const { return m_size; } size_t size() const { return m_size; }
uint32_t epoch() const { return m_epoch; } uint32_t epoch() const { return m_epoch; }
const uint32_t* l1_cache() const { return m_l1Cache; } const uint32_t* l1_cache() const { return m_DAGCache.data(); }
static uint64_t cache_size(uint32_t epoch); static uint64_t cache_size(uint32_t epoch);
static uint64_t dag_size(uint32_t epoch); static uint64_t dag_size(uint32_t epoch);
@@ -71,7 +64,7 @@ private:
VirtualMemory* m_memory = nullptr; VirtualMemory* m_memory = nullptr;
size_t m_size = 0; size_t m_size = 0;
uint32_t m_epoch = 0xFFFFFFFFUL; uint32_t m_epoch = 0xFFFFFFFFUL;
uint32_t m_l1Cache[l1_cache_num_items] = {}; std::vector<uint32_t> m_DAGCache;
}; };

View File

@@ -28,14 +28,14 @@
#define APP_ID "xmrig" #define APP_ID "xmrig"
#define APP_NAME "XMRig" #define APP_NAME "XMRig"
#define APP_DESC "XMRig miner" #define APP_DESC "XMRig miner"
#define APP_VERSION "6.0.0-beta" #define APP_VERSION "6.2.0-beta"
#define APP_DOMAIN "xmrig.com" #define APP_DOMAIN "xmrig.com"
#define APP_SITE "www.xmrig.com" #define APP_SITE "www.xmrig.com"
#define APP_COPYRIGHT "Copyright (C) 2016-2020 xmrig.com" #define APP_COPYRIGHT "Copyright (C) 2016-2020 xmrig.com"
#define APP_KIND "miner" #define APP_KIND "miner"
#define APP_VER_MAJOR 6 #define APP_VER_MAJOR 6
#define APP_VER_MINOR 0 #define APP_VER_MINOR 2
#define APP_VER_PATCH 0 #define APP_VER_PATCH 0
#ifdef _MSC_VER #ifdef _MSC_VER