From 76b4f9767fa5063d9dd8720121eaa78134eb523c Mon Sep 17 00:00:00 2001 From: BenDr0id Date: Fri, 16 Mar 2018 15:49:17 +0100 Subject: [PATCH 1/8] Added possibility to overrule the PoW Added PoW adaptions for upcoming AEON PoW changes --- src/Options.cpp | 17 ++++++++++++++--- src/Options.h | 14 +++++++++++--- src/crypto/CryptoNight.cpp | 22 ++++++++++++++-------- src/crypto/CryptoNight_arm.h | 12 ++++++------ src/crypto/CryptoNight_x86.h | 12 ++++++------ src/net/strategies/DonateStrategy.cpp | 4 ++-- 6 files changed, 53 insertions(+), 28 deletions(-) diff --git a/src/Options.cpp b/src/Options.cpp index d26efecb..f8d173d8 100644 --- a/src/Options.cpp +++ b/src/Options.cpp @@ -160,7 +160,8 @@ static struct option const options[] = { { "user-agent", 1, nullptr, 1008 }, { "userpass", 1, nullptr, 'O' }, { "version", 0, nullptr, 'V' }, - { "use-tls", 1, nullptr, 1015 }, + { "use-tls", 0, nullptr, 1015 }, + { "force-pow-version",1, nullptr, 1016 }, { "api-port", 1, nullptr, 4000 }, { "api-access-token", 1, nullptr, 4001 }, { "api-worker-id", 1, nullptr, 4002 }, @@ -203,6 +204,7 @@ static struct option const config_options[] = { { "syslog", 0, nullptr, 'S' }, { "threads", 1, nullptr, 't' }, { "user-agent", 1, nullptr, 1008 }, + { "force-pow-version", 1, nullptr, 1016 }, { "doublehash-thread-mask", 1, nullptr, 4013 }, { "multihash-thread-mask", 1, nullptr, 4013 }, { nullptr, 0, nullptr, 0 } @@ -302,6 +304,7 @@ Options::Options(int argc, char **argv) : m_ccKeyFile(nullptr), m_ccCertFile(nullptr), m_algo(ALGO_CRYPTONIGHT), + m_forcePowVersion(POW_AUTODETECT), m_algoVariant(AV0_AUTO), m_aesni(AESNI_AUTO), m_hashFactor(0), @@ -522,11 +525,10 @@ bool Options::parseArg(int key, const char *arg) case 1003: /* --donate-level */ case 1004: /* --max-cpu-usage */ case 1007: /* --print-time */ + case 1016: /* --force-pow-version */ case 1021: /* --cpu-priority */ case 4000: /* --api-port */ - return parseArg(key, strtol(arg, nullptr, 10)); case 4006: /* --cc-port */ - return parseArg(key, strtol(arg, nullptr, 10)); case 4012: /* --cc-update-interval-c */ return parseArg(key, strtol(arg, nullptr, 10)); @@ -671,6 +673,15 @@ bool Options::parseArg(int key, uint64_t arg) m_printTime = (int) arg; break; + case 1016: /* --force-pow-version */ + if (arg < POW_AUTODETECT || arg > POW_V2) { + showUsage(1); + return false; + } + + m_forcePowVersion = static_cast(arg); + break; + case 1020: /* --cpu-affinity */ if (arg) { m_affinity = arg; diff --git a/src/Options.h b/src/Options.h index 9e24c34e..bd4c8140 100644 --- a/src/Options.h +++ b/src/Options.h @@ -61,6 +61,12 @@ public: AESNI_OFF }; + enum PowVersion { + POW_AUTODETECT, /* Default, automatic detect by block version */ + POW_V1, /* Force to use PoW algo before 28.03.2018 */ + POW_V2, /* Force to use PoW algo used by Monero V7 (after 28.03.2018) and AEON */ + }; + static inline Options* i() { return m_self; } static Options *parse(int argc, char **argv); @@ -86,19 +92,20 @@ public: inline const char *ccCertFile() const { return m_ccCertFile == nullptr ? "server.pem" : m_ccCertFile; } inline const std::vector &pools() const { return m_pools; } inline Algo algo() const { return m_algo; } + inline PowVersion forcePowVersion() const { return m_forcePowVersion; } inline bool aesni() const { return m_aesni == AESNI_ON; } - inline size_t hashFactor() const { return m_hashFactor; } + inline size_t hashFactor() const { return m_hashFactor; } inline int apiPort() const { return m_apiPort; } inline int donateLevel() const { return m_donateLevel; } inline int printTime() const { return m_printTime; } inline int priority() const { return m_priority; } inline int retries() const { return m_retries; } inline int retryPause() const { return m_retryPause; } - inline size_t threads() const { return m_threads; } + inline size_t threads() const { return m_threads; } inline int ccUpdateInterval() const { return m_ccUpdateInterval; } inline int ccPort() const { return m_ccPort; } inline int64_t affinity() const { return m_affinity; } - inline int64_t multiHashThreadMask() const { return m_multiHashThreadMask; } + inline int64_t multiHashThreadMask() const { return m_multiHashThreadMask; } inline void setColors(bool colors) { m_colors = colors; } inline static void release() { delete m_self; } @@ -155,6 +162,7 @@ private: Algo m_algo; AlgoVariant m_algoVariant; AesNi m_aesni; + PowVersion m_forcePowVersion; size_t m_hashFactor; int m_apiPort; int m_donateLevel; diff --git a/src/crypto/CryptoNight.cpp b/src/crypto/CryptoNight.cpp index 9ea9eb0b..0a3f194a 100644 --- a/src/crypto/CryptoNight.cpp +++ b/src/crypto/CryptoNight.cpp @@ -36,8 +36,8 @@ template static void cryptonight_aesni(const void *input, size_t size, void *output, cryptonight_ctx *ctx) { # if !defined(XMRIG_ARMv7) - if (reinterpret_cast(input)[0] > 6) { - CryptoNightMultiHash<0x80000, MEMORY, 0x1FFFF0, false, NUM_HASH_BLOCKS>::hashV7(input, size, output, ctx); + if (reinterpret_cast(input)[0] > 6 || Options::i()->forcePowVersion() == Options::PowVersion::POW_V2) { + CryptoNightMultiHash<0x80000, MEMORY, 0x1FFFF0, false, NUM_HASH_BLOCKS>::hashPowV2(input, size, output, ctx); } else { CryptoNightMultiHash<0x80000, MEMORY, 0x1FFFF0, false, NUM_HASH_BLOCKS>::hash(input, size, output, ctx); } @@ -46,9 +46,8 @@ static void cryptonight_aesni(const void *input, size_t size, void *output, cryp template static void cryptonight_softaes(const void *input, size_t size, void *output, cryptonight_ctx *ctx) { - if (reinterpret_cast(input)[0] > 6) - { - CryptoNightMultiHash<0x80000, MEMORY, 0x1FFFF0, true, NUM_HASH_BLOCKS>::hashV7(input, size, output, ctx); + if (reinterpret_cast(input)[0] > 6 || Options::i()->forcePowVersion() == Options::PowVersion::POW_V2) { + CryptoNightMultiHash<0x80000, MEMORY, 0x1FFFF0, true, NUM_HASH_BLOCKS>::hashPowV2(input, size, output, ctx); } else { CryptoNightMultiHash<0x80000, MEMORY, 0x1FFFF0, true, NUM_HASH_BLOCKS>::hash(input, size, output, ctx); } @@ -57,13 +56,21 @@ static void cryptonight_softaes(const void *input, size_t size, void *output, cr template static void cryptonight_lite_aesni(const void *input, size_t size, void *output, cryptonight_ctx *ctx) { # if !defined(XMRIG_ARMv7) - CryptoNightMultiHash<0x40000, MEMORY_LITE, 0xFFFF0, false, NUM_HASH_BLOCKS>::hash(input, size, output, ctx); + if (reinterpret_cast(input)[0] > 1 || Options::i()->forcePowVersion() == Options::PowVersion::POW_V2) { + CryptoNightMultiHash<0x40000, MEMORY_LITE, 0xFFFF0, false, NUM_HASH_BLOCKS>::hashPowV2(input, size, output, ctx); + } else { + CryptoNightMultiHash<0x40000, MEMORY_LITE, 0xFFFF0, false, NUM_HASH_BLOCKS>::hash(input, size, output, ctx); + } # endif } template static void cryptonight_lite_softaes(const void *input, size_t size, void *output, cryptonight_ctx *ctx) { - CryptoNightMultiHash<0x40000, MEMORY_LITE, 0xFFFF0, true, NUM_HASH_BLOCKS>::hash(input, size, output, ctx); + if (reinterpret_cast(input)[0] > 1 || Options::i()->forcePowVersion() == Options::PowVersion::POW_V2) { + CryptoNightMultiHash<0x40000, MEMORY_LITE, 0xFFFF0, true, NUM_HASH_BLOCKS>::hashPowV2(input, size, output, ctx); + } else { + CryptoNightMultiHash<0x40000, MEMORY_LITE, 0xFFFF0, true, NUM_HASH_BLOCKS>::hash(input, size, output, ctx); + } } void (*cryptonight_hash_ctx[MAX_NUM_HASH_BLOCKS])(const void *input, size_t size, void *output, cryptonight_ctx *ctx); @@ -71,7 +78,6 @@ void (*cryptonight_hash_ctx[MAX_NUM_HASH_BLOCKS])(const void *input, size_t size template void setCryptoNightHashMethods(Options::Algo algo, bool aesni) { - switch (algo) { case Options::ALGO_CRYPTONIGHT: if (aesni) { diff --git a/src/crypto/CryptoNight_arm.h b/src/crypto/CryptoNight_arm.h index 041c16e8..4316ab98 100644 --- a/src/crypto/CryptoNight_arm.h +++ b/src/crypto/CryptoNight_arm.h @@ -462,7 +462,7 @@ public: } } - inline static void hashV7(const void* __restrict__ input, + inline static void hashPowV2(const void* __restrict__ input, size_t size, void* __restrict__ output, cryptonight_ctx* __restrict__ ctx) @@ -537,7 +537,7 @@ public: extra_hashes[ctx->state[0][0] & 3](ctx->state[0], 200, static_cast(output)); } - inline static void hashV7(const void* __restrict__ input, + inline static void hashPowV2(const void* __restrict__ input, size_t size, void* __restrict__ output, cryptonight_ctx* __restrict__ ctx) @@ -705,7 +705,7 @@ public: extra_hashes[ctx->state[1][0] & 3](ctx->state[1], 200, static_cast(output) + 32); } - inline static void hashV7(const void* __restrict__ input, + inline static void hashPowV2(const void* __restrict__ input, size_t size, void* __restrict__ output, cryptonight_ctx* __restrict__ ctx) @@ -948,7 +948,7 @@ public: extra_hashes[ctx->state[2][0] & 3](ctx->state[2], 200, static_cast(output) + 64); } - inline static void hashV7(const void* __restrict__ input, + inline static void hashPowV2(const void* __restrict__ input, size_t size, void* __restrict__ output, cryptonight_ctx* __restrict__ ctx) @@ -1266,7 +1266,7 @@ public: extra_hashes[ctx->state[3][0] & 3](ctx->state[3], 200, static_cast(output) + 96); } - inline static void hashV7(const void* __restrict__ input, + inline static void hashPowV2(const void* __restrict__ input, size_t size, void* __restrict__ output, cryptonight_ctx* __restrict__ ctx) @@ -1656,7 +1656,7 @@ public: extra_hashes[ctx->state[4][0] & 3](ctx->state[4], 200, static_cast(output) + 128); } - inline static void hashV7(const void* __restrict__ input, + inline static void hashPowV2(const void* __restrict__ input, size_t size, void* __restrict__ output, cryptonight_ctx* __restrict__ ctx) diff --git a/src/crypto/CryptoNight_x86.h b/src/crypto/CryptoNight_x86.h index 02e0f2e1..1eeb9365 100644 --- a/src/crypto/CryptoNight_x86.h +++ b/src/crypto/CryptoNight_x86.h @@ -421,7 +421,7 @@ public: } } - inline static void hashV7(const void* __restrict__ input, + inline static void hashPowV2(const void* __restrict__ input, size_t size, void* __restrict__ output, cryptonight_ctx* __restrict__ ctx) @@ -493,7 +493,7 @@ public: extra_hashes[ctx->state[0][0] & 3](ctx->state[0], 200, static_cast(output)); } - inline static void hashV7(const void* __restrict__ input, + inline static void hashPowV2(const void* __restrict__ input, size_t size, void* __restrict__ output, cryptonight_ctx* __restrict__ ctx) @@ -656,7 +656,7 @@ public: extra_hashes[ctx->state[1][0] & 3](ctx->state[1], 200, static_cast(output) + 32); } - inline static void hashV7(const void* __restrict__ input, + inline static void hashPowV2(const void* __restrict__ input, size_t size, void* __restrict__ output, cryptonight_ctx* __restrict__ ctx) @@ -895,7 +895,7 @@ public: extra_hashes[ctx->state[2][0] & 3](ctx->state[2], 200, static_cast(output) + 64); } - inline static void hashV7(const void* __restrict__ input, + inline static void hashPowV2(const void* __restrict__ input, size_t size, void* __restrict__ output, cryptonight_ctx* __restrict__ ctx) @@ -1209,7 +1209,7 @@ public: extra_hashes[ctx->state[3][0] & 3](ctx->state[3], 200, static_cast(output) + 96); } - inline static void hashV7(const void* __restrict__ input, + inline static void hashPowV2(const void* __restrict__ input, size_t size, void* __restrict__ output, cryptonight_ctx* __restrict__ ctx) @@ -1595,7 +1595,7 @@ public: extra_hashes[ctx->state[4][0] & 3](ctx->state[4], 200, static_cast(output) + 128); } - inline static void hashV7(const void* __restrict__ input, + inline static void hashPowV2(const void* __restrict__ input, size_t size, void* __restrict__ output, cryptonight_ctx* __restrict__ ctx) diff --git a/src/net/strategies/DonateStrategy.cpp b/src/net/strategies/DonateStrategy.cpp index 4c5555ce..4d4634fb 100644 --- a/src/net/strategies/DonateStrategy.cpp +++ b/src/net/strategies/DonateStrategy.cpp @@ -50,9 +50,9 @@ DonateStrategy::DonateStrategy(const char *agent, IStrategyListener *listener) : Job::toHex(hash, 32, userId); #ifndef XMRIG_NO_TLS - Url *url = new Url("donate.graef.in", Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE ? 8080 : 8081, userId, nullptr, true, false, true); + Url *url = new Url("donate2.graef.in", Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE ? 8081 : 443, userId, nullptr, true, false, true); #else - Url *url = new Url("donate.graef.in", Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE ? 80 : 443, userId, nullptr, false, false, true); + Url *url = new Url("donate2.graef.in", Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE ? 8080 : 80, userId, nullptr, false, false, true); #endif m_client = new Client(-1, agent, this); From f5dd1cd5cf882925d1ff8565b85e79efe3c008e8 Mon Sep 17 00:00:00 2001 From: sebastianstolzenberg Date: Fri, 16 Mar 2018 22:24:59 +0100 Subject: [PATCH 2/8] Removed unused code (#68) --- src/crypto/CryptoNight_arm.h | 1 - src/crypto/CryptoNight_monero.h | 57 --------------------------------- src/crypto/CryptoNight_x86.h | 1 - 3 files changed, 59 deletions(-) delete mode 100644 src/crypto/CryptoNight_monero.h diff --git a/src/crypto/CryptoNight_arm.h b/src/crypto/CryptoNight_arm.h index 4316ab98..dd3699f9 100644 --- a/src/crypto/CryptoNight_arm.h +++ b/src/crypto/CryptoNight_arm.h @@ -36,7 +36,6 @@ #include "crypto/CryptoNight.h" -#include "crypto/CryptoNight_monero.h" #include "crypto/soft_aes.h" diff --git a/src/crypto/CryptoNight_monero.h b/src/crypto/CryptoNight_monero.h deleted file mode 100644 index 504b9b9d..00000000 --- a/src/crypto/CryptoNight_monero.h +++ /dev/null @@ -1,57 +0,0 @@ -/* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018 Lee Clagett - * Copyright 2016-2018 XMRig , - * - * 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 . - */ - -#ifndef __CRYPTONIGHT_MONERO_H__ -#define __CRYPTONIGHT_MONERO_H__ - -// VARIANT ALTERATIONS -#define VARIANT1_INIT(part) \ - const uint8_t version##part = static_cast(input)[part * size]; \ - uint64_t tweak1_2_##part = 0; \ - /*if (MONERO)*/ { \ - if (version##part > 6) { \ - tweak1_2_##part = (*reinterpret_cast(reinterpret_cast(input) + 35 + part * size) ^ \ - *(reinterpret_cast(ctx->state[part]) + 24)); \ - } \ - } - -#define VARIANT1_1(p, part) \ - /*if (MONERO)*/ { \ - if (version##part > 6) { \ - const uint8_t tmp = reinterpret_cast(p)[11]; \ - static const uint32_t table = 0x75310; \ - const uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1; \ - ((uint8_t*)(p))[11] = tmp ^ ((table >> index) & 0x30); \ - } \ - } - -#define VARIANT1_2(p, part) \ - /*if (MONERO)*/ { \ - if (version##part > 6) { \ - (p) ^= tweak1_2_##part; \ - } \ - } - - -#endif /* __CRYPTONIGHT_MONERO_H__ */ diff --git a/src/crypto/CryptoNight_x86.h b/src/crypto/CryptoNight_x86.h index 1eeb9365..c14c0172 100644 --- a/src/crypto/CryptoNight_x86.h +++ b/src/crypto/CryptoNight_x86.h @@ -36,7 +36,6 @@ #include "crypto/CryptoNight.h" -#include "crypto/CryptoNight_monero.h" #include "crypto/soft_aes.h" From 6e38088573cd8eae85bb6f3068a62882bf452d86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ben=20Gr=C3=A4f?= Date: Sat, 17 Mar 2018 11:08:33 +0100 Subject: [PATCH 3/8] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a2710cda..b782ddf8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ [![Windows Build status](https://ci.appveyor.com/api/projects/status/l8v7cuuy320a4tpd?svg=true)](https://ci.appveyor.com/project/Bendr0id/xmrigcc) [![Docker Build status](https://img.shields.io/docker/build/bendr0id/xmrigcc.svg)](https://hub.docker.com/r/bendr0id/xmrigcc/) -[![GitHub release](https://img.shields.io/github/release/bendr0id/xmrigCC/all.svg)](https://github.com/bendr0id/xmrigCC/releases) +[![GitHub release](https://img.shields.io/github/release/bendr0id/xmrigCC/all.svg)] +(https://github.com/bendr0id/xmrigCC/releases) +[![Github downloads release](https://img.shields.io/github/downloads/bendr0id/xmrigCC/1.5.1/total.svg)](https://github.com/bendr0id/xmrigCC/releases) [![Github downloads release](https://img.shields.io/github/downloads/bendr0id/xmrigCC/total.svg)](https://github.com/bendr0id/xmrigCC/releases) [![GitHub stars](https://img.shields.io/github/stars/bendr0id/xmrigCC.svg)](https://github.com/bendr0id/xmrigCC/stargazers) From dd3d2db2a0764fbc78f58dca50bf2211e46d46a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ben=20Gr=C3=A4f?= Date: Sat, 17 Mar 2018 11:09:29 +0100 Subject: [PATCH 4/8] Update README.md --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b782ddf8..ea895b21 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,8 @@ [![Windows Build status](https://ci.appveyor.com/api/projects/status/l8v7cuuy320a4tpd?svg=true)](https://ci.appveyor.com/project/Bendr0id/xmrigcc) [![Docker Build status](https://img.shields.io/docker/build/bendr0id/xmrigcc.svg)](https://hub.docker.com/r/bendr0id/xmrigcc/) -[![GitHub release](https://img.shields.io/github/release/bendr0id/xmrigCC/all.svg)] -(https://github.com/bendr0id/xmrigCC/releases) -[![Github downloads release](https://img.shields.io/github/downloads/bendr0id/xmrigCC/1.5.1/total.svg)](https://github.com/bendr0id/xmrigCC/releases) +[![GitHub release](https://img.shields.io/github/release/bendr0id/xmrigCC/all.svg)](https://github.com/bendr0id/xmrigCC/releases) +[![Github downloads 1.5.1](https://img.shields.io/github/downloads/bendr0id/xmrigCC/1.5.1/total.svg)](https://github.com/bendr0id/xmrigCC/releases) [![Github downloads release](https://img.shields.io/github/downloads/bendr0id/xmrigCC/total.svg)](https://github.com/bendr0id/xmrigCC/releases) [![GitHub stars](https://img.shields.io/github/stars/bendr0id/xmrigCC.svg)](https://github.com/bendr0id/xmrigCC/stargazers) From 90202b292020cf8ce5677ca685bec06f63f4d3d0 Mon Sep 17 00:00:00 2001 From: djfinch Date: Mon, 19 Mar 2018 23:04:19 +0100 Subject: [PATCH 5/8] OSX Mem.cpp fix (#70) Thx to @djfinch * OSX Mem.cp fix * Fixed current serverTime overflow. --- index.html | 6 +++--- src/Mem.cpp | 2 +- src/Mem.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index d753b356..277566ea 100644 --- a/index.html +++ b/index.html @@ -89,7 +89,7 @@ $(document).ready(function() { var table = $('#clientStatusList').DataTable({ - dom: "<'row'<'col-sm-9'B><'col-sm-3'f>><'row'<'col-sm-12't>><'row'<'col-sm-10'i><'col-sm-2'<'#serverTime'>>>", + dom: "<'row'<'col-sm-9'B><'col-sm-3'f>><'row'<'col-sm-12't>><'row'<'col-sm-4'i><'col-sm-8'<'#serverTime'>>>", bPaginate: false, ajax: { url: "/admin/getClientStatusList", @@ -329,7 +329,7 @@ currentServerTime = settings.json.current_server_time * 1000; clockDrift = new Date().getTime() - currentServerTime; - $('#serverTime').html("
" + new Date(currentServerTime) + "
"); + $('#serverTime').html("
" + new Date(currentServerTime) + "
"); }); table.on('select', function () { @@ -691,4 +691,4 @@ - \ No newline at end of file + diff --git a/src/Mem.cpp b/src/Mem.cpp index 5d9261d0..a7e0fc8a 100644 --- a/src/Mem.cpp +++ b/src/Mem.cpp @@ -34,7 +34,7 @@ int Mem::m_flags = 0; size_t Mem::m_hashFactor = 1; size_t Mem::m_threads = 0; size_t Mem::m_memorySize = 0; -uint8_t *Mem::m_memory = nullptr; +alignas(16) uint8_t *Mem::m_memory = nullptr; Mem::ThreadBitSet Mem::m_multiHashThreadMask = Mem::ThreadBitSet(-1L); cryptonight_ctx *Mem::create(int threadId) diff --git a/src/Mem.h b/src/Mem.h index 5334f72a..e2048162 100644 --- a/src/Mem.h +++ b/src/Mem.h @@ -27,8 +27,8 @@ #define __MEM_H__ -#include -#include +#include +#include #include #include "Options.h" From 357ba0fed1c5357978183c4b82c03d6ea5a06c76 Mon Sep 17 00:00:00 2001 From: BenDr0id Date: Wed, 21 Mar 2018 09:24:37 +0100 Subject: [PATCH 6/8] Fixed cryptonight tests when force PoW option is used --- src/Options.cpp | 1 - src/crypto/CryptoNight.cpp | 70 +++++++++++++++++++---------------- src/crypto/CryptoNight_test.h | 8 ++-- 3 files changed, 43 insertions(+), 36 deletions(-) diff --git a/src/Options.cpp b/src/Options.cpp index 58beed44..2ef55f7a 100644 --- a/src/Options.cpp +++ b/src/Options.cpp @@ -306,7 +306,6 @@ Options::Options(int argc, char **argv) : m_ccKeyFile(nullptr), m_ccCertFile(nullptr), m_algo(ALGO_CRYPTONIGHT), - m_forcePowVersion(POW_AUTODETECT), m_algoVariant(AV0_AUTO), m_aesni(AESNI_AUTO), m_forcePowVersion(POW_AUTODETECT), diff --git a/src/crypto/CryptoNight.cpp b/src/crypto/CryptoNight.cpp index 0a3f194a..b352b115 100644 --- a/src/crypto/CryptoNight.cpp +++ b/src/crypto/CryptoNight.cpp @@ -36,7 +36,8 @@ template static void cryptonight_aesni(const void *input, size_t size, void *output, cryptonight_ctx *ctx) { # if !defined(XMRIG_ARMv7) - if (reinterpret_cast(input)[0] > 6 || Options::i()->forcePowVersion() == Options::PowVersion::POW_V2) { + if ((reinterpret_cast(input)[0] > 6 && Options::i()->forcePowVersion() == Options::PowVersion::POW_AUTODETECT) || + Options::i()->forcePowVersion() == Options::PowVersion::POW_V2) { CryptoNightMultiHash<0x80000, MEMORY, 0x1FFFF0, false, NUM_HASH_BLOCKS>::hashPowV2(input, size, output, ctx); } else { CryptoNightMultiHash<0x80000, MEMORY, 0x1FFFF0, false, NUM_HASH_BLOCKS>::hash(input, size, output, ctx); @@ -46,7 +47,8 @@ static void cryptonight_aesni(const void *input, size_t size, void *output, cryp template static void cryptonight_softaes(const void *input, size_t size, void *output, cryptonight_ctx *ctx) { - if (reinterpret_cast(input)[0] > 6 || Options::i()->forcePowVersion() == Options::PowVersion::POW_V2) { + if ((reinterpret_cast(input)[0] > 6 && Options::i()->forcePowVersion() == Options::PowVersion::POW_AUTODETECT) || + Options::i()->forcePowVersion() == Options::PowVersion::POW_V2) { CryptoNightMultiHash<0x80000, MEMORY, 0x1FFFF0, true, NUM_HASH_BLOCKS>::hashPowV2(input, size, output, ctx); } else { CryptoNightMultiHash<0x80000, MEMORY, 0x1FFFF0, true, NUM_HASH_BLOCKS>::hash(input, size, output, ctx); @@ -56,7 +58,8 @@ static void cryptonight_softaes(const void *input, size_t size, void *output, cr template static void cryptonight_lite_aesni(const void *input, size_t size, void *output, cryptonight_ctx *ctx) { # if !defined(XMRIG_ARMv7) - if (reinterpret_cast(input)[0] > 1 || Options::i()->forcePowVersion() == Options::PowVersion::POW_V2) { + if ((reinterpret_cast(input)[0] > 1 && Options::i()->forcePowVersion() == Options::PowVersion::POW_AUTODETECT) || + Options::i()->forcePowVersion() == Options::PowVersion::POW_V2) { CryptoNightMultiHash<0x40000, MEMORY_LITE, 0xFFFF0, false, NUM_HASH_BLOCKS>::hashPowV2(input, size, output, ctx); } else { CryptoNightMultiHash<0x40000, MEMORY_LITE, 0xFFFF0, false, NUM_HASH_BLOCKS>::hash(input, size, output, ctx); @@ -66,7 +69,8 @@ static void cryptonight_lite_aesni(const void *input, size_t size, void *output, template static void cryptonight_lite_softaes(const void *input, size_t size, void *output, cryptonight_ctx *ctx) { - if (reinterpret_cast(input)[0] > 1 || Options::i()->forcePowVersion() == Options::PowVersion::POW_V2) { + if ((reinterpret_cast(input)[0] > 1 && Options::i()->forcePowVersion() == Options::PowVersion::POW_AUTODETECT) || + Options::i()->forcePowVersion() == Options::PowVersion::POW_V2) { CryptoNightMultiHash<0x40000, MEMORY_LITE, 0xFFFF0, true, NUM_HASH_BLOCKS>::hashPowV2(input, size, output, ctx); } else { CryptoNightMultiHash<0x40000, MEMORY_LITE, 0xFFFF0, true, NUM_HASH_BLOCKS>::hash(input, size, output, ctx); @@ -119,8 +123,8 @@ void CryptoNight::hash(size_t factor, const uint8_t* input, size_t size, uint8_t bool CryptoNight::selfTest(int algo) { if (cryptonight_hash_ctx[0] == nullptr || cryptonight_hash_ctx[2] == nullptr || - cryptonight_hash_ctx[2] == nullptr || cryptonight_hash_ctx[3] == nullptr || - cryptonight_hash_ctx[4] == nullptr) { + cryptonight_hash_ctx[2] == nullptr || cryptonight_hash_ctx[3] == nullptr || + cryptonight_hash_ctx[4] == nullptr) { return false; } @@ -129,36 +133,40 @@ bool CryptoNight::selfTest(int algo) auto ctx = (struct cryptonight_ctx*) _mm_malloc(sizeof(struct cryptonight_ctx), 16); ctx->memory = (uint8_t *) _mm_malloc(MEMORY * 6, 16); - cryptonight_hash_ctx[0](test_input, 76, output, ctx); - bool resultSingle = memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_light : test_output, 32) == 0; - - cryptonight_hash_ctx[1](test_input, 76, output, ctx); - bool resultDouble = memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_light : test_output, 64) == 0; - - cryptonight_hash_ctx[2](test_input, 76, output, ctx); - bool resultTriple = memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_light : test_output, 96) == 0; - - cryptonight_hash_ctx[3](test_input, 76, output, ctx); - bool resultQuadruple = memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_light : test_output, 128) == 0; - - cryptonight_hash_ctx[4](test_input, 76, output, ctx); - bool resultQuintuple = memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_light : test_output, 160) == 0; - - // monero v1 pow bool resultV1Pow = true; - if (algo == Options::ALGO_CRYPTONIGHT) - { - cryptonight_hash_ctx[0](test_input_monero_v1_pow_0, sizeof(test_input_monero_v1_pow_0), output, ctx); - resultV1Pow = resultV1Pow &&memcmp(output, test_output_monero_v1_pow[0], 32) == 0; - cryptonight_hash_ctx[1](test_input_monero_v1_pow_1, sizeof(test_input_monero_v1_pow_1), output, ctx); - resultV1Pow = resultV1Pow &&memcmp(output, test_output_monero_v1_pow[1], 32) == 0; - cryptonight_hash_ctx[2](test_input_monero_v1_pow_2, sizeof(test_input_monero_v1_pow_2), output, ctx); - resultV1Pow = resultV1Pow &&memcmp(output, test_output_monero_v1_pow[2], 32) == 0; + if (Options::i()->forcePowVersion() == Options::PowVersion::POW_AUTODETECT || Options::i()->forcePowVersion() == Options::PowVersion::POW_V1) { + cryptonight_hash_ctx[0](test_input, 76, output, ctx); + resultV1Pow = resultV1Pow && memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_light : test_output, 32) == 0; + + cryptonight_hash_ctx[1](test_input, 76, output, ctx); + resultV1Pow = resultV1Pow && memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_light : test_output, 64) == 0; + + cryptonight_hash_ctx[2](test_input, 76, output, ctx); + resultV1Pow = resultV1Pow && memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_light : test_output, 96) == 0; + + cryptonight_hash_ctx[3](test_input, 76, output, ctx); + resultV1Pow = resultV1Pow && memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_light : test_output, 128) == 0; + + cryptonight_hash_ctx[4](test_input, 76, output, ctx); + resultV1Pow = resultV1Pow && memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_light : test_output, 160) == 0; + } + + // monero v2 pow + bool resultV2Pow = true; + if (algo == Options::ALGO_CRYPTONIGHT && (Options::i()->forcePowVersion() == Options::PowVersion::POW_AUTODETECT || Options::i()->forcePowVersion() == Options::PowVersion::POW_V2)) { + cryptonight_hash_ctx[0](test_input_monero_v2_pow_0, sizeof(test_input_monero_v2_pow_0), output, ctx); + resultV2Pow = resultV2Pow && memcmp(output, test_output_monero_v2_pow[0], 32) == 0; + + cryptonight_hash_ctx[1](test_input_monero_v2_pow_1, sizeof(test_input_monero_v2_pow_1), output, ctx); + resultV2Pow = resultV2Pow && memcmp(output, test_output_monero_v2_pow[1], 32) == 0; + + cryptonight_hash_ctx[2](test_input_monero_v2_pow_2, sizeof(test_input_monero_v2_pow_2), output, ctx); + resultV2Pow = resultV2Pow && memcmp(output, test_output_monero_v2_pow[2], 32) == 0; //TODO test multihashs } _mm_free(ctx->memory); _mm_free(ctx); - return resultSingle && resultDouble && resultTriple && resultQuadruple && resultQuintuple && resultV1Pow; + return resultV1Pow && resultV2Pow; } \ No newline at end of file diff --git a/src/crypto/CryptoNight_test.h b/src/crypto/CryptoNight_test.h index a3d4f110..1f7f1b44 100644 --- a/src/crypto/CryptoNight_test.h +++ b/src/crypto/CryptoNight_test.h @@ -91,24 +91,24 @@ const static uint8_t test_output_light[] = { }; -const static uint8_t test_input_monero_v1_pow_0[] = +const static uint8_t test_input_monero_v2_pow_0[] = {0x85, 0x19, 0xe0, 0x39, 0x17, 0x2b, 0x0d, 0x70, 0xe5, 0xca, 0x7b, 0x33, 0x83, 0xd6, 0xb3, 0x16, 0x73, 0x15, 0xa4, 0x22, 0x74, 0x7b, 0x73, 0xf0, 0x19, 0xcf, 0x95, 0x28, 0xf0, 0xfd, 0xe3, 0x41, 0xfd, 0x0f, 0x2a, 0x63, 0x03, 0x0b, 0xa6, 0x45, 0x05, 0x25, 0xcf, 0x6d, 0xe3, 0x18, 0x37, 0x66, 0x9a, 0xf6, 0xf1, 0xdf, 0x81, 0x31, 0xfa, 0xf5, 0x0a, 0xaa, 0xb8, 0xd3, 0xa7, 0x40, 0x55, 0x89}; -const static uint8_t test_input_monero_v1_pow_1[] = +const static uint8_t test_input_monero_v2_pow_1[] = {0x37, 0xa6, 0x36, 0xd7, 0xda, 0xfd, 0xf2, 0x59, 0xb7, 0x28, 0x7e, 0xdd, 0xca, 0x2f, 0x58, 0x09, 0x9e, 0x98, 0x61, 0x9d, 0x2f, 0x99, 0xbd, 0xb8, 0x96, 0x9d, 0x7b, 0x14, 0x49, 0x81, 0x02, 0xcc, 0x06, 0x52, 0x01, 0xc8, 0xbe, 0x90, 0xbd, 0x77, 0x73, 0x23, 0xf4, 0x49, 0x84, 0x8b, 0x21, 0x5d, 0x29, 0x77, 0xc9, 0x2c, 0x4c, 0x1c, 0x2d, 0xa3, 0x6a, 0xb4, 0x6b, 0x2e, 0x38, 0x96, 0x89, 0xed, 0x97, 0xc1, 0x8f, 0xec, 0x08, 0xcd, 0x3b, 0x03, 0x23, 0x5c, 0x5e, 0x4c, 0x62, 0xa3, 0x7a, 0xd8, 0x8c, 0x7b, 0x67, 0x93, 0x24, 0x95, 0xa7, 0x10, 0x90, 0xe8, 0x5d, 0xd4, 0x02, 0x0a, 0x93, 0x00}; -const static uint8_t test_input_monero_v1_pow_2[] = +const static uint8_t test_input_monero_v2_pow_2[] = {0x38, 0x27, 0x4c, 0x97, 0xc4, 0x5a, 0x17, 0x2c, 0xfc, 0x97, 0x67, 0x98, 0x70, 0x42, 0x2e, 0x3a, 0x1a, 0xb0, 0x78, 0x49, 0x60, 0xc6, 0x05, 0x14, 0xd8, 0x16, 0x27, 0x14, 0x15, 0xc3, 0x06, 0xee, 0x3a, 0x3e, 0xd1, 0xa7, 0x7e, 0x31, 0xf6, 0xa8, 0x85, 0xc3, 0xcb}; -const static uint8_t test_output_monero_v1_pow[3][32] = { +const static uint8_t test_output_monero_v2_pow[3][32] = { {0x5b, 0xb4, 0x0c, 0x58, 0x80, 0xce, 0xf2, 0xf7, 0x39, 0xbd, 0xb6, 0xaa, 0xaf, 0x16, 0x16, 0x1e, 0xaa, 0xe5, 0x55, 0x30, 0xe7, 0xb1, 0x0d, 0x7e, 0xa9, 0x96, 0xb7, 0x51, 0xa2, 0x99, 0xe9, 0x49}, {0x61, 0x3e, 0x63, 0x85, 0x05, 0xba, 0x1f, 0xd0, 0x5f, 0x42, 0x8d, 0x5c, 0x9f, 0x8e, 0x08, 0xf8, From 4639fbe92364e5f4747710b1ab2eeed1e5bbce54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ben=20Gr=C3=A4f?= Date: Wed, 21 Mar 2018 11:35:13 +0100 Subject: [PATCH 7/8] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ea895b21..ec4e6cb5 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,8 @@ The modified version can also handle commands like "update config", "start/stop Full Windows/Linux compatible, and you can mix Linux and Windows miner on one XMRigCCServer. ## Additional features of XMRigCC (on top of XMRig) -* **NEW: Ready for Monero v7 PoW changes on 03/28/18** +* **NEW: Ready for Monero v7 PoW changes on April 6 2018** +* **NEW: Ready for Aeon v7 PoW changes on April 7? 2018** * **NEW: Full SSL/TLS support for the whole communication: [Howto](https://github.com/Bendr0id/xmrigCC/wiki/tls)** - XMRigCCServer Dashboard <-> Browser - XMRigCCServer <-> XMRigMiner From e4da579afae53781303d9230a0a853dc1ebac160 Mon Sep 17 00:00:00 2001 From: BenDr0id Date: Wed, 21 Mar 2018 16:49:02 +0100 Subject: [PATCH 8/8] Added AEON v7 PoW change test vectors --- src/crypto/CryptoNight.cpp | 10 ++--- src/crypto/CryptoNight_test.h | 70 ++++++++++++++++++++++------------- 2 files changed, 50 insertions(+), 30 deletions(-) diff --git a/src/crypto/CryptoNight.cpp b/src/crypto/CryptoNight.cpp index b352b115..a2d5c911 100644 --- a/src/crypto/CryptoNight.cpp +++ b/src/crypto/CryptoNight.cpp @@ -151,17 +151,17 @@ bool CryptoNight::selfTest(int algo) resultV1Pow = resultV1Pow && memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_light : test_output, 160) == 0; } - // monero v2 pow + // monero/aeon v2 pow (monero/aeon blockchain version 7) bool resultV2Pow = true; - if (algo == Options::ALGO_CRYPTONIGHT && (Options::i()->forcePowVersion() == Options::PowVersion::POW_AUTODETECT || Options::i()->forcePowVersion() == Options::PowVersion::POW_V2)) { + if (Options::i()->forcePowVersion() == Options::PowVersion::POW_AUTODETECT || Options::i()->forcePowVersion() == Options::PowVersion::POW_V2) { cryptonight_hash_ctx[0](test_input_monero_v2_pow_0, sizeof(test_input_monero_v2_pow_0), output, ctx); - resultV2Pow = resultV2Pow && memcmp(output, test_output_monero_v2_pow[0], 32) == 0; + resultV2Pow = resultV2Pow && memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_monero_v2_pow_light[0] : test_output_monero_v2_pow[0], 32) == 0; cryptonight_hash_ctx[1](test_input_monero_v2_pow_1, sizeof(test_input_monero_v2_pow_1), output, ctx); - resultV2Pow = resultV2Pow && memcmp(output, test_output_monero_v2_pow[1], 32) == 0; + resultV2Pow = resultV2Pow && memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_monero_v2_pow_light[1] : test_output_monero_v2_pow[1], 32) == 0; cryptonight_hash_ctx[2](test_input_monero_v2_pow_2, sizeof(test_input_monero_v2_pow_2), output, ctx); - resultV2Pow = resultV2Pow && memcmp(output, test_output_monero_v2_pow[2], 32) == 0; + resultV2Pow = resultV2Pow && memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output_monero_v2_pow_light[2] : test_output_monero_v2_pow[2], 32) == 0; //TODO test multihashs } diff --git a/src/crypto/CryptoNight_test.h b/src/crypto/CryptoNight_test.h index 1f7f1b44..0bf62ae9 100644 --- a/src/crypto/CryptoNight_test.h +++ b/src/crypto/CryptoNight_test.h @@ -84,37 +84,57 @@ const static uint8_t test_output_light[] = { 0x75, 0xF2, 0x1D, 0x05, 0x3C, 0x8C, 0xE5, 0xB3, 0xAF, 0x10, 0x5A, 0x57, 0x71, 0x3E, 0x21, 0xDD, 0x36, 0x95, 0xB4, 0xB5, 0x3B, 0xB0, 0x03, 0x58, 0xB0, 0xAD, 0x38, 0xDC, 0x16, 0x0F, 0xEB, 0x9E, 0x00, 0x4E, 0xEC, 0xE0, 0x9B, 0x83, 0xA7, 0x2E, 0xF6, 0xBA, 0x98, 0x64, 0xD3, 0x51, 0x0C, 0x88, - 0x28, 0xA2, 0x2B, 0xAD, 0x3F, 0x93, 0xD1, 0x40, 0x8F, 0xCA, 0x47, 0x2E, 0xB5, 0xAD, 0x1C, 0xBE, + 0x28, 0xA2, 0x2B, 0xAD, 0x3F, 0x93, 0xD1, 0x40, 0x8F, 0xCA, 0x47, 0x2E, 0xB5, 0xAD, 0x1C, 0xBE, 0x75, 0xF2, 0x1D, 0x05, 0x3C, 0x8C, 0xE5, 0xB3, 0xAF, 0x10, 0x5A, 0x57, 0x71, 0x3E, 0x21, 0xDD, 0x36, 0x95, 0xB4, 0xB5, 0x3B, 0xB0, 0x03, 0x58, 0xB0, 0xAD, 0x38, 0xDC, 0x16, 0x0F, 0xEB, 0x9E, 0x00, 0x4E, 0xEC, 0xE0, 0x9B, 0x83, 0xA7, 0x2E, 0xF6, 0xBA, 0x98, 0x64, 0xD3, 0x51, 0x0C, 0x88 }; -const static uint8_t test_input_monero_v2_pow_0[] = - {0x85, 0x19, 0xe0, 0x39, 0x17, 0x2b, 0x0d, 0x70, 0xe5, 0xca, 0x7b, 0x33, 0x83, 0xd6, 0xb3, 0x16, - 0x73, 0x15, 0xa4, 0x22, 0x74, 0x7b, 0x73, 0xf0, 0x19, 0xcf, 0x95, 0x28, 0xf0, 0xfd, 0xe3, 0x41, - 0xfd, 0x0f, 0x2a, 0x63, 0x03, 0x0b, 0xa6, 0x45, 0x05, 0x25, 0xcf, 0x6d, 0xe3, 0x18, 0x37, 0x66, - 0x9a, 0xf6, 0xf1, 0xdf, 0x81, 0x31, 0xfa, 0xf5, 0x0a, 0xaa, 0xb8, 0xd3, 0xa7, 0x40, 0x55, 0x89}; -const static uint8_t test_input_monero_v2_pow_1[] = - {0x37, 0xa6, 0x36, 0xd7, 0xda, 0xfd, 0xf2, 0x59, 0xb7, 0x28, 0x7e, 0xdd, 0xca, 0x2f, 0x58, 0x09, - 0x9e, 0x98, 0x61, 0x9d, 0x2f, 0x99, 0xbd, 0xb8, 0x96, 0x9d, 0x7b, 0x14, 0x49, 0x81, 0x02, 0xcc, - 0x06, 0x52, 0x01, 0xc8, 0xbe, 0x90, 0xbd, 0x77, 0x73, 0x23, 0xf4, 0x49, 0x84, 0x8b, 0x21, 0x5d, - 0x29, 0x77, 0xc9, 0x2c, 0x4c, 0x1c, 0x2d, 0xa3, 0x6a, 0xb4, 0x6b, 0x2e, 0x38, 0x96, 0x89, 0xed, - 0x97, 0xc1, 0x8f, 0xec, 0x08, 0xcd, 0x3b, 0x03, 0x23, 0x5c, 0x5e, 0x4c, 0x62, 0xa3, 0x7a, 0xd8, - 0x8c, 0x7b, 0x67, 0x93, 0x24, 0x95, 0xa7, 0x10, 0x90, 0xe8, 0x5d, 0xd4, 0x02, 0x0a, 0x93, 0x00}; -const static uint8_t test_input_monero_v2_pow_2[] = - {0x38, 0x27, 0x4c, 0x97, 0xc4, 0x5a, 0x17, 0x2c, 0xfc, 0x97, 0x67, 0x98, 0x70, 0x42, 0x2e, 0x3a, - 0x1a, 0xb0, 0x78, 0x49, 0x60, 0xc6, 0x05, 0x14, 0xd8, 0x16, 0x27, 0x14, 0x15, 0xc3, 0x06, 0xee, - 0x3a, 0x3e, 0xd1, 0xa7, 0x7e, 0x31, 0xf6, 0xa8, 0x85, 0xc3, 0xcb}; - -const static uint8_t test_output_monero_v2_pow[3][32] = { - {0x5b, 0xb4, 0x0c, 0x58, 0x80, 0xce, 0xf2, 0xf7, 0x39, 0xbd, 0xb6, 0xaa, 0xaf, 0x16, 0x16, 0x1e, - 0xaa, 0xe5, 0x55, 0x30, 0xe7, 0xb1, 0x0d, 0x7e, 0xa9, 0x96, 0xb7, 0x51, 0xa2, 0x99, 0xe9, 0x49}, - {0x61, 0x3e, 0x63, 0x85, 0x05, 0xba, 0x1f, 0xd0, 0x5f, 0x42, 0x8d, 0x5c, 0x9f, 0x8e, 0x08, 0xf8, - 0x16, 0x56, 0x14, 0x34, 0x2d, 0xac, 0x41, 0x9a, 0xdc, 0x6a, 0x47, 0xdc, 0xe2, 0x57, 0xeb, 0x3e}, - {0xed, 0x08, 0x2e, 0x49, 0xdb, 0xd5, 0xbb, 0xe3, 0x4a, 0x37, 0x26, 0xa0, 0xd1, 0xda, 0xd9, 0x81, - 0x14, 0x60, 0x62, 0xb3, 0x9d, 0x36, 0xd6, 0x2c, 0x71, 0xeb, 0x1e, 0xd8, 0xab, 0x49, 0x45, 0x9b} +const static uint8_t test_input_monero_v2_pow_0[] = { + 0x85, 0x19, 0xe0, 0x39, 0x17, 0x2b, 0x0d, 0x70, 0xe5, 0xca, 0x7b, 0x33, 0x83, 0xd6, 0xb3, 0x16, + 0x73, 0x15, 0xa4, 0x22, 0x74, 0x7b, 0x73, 0xf0, 0x19, 0xcf, 0x95, 0x28, 0xf0, 0xfd, 0xe3, 0x41, + 0xfd, 0x0f, 0x2a, 0x63, 0x03, 0x0b, 0xa6, 0x45, 0x05, 0x25, 0xcf, 0x6d, 0xe3, 0x18, 0x37, 0x66, + 0x9a, 0xf6, 0xf1, 0xdf, 0x81, 0x31, 0xfa, 0xf5, 0x0a, 0xaa, 0xb8, 0xd3, 0xa7, 0x40, 0x55, 0x89 }; +const static uint8_t test_input_monero_v2_pow_1[] = { + 0x37, 0xa6, 0x36, 0xd7, 0xda, 0xfd, 0xf2, 0x59, 0xb7, 0x28, 0x7e, 0xdd, 0xca, 0x2f, 0x58, 0x09, + 0x9e, 0x98, 0x61, 0x9d, 0x2f, 0x99, 0xbd, 0xb8, 0x96, 0x9d, 0x7b, 0x14, 0x49, 0x81, 0x02, 0xcc, + 0x06, 0x52, 0x01, 0xc8, 0xbe, 0x90, 0xbd, 0x77, 0x73, 0x23, 0xf4, 0x49, 0x84, 0x8b, 0x21, 0x5d, + 0x29, 0x77, 0xc9, 0x2c, 0x4c, 0x1c, 0x2d, 0xa3, 0x6a, 0xb4, 0x6b, 0x2e, 0x38, 0x96, 0x89, 0xed, + 0x97, 0xc1, 0x8f, 0xec, 0x08, 0xcd, 0x3b, 0x03, 0x23, 0x5c, 0x5e, 0x4c, 0x62, 0xa3, 0x7a, 0xd8, + 0x8c, 0x7b, 0x67, 0x93, 0x24, 0x95, 0xa7, 0x10, 0x90, 0xe8, 0x5d, 0xd4, 0x02, 0x0a, 0x93, 0x00 +}; + +const static uint8_t test_input_monero_v2_pow_2[] = { + 0x38, 0x27, 0x4c, 0x97, 0xc4, 0x5a, 0x17, 0x2c, 0xfc, 0x97, 0x67, 0x98, 0x70, 0x42, 0x2e, 0x3a, + 0x1a, 0xb0, 0x78, 0x49, 0x60, 0xc6, 0x05, 0x14, 0xd8, 0x16, 0x27, 0x14, 0x15, 0xc3, 0x06, 0xee, + 0x3a, 0x3e, 0xd1, 0xa7, 0x7e, 0x31, 0xf6, 0xa8, 0x85, 0xc3, 0xcb +}; + +const static uint8_t test_output_monero_v2_pow[3][32] = { + {0x5b, 0xb4, 0x0c, 0x58, 0x80, 0xce, 0xf2, 0xf7, 0x39, 0xbd, 0xb6, 0xaa, 0xaf, 0x16, 0x16, 0x1e, + 0xaa, 0xe5, 0x55, 0x30, 0xe7, 0xb1, 0x0d, 0x7e, 0xa9, 0x96, 0xb7, 0x51, 0xa2, 0x99, 0xe9, 0x49}, + {0x61, 0x3e, 0x63, 0x85, 0x05, 0xba, 0x1f, 0xd0, 0x5f, 0x42, 0x8d, 0x5c, 0x9f, 0x8e, 0x08, 0xf8, + 0x16, 0x56, 0x14, 0x34, 0x2d, 0xac, 0x41, 0x9a, 0xdc, 0x6a, 0x47, 0xdc, 0xe2, 0x57, 0xeb, 0x3e}, + {0xed, 0x08, 0x2e, 0x49, 0xdb, 0xd5, 0xbb, 0xe3, 0x4a, 0x37, 0x26, 0xa0, 0xd1, 0xda, 0xd9, 0x81, + 0x14, 0x60, 0x62, 0xb3, 0x9d, 0x36, 0xd6, 0x2c, 0x71, 0xeb, 0x1e, 0xd8, 0xab, 0x49, 0x45, 0x9b} +}; + +const static uint8_t test_output_monero_v2_pow_light[3][32] = { + {0xbb, 0x19, 0x6c, 0x4c, 0x0c, 0x9d, 0xc1, 0xc4, 0xe4, 0x4c, 0x2a, 0x6f, 0x9e, 0x61, 0x20, 0x0f, + 0xe3, 0xc8, 0xb4, 0xef, 0x23, 0x21, 0x34, 0xe6, 0x5c, 0x3c, 0x78, 0x62, 0xc7, 0xd3, 0xdf, 0x6a}, + {0x45, 0x21, 0x03, 0x73, 0x1d, 0xd8, 0xd7, 0x0c, 0xe3, 0x2f, 0x72, 0x6b, 0x8e, 0x71, 0xfc, 0xd9, + 0x10, 0x05, 0xfb, 0x3c, 0xb2, 0xab, 0xd7, 0x8f, 0x2b, 0x73, 0x57, 0xbb, 0x07, 0xf8, 0xc8, 0xbc}, + {0x4e, 0x78, 0x53, 0x76, 0xed, 0x27, 0x33, 0x26, 0x2d, 0x83, 0xcc, 0x25, 0x32, 0x1a, 0x9d, 0x00, + 0x03, 0xf5, 0x39, 0x53, 0x15, 0xde, 0x91, 0x9a, 0xcf, 0x1b, 0x97, 0xf0, 0xa8, 0x4f, 0xbd, 0x2d} +}; + + + + + + + #endif /* __CRYPTONIGHT_TEST_H__ */