From 11aad8a1872d3946f7a7a526a1cd9c3594346c4c Mon Sep 17 00:00:00 2001
From: gamerope <83300383+gamerope@users.noreply.github.com>
Date: Tue, 4 Jan 2022 22:00:56 +0000
Subject: [PATCH 1/4] Added RandomLozz/RandomL
---
scripts/generate_cl.js | 1 +
src/backend/opencl/cl/cn/algorithm.cl | 1 +
src/backend/opencl/cl/rx/randomx.cl | 2 +
.../opencl/cl/rx/randomx_constants_lozz.h | 96 +++++++++++++++++++
src/base/crypto/Algorithm.cpp | 7 +-
src/base/crypto/Algorithm.h | 2 +
src/base/crypto/Coin.cpp | 1 +
src/base/crypto/Coin.h | 3 +-
src/base/tools/cryptonote/WalletAddress.cpp | 4 +
src/crypto/rx/RxAlgo.cpp | 3 +
10 files changed, 118 insertions(+), 2 deletions(-)
create mode 100644 src/backend/opencl/cl/rx/randomx_constants_lozz.h
diff --git a/scripts/generate_cl.js b/scripts/generate_cl.js
index c3fffbf9..f497a9bc 100644
--- a/scripts/generate_cl.js
+++ b/scripts/generate_cl.js
@@ -52,6 +52,7 @@ function rx()
'randomx_constants_arqma.h',
'randomx_constants_keva.h',
'randomx_constants_graft.h',
+ 'randomx_constants_lozz.h',
'aes.cl',
'blake2b.cl',
'randomx_vm.cl',
diff --git a/src/backend/opencl/cl/cn/algorithm.cl b/src/backend/opencl/cl/cn/algorithm.cl
index 7258479d..7c578e35 100644
--- a/src/backend/opencl/cl/cn/algorithm.cl
+++ b/src/backend/opencl/cl/cn/algorithm.cl
@@ -24,6 +24,7 @@
#define ALGO_RX_SFX 0x72151273
#define ALGO_RX_KEVA 0x7214116b
#define ALGO_RX_GRAFT 0x72151267
+#define ALGO_RX_LOZZ 0x7213f747
#define ALGO_AR2_CHUKWA 0x61130000
#define ALGO_AR2_CHUKWA_V2 0x61140000
#define ALGO_AR2_WRKZ 0x61120000
diff --git a/src/backend/opencl/cl/rx/randomx.cl b/src/backend/opencl/cl/rx/randomx.cl
index a08b8ba2..4693fd59 100644
--- a/src/backend/opencl/cl/rx/randomx.cl
+++ b/src/backend/opencl/cl/rx/randomx.cl
@@ -10,6 +10,8 @@
#include "randomx_constants_keva.h"
#elif (ALGO == ALGO_RX_GRAFT)
#include "randomx_constants_graft.h"
+#elif (ALGO == ALGO_RX_LOZZ)
+#include "randomx_constants_lozz.h"
#endif
#include "aes.cl"
diff --git a/src/backend/opencl/cl/rx/randomx_constants_lozz.h b/src/backend/opencl/cl/rx/randomx_constants_lozz.h
new file mode 100644
index 00000000..0286c4f6
--- /dev/null
+++ b/src/backend/opencl/cl/rx/randomx_constants_lozz.h
@@ -0,0 +1,96 @@
+/*
+Copyright (c) 2019 SChernykh
+
+This file is part of RandomX OpenCL.
+
+RandomX OpenCL 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.
+
+RandomX OpenCL 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 RandomX OpenCL. If not, see .
+*/
+
+//Dataset base size in bytes. Must be a power of 2.
+#define RANDOMX_DATASET_BASE_SIZE 2147483648
+
+//Dataset extra size. Must be divisible by 64.
+#define RANDOMX_DATASET_EXTRA_SIZE 33554368
+
+//Scratchpad L3 size in bytes. Must be a power of 2.
+#define RANDOMX_SCRATCHPAD_L3 2097152
+
+//Scratchpad L2 size in bytes. Must be a power of two and less than or equal to RANDOMX_SCRATCHPAD_L3.
+#define RANDOMX_SCRATCHPAD_L2 262144
+
+//Scratchpad L1 size in bytes. Must be a power of two (minimum 64) and less than or equal to RANDOMX_SCRATCHPAD_L2.
+#define RANDOMX_SCRATCHPAD_L1 16384
+
+//Jump condition mask size in bits.
+#define RANDOMX_JUMP_BITS 8
+
+//Jump condition mask offset in bits. The sum of RANDOMX_JUMP_BITS and RANDOMX_JUMP_OFFSET must not exceed 16.
+#define RANDOMX_JUMP_OFFSET 8
+
+//Integer instructions
+#define RANDOMX_FREQ_IADD_RS 16
+#define RANDOMX_FREQ_IADD_M 7
+#define RANDOMX_FREQ_ISUB_R 16
+#define RANDOMX_FREQ_ISUB_M 7
+#define RANDOMX_FREQ_IMUL_R 16
+#define RANDOMX_FREQ_IMUL_M 4
+#define RANDOMX_FREQ_IMULH_R 4
+#define RANDOMX_FREQ_IMULH_M 1
+#define RANDOMX_FREQ_ISMULH_R 4
+#define RANDOMX_FREQ_ISMULH_M 1
+#define RANDOMX_FREQ_IMUL_RCP 8
+#define RANDOMX_FREQ_INEG_R 2
+#define RANDOMX_FREQ_IXOR_R 15
+#define RANDOMX_FREQ_IXOR_M 5
+#define RANDOMX_FREQ_IROR_R 8
+#define RANDOMX_FREQ_IROL_R 2
+#define RANDOMX_FREQ_ISWAP_R 4
+
+//Floating point instructions
+#define RANDOMX_FREQ_FSWAP_R 4
+#define RANDOMX_FREQ_FADD_R 16
+#define RANDOMX_FREQ_FADD_M 5
+#define RANDOMX_FREQ_FSUB_R 16
+#define RANDOMX_FREQ_FSUB_M 5
+#define RANDOMX_FREQ_FSCAL_R 6
+#define RANDOMX_FREQ_FMUL_R 32
+#define RANDOMX_FREQ_FDIV_M 4
+#define RANDOMX_FREQ_FSQRT_R 6
+
+//Control instructions
+#define RANDOMX_FREQ_CBRANCH 16
+#define RANDOMX_FREQ_CFROUND 1
+
+//Store instruction
+#define RANDOMX_FREQ_ISTORE 25
+
+//No-op instruction
+#define RANDOMX_FREQ_NOP 0
+
+#define RANDOMX_DATASET_ITEM_SIZE 64
+
+#define RANDOMX_PROGRAM_SIZE 256
+
+#define HASH_SIZE 64
+#define ENTROPY_SIZE (128 + RANDOMX_PROGRAM_SIZE * 8)
+#define REGISTERS_SIZE 256
+#define IMM_BUF_SIZE (RANDOMX_PROGRAM_SIZE * 4 - REGISTERS_SIZE)
+#define IMM_INDEX_COUNT ((IMM_BUF_SIZE / 4) - 2)
+#define VM_STATE_SIZE (REGISTERS_SIZE + IMM_BUF_SIZE + RANDOMX_PROGRAM_SIZE * 4)
+#define ROUNDING_MODE (RANDOMX_FREQ_CFROUND ? -1 : 0)
+
+// Scratchpad L1/L2/L3 bits
+#define LOC_L1 (32 - 14)
+#define LOC_L2 (32 - 18)
+#define LOC_L3 (32 - 21)
diff --git a/src/base/crypto/Algorithm.cpp b/src/base/crypto/Algorithm.cpp
index 636a638c..1da8bb49 100644
--- a/src/base/crypto/Algorithm.cpp
+++ b/src/base/crypto/Algorithm.cpp
@@ -82,6 +82,7 @@ const char *Algorithm::kRX_ARQ = "rx/arq";
const char *Algorithm::kRX_GRAFT = "rx/graft";
const char *Algorithm::kRX_SFX = "rx/sfx";
const char *Algorithm::kRX_KEVA = "rx/keva";
+const char *Algorithm::kRX_LOZZ = "rx/lozz";
#endif
#ifdef XMRIG_ALGO_ARGON2
@@ -152,7 +153,9 @@ static const std::map kAlgorithmNames = {
ALGO_NAME(RX_ARQ),
ALGO_NAME(RX_GRAFT),
ALGO_NAME(RX_SFX),
+ ALGO_NAME(RX_LOZZ),
ALGO_NAME(RX_KEVA),
+const char *Algorithm::kRX_KEVA = "rx/keva";
# endif
# ifdef XMRIG_ALGO_ARGON2
@@ -272,6 +275,8 @@ static const std::map kAlgorithmAlias
ALGO_ALIAS(RX_SFX, "randomsfx"),
ALGO_ALIAS_AUTO(RX_KEVA), ALGO_ALIAS(RX_KEVA, "randomx/keva"),
ALGO_ALIAS(RX_KEVA, "randomkeva"),
+ ALGO_ALIAS_AUTO(RX_LOZZ), ALGO_ALIAS(RX_LOZZ, "randomx/lozz"),
+ ALGO_ALIAS(RX_LOZZ, "randomL"),
# endif
# ifdef XMRIG_ALGO_ARGON2
@@ -363,7 +368,7 @@ std::vector xmrig::Algorithm::all(const std::function
Date: Tue, 4 Jan 2022 22:41:06 +0000
Subject: [PATCH 2/4] Added finishing parts of lozzax
---
src/base/crypto/Algorithm.cpp | 2 +-
src/base/crypto/Coin.h | 4 ++--
src/crypto/randomx/randomx.cpp | 8 ++++++++
src/crypto/randomx/randomx.h | 2 ++
4 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/base/crypto/Algorithm.cpp b/src/base/crypto/Algorithm.cpp
index 1da8bb49..2f510f6e 100644
--- a/src/base/crypto/Algorithm.cpp
+++ b/src/base/crypto/Algorithm.cpp
@@ -155,7 +155,7 @@ static const std::map kAlgorithmNames = {
ALGO_NAME(RX_SFX),
ALGO_NAME(RX_LOZZ),
ALGO_NAME(RX_KEVA),
-const char *Algorithm::kRX_KEVA = "rx/keva";
+
# endif
# ifdef XMRIG_ALGO_ARGON2
diff --git a/src/base/crypto/Coin.h b/src/base/crypto/Coin.h
index dd5ee585..727b8bd4 100644
--- a/src/base/crypto/Coin.h
+++ b/src/base/crypto/Coin.h
@@ -40,8 +40,8 @@ public:
KEVA,
RAVEN,
WOWNERO,
- MAX,
- LOZZAX
+ LOZZAX,
+ MAX
};
static const char *kDisabled;
diff --git a/src/crypto/randomx/randomx.cpp b/src/crypto/randomx/randomx.cpp
index ed520aa8..7ffd5513 100644
--- a/src/crypto/randomx/randomx.cpp
+++ b/src/crypto/randomx/randomx.cpp
@@ -100,6 +100,13 @@ RandomX_ConfigurationSafex::RandomX_ConfigurationSafex()
ArgonSalt = "RandomSFX\x01";
}
+RandomX_ConfigurationLozzax::RandomX_ConfigurationLozzax()
+{
+ ArgonSalt = "RandomL\x06";
+ RANDOMX_FREQ_CBRANCH = 16;
+ RANDOMX_FREQ_ISTORE = 25;
+}
+
RandomX_ConfigurationKeva::RandomX_ConfigurationKeva()
{
ArgonSalt = "RandomKV\x01";
@@ -358,6 +365,7 @@ RandomX_ConfigurationArqma RandomX_ArqmaConfig;
RandomX_ConfigurationGraft RandomX_GraftConfig;
RandomX_ConfigurationSafex RandomX_SafexConfig;
RandomX_ConfigurationKeva RandomX_KevaConfig;
+RandomX_ConfigurationLozzax RandomX_LozzaxConfig;
alignas(64) RandomX_ConfigurationBase RandomX_CurrentConfig;
diff --git a/src/crypto/randomx/randomx.h b/src/crypto/randomx/randomx.h
index ae55c726..0398f94b 100644
--- a/src/crypto/randomx/randomx.h
+++ b/src/crypto/randomx/randomx.h
@@ -147,6 +147,7 @@ struct RandomX_ConfigurationArqma : public RandomX_ConfigurationBase { RandomX_C
struct RandomX_ConfigurationGraft : public RandomX_ConfigurationBase { RandomX_ConfigurationGraft(); };
struct RandomX_ConfigurationSafex : public RandomX_ConfigurationBase { RandomX_ConfigurationSafex(); };
struct RandomX_ConfigurationKeva : public RandomX_ConfigurationBase { RandomX_ConfigurationKeva(); };
+struct RandomX_ConfigurationLozzax : public RandomX_ConfigurationBase { RandomX_ConfigurationLozzax(); };
extern RandomX_ConfigurationMonero RandomX_MoneroConfig;
extern RandomX_ConfigurationWownero RandomX_WowneroConfig;
@@ -154,6 +155,7 @@ extern RandomX_ConfigurationArqma RandomX_ArqmaConfig;
extern RandomX_ConfigurationGraft RandomX_GraftConfig;
extern RandomX_ConfigurationSafex RandomX_SafexConfig;
extern RandomX_ConfigurationKeva RandomX_KevaConfig;
+extern RandomX_ConfigurationLozzax RandomX_LozzaxConfig;
extern RandomX_ConfigurationBase RandomX_CurrentConfig;
From 3c7017be8acba15bfdde346232399c9743c6a1f1 Mon Sep 17 00:00:00 2001
From: gamerope <83300383+gamerope@users.noreply.github.com>
Date: Wed, 19 Jan 2022 07:28:48 +0100
Subject: [PATCH 3/4] Removed White space and others
* I removed white space and the position of LOZZ
* Thanks to Spudz who correct the value for lozz which is 0x7215126c
---
src/base/crypto/Algorithm.cpp | 3 +--
src/base/crypto/Algorithm.h | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/base/crypto/Algorithm.cpp b/src/base/crypto/Algorithm.cpp
index 2f510f6e..abf68267 100644
--- a/src/base/crypto/Algorithm.cpp
+++ b/src/base/crypto/Algorithm.cpp
@@ -153,9 +153,8 @@ static const std::map kAlgorithmNames = {
ALGO_NAME(RX_ARQ),
ALGO_NAME(RX_GRAFT),
ALGO_NAME(RX_SFX),
- ALGO_NAME(RX_LOZZ),
ALGO_NAME(RX_KEVA),
-
+ ALGO_NAME(RX_LOZZ),
# endif
# ifdef XMRIG_ALGO_ARGON2
diff --git a/src/base/crypto/Algorithm.h b/src/base/crypto/Algorithm.h
index 3c6c15e6..3d5cecee 100644
--- a/src/base/crypto/Algorithm.h
+++ b/src/base/crypto/Algorithm.h
@@ -78,7 +78,7 @@ public:
RX_GRAFT = 0x72151267, // "rx/graft" RandomGRAFT (Graft).
RX_SFX = 0x72151273, // "rx/sfx" RandomSFX (Safex Cash).
RX_KEVA = 0x7214116b, // "rx/keva" RandomKEVA (Keva).
- RX_LOZZ = 0x7213f747, // "rx/lozz" RandomL (Lozzax).
+ RX_LOZZ = 0x7215126c, // "rx/lozz" RandomL (Lozzax).
AR2_CHUKWA = 0x61130000, // "argon2/chukwa" Argon2id (Chukwa).
AR2_CHUKWA_V2 = 0x61140000, // "argon2/chukwav2" Argon2id (Chukwa v2).
AR2_WRKZ = 0x61120000, // "argon2/wrkz" Argon2id (WRKZ)
From 37c227481a2ba321ab3e8ddbb92f00ec1c74cec9 Mon Sep 17 00:00:00 2001
From: gamerope <83300383+gamerope@users.noreply.github.com>
Date: Wed, 19 Jan 2022 08:22:24 +0100
Subject: [PATCH 4/4] Corrected alignment
---
src/base/crypto/Coin.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/base/crypto/Coin.cpp b/src/base/crypto/Coin.cpp
index 3295508c..bd06d666 100644
--- a/src/base/crypto/Coin.cpp
+++ b/src/base/crypto/Coin.cpp
@@ -54,7 +54,7 @@ static const CoinInfo coinInfo[] = {
{ Algorithm::RX_KEVA, "KVA", "Kevacoin", 0, 0, MAGENTA_BG_BOLD(WHITE_BOLD_S " keva ") },
{ Algorithm::KAWPOW_RVN, "RVN", "Ravencoin", 0, 0, BLUE_BG_BOLD( WHITE_BOLD_S " raven ") },
{ Algorithm::RX_WOW, "WOW", "Wownero", 300, 100000000000, MAGENTA_BG_BOLD(WHITE_BOLD_S " wownero ") },
- { Algorithm::RX_LOZZ, "LOZZ", "Lozzax", 120, 1000000000, MAGENTA_BG_BOLD(WHITE_BOLD_S " lozzax ") },
+ { Algorithm::RX_LOZZ, "LOZZ", "Lozzax", 120, 1000000000, MAGENTA_BG_BOLD(WHITE_BOLD_S " lozzax ") },
};