diff --git a/rc.local b/rc.local index 6b35051..59024db 100644 --- a/rc.local +++ b/rc.local @@ -21,6 +21,7 @@ screen -dmS debug tail -f $LOG_DIR/debug.log screen -dmS c11 $STRATUM_DIR/run.sh c11 screen -dmS x11 $STRATUM_DIR/run.sh x11 +screen -dmS x11evo $STRATUM_DIR/run.sh x11evo screen -dmS x13 $STRATUM_DIR/run.sh x13 screen -dmS x14 $STRATUM_DIR/run.sh x14 screen -dmS x15 $STRATUM_DIR/run.sh x15 diff --git a/stratum/algos/makefile b/stratum/algos/makefile index 3ef3ebc..cc934c2 100644 --- a/stratum/algos/makefile +++ b/stratum/algos/makefile @@ -16,7 +16,7 @@ SOURCES=lyra2re.c lyra2v2.c Lyra2.c Sponge.c blake.c scrypt.c c11.c x11.c x13.c m7m.c magimath.cpp velvet.c \ argon2a.c ar2/blake2b.c ar2/argon2.c ar2/ref.c ar2/cores.c ar2/ar2-scrypt-jane.c \ hive.c pomelo.c \ - sib.c gost.c + sib.c gost.c x11evo.c OBJECTS=$(SOURCES:%.c=%.o) $(SOURCES:%.cpp=%.o) OUTPUT=libalgos.a diff --git a/stratum/algos/x11evo.c b/stratum/algos/x11evo.c new file mode 100644 index 0000000..cafb579 --- /dev/null +++ b/stratum/algos/x11evo.c @@ -0,0 +1,204 @@ +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +enum Algo { + BLAKE = 0, + BMW, + GROESTL, + SKEIN, + JH, + KECCAK, + LUFFA, + CUBEHASH, + SHAVITE, + SIMD, + ECHO, + HASH_FUNC_COUNT +}; + +static void swap8(uint8_t *a, uint8_t *b) +{ + uint8_t t = *a; + *a = *b; + *b = t; +} + +static void initPerm(uint8_t n[], int count) +{ + for (int i = 0; i < count; i++) + n[i] = i; +} + +static int nextPerm(uint8_t n[], int count) +{ + int tail, i, j; + + if (count <= 1) + return 0; + + for (i = count - 1; i>0 && n[i - 1] >= n[i]; i--); + tail = i; + + if (tail > 0) { + for (j = count - 1; j>tail && n[j] <= n[tail - 1]; j--); + swap8(&n[tail - 1], &n[j]); + } + + for (i = tail, j = count - 1; i= 10) + sprintf(sptr, "%c", 'A' + (algoList[j] - 10)); + else + sprintf(sptr, "%u", (uint32_t) algoList[j]); + sptr++; + } + *sptr = '\0'; +} + +static char hashOrder[HASH_FUNC_COUNT + 1] = { 0 }; +static int s_sequence = -1; + +#define INITIAL_DATE 0x57254700 +static inline int getCurrentAlgoSeq(uint32_t current_time) +{ + // change once per day + return (int) (current_time - INITIAL_DATE) / (60 * 60 * 24); +} + +static void evo_twisted_code(uint32_t ntime, char *permstr) +{ + int seq = getCurrentAlgoSeq(ntime); + if (s_sequence != seq) { + getAlgoString(permstr, seq); + s_sequence = seq; + } +} + +void x11evo_hash(const char* input, char* output, uint32_t len) +{ + uint32_t hash[64/4]; + + sph_blake512_context ctx_blake; + sph_bmw512_context ctx_bmw; + sph_groestl512_context ctx_groestl; + sph_skein512_context ctx_skein; + sph_jh512_context ctx_jh; + sph_keccak512_context ctx_keccak; + sph_luffa512_context ctx_luffa1; + sph_cubehash512_context ctx_cubehash1; + sph_shavite512_context ctx_shavite1; + sph_simd512_context ctx_simd1; + sph_echo512_context ctx_echo1; + + uint32_t ntime; + memcpy(&ntime, &input[17*4], 4); + evo_twisted_code(ntime, hashOrder); + + void *in = (void*) input; + int size = len; + + const int hashes = (int) strlen(hashOrder); + + for (int i = 0; i < hashes; i++) + { + const char elem = hashOrder[i]; + uint8_t algo = elem >= 'A' ? elem - 'A' + 10 : elem - '0'; + + if (i > 0) { + in = (void*) hash; + size = 64; + } + + switch (algo) { + case BLAKE: + sph_blake512_init(&ctx_blake); + sph_blake512 (&ctx_blake, in, size); + sph_blake512_close (&ctx_blake, hash); + break; + case BMW: + sph_bmw512_init(&ctx_bmw); + sph_bmw512 (&ctx_bmw, in, size); + sph_bmw512_close(&ctx_bmw, hash); + break; + case GROESTL: + sph_groestl512_init(&ctx_groestl); + sph_groestl512 (&ctx_groestl, in, size); + sph_groestl512_close(&ctx_groestl, hash); + break; + case SKEIN: + sph_skein512_init(&ctx_skein); + sph_skein512 (&ctx_skein, in, size); + sph_skein512_close (&ctx_skein, hash); + break; + case JH: + sph_jh512_init(&ctx_jh); + sph_jh512 (&ctx_jh, in, size); + sph_jh512_close(&ctx_jh, hash); + break; + case KECCAK: + sph_keccak512_init(&ctx_keccak); + sph_keccak512 (&ctx_keccak, in, size); + sph_keccak512_close(&ctx_keccak, hash); + break; + case LUFFA: + sph_luffa512_init (&ctx_luffa1); + sph_luffa512 (&ctx_luffa1, in, size); + sph_luffa512_close (&ctx_luffa1, hash); + break; + case CUBEHASH: + sph_cubehash512_init (&ctx_cubehash1); + sph_cubehash512 (&ctx_cubehash1, in, size); + sph_cubehash512_close(&ctx_cubehash1, hash); + break; + case SHAVITE: + sph_shavite512_init (&ctx_shavite1); + sph_shavite512 (&ctx_shavite1, in, size); + sph_shavite512_close(&ctx_shavite1, hash); + break; + case SIMD: + sph_simd512_init (&ctx_simd1); + sph_simd512 (&ctx_simd1, in, size); + sph_simd512_close(&ctx_simd1, hash); + break; + case ECHO: + sph_echo512_init (&ctx_echo1); + sph_echo512 (&ctx_echo1, in, size); + sph_echo512_close(&ctx_echo1, hash); + break; + } + } + + memcpy(output, hash, 32); +} + diff --git a/stratum/algos/x11evo.h b/stratum/algos/x11evo.h new file mode 100644 index 0000000..4838af4 --- /dev/null +++ b/stratum/algos/x11evo.h @@ -0,0 +1,16 @@ +#ifndef X11EVO_H +#define X11EVO_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +void x11evo_hash(const char* input, char* output, uint32_t len); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/stratum/config.sample/x11evo.conf b/stratum/config.sample/x11evo.conf new file mode 100644 index 0000000..ef057a7 --- /dev/null +++ b/stratum/config.sample/x11evo.conf @@ -0,0 +1,16 @@ +[TCP] +server = yaamp.com +port = 3553 +password = tu8tu5 + +[SQL] +host = yaampdb +database = yaamp +username = root +password = patofpaq + +[STRATUM] +algo = x11evo +difficulty = 0.008 +max_ttf = 40000 + diff --git a/stratum/stratum.cpp b/stratum/stratum.cpp index 96ce0b4..d61dfd9 100644 --- a/stratum/stratum.cpp +++ b/stratum/stratum.cpp @@ -94,6 +94,8 @@ YAAMP_ALGO g_algos[] = {"x15", x15_hash, 1, 0, 0}, {"x17", x17_hash, 1, 0, 0}, + {"x11evo", x11evo_hash, 1, 0, 0}, + {"lyra2", lyra2re_hash, 0x80, 0, 0}, {"lyra2v2", lyra2v2_hash, 0x100, 0, 0}, diff --git a/stratum/stratum.h b/stratum/stratum.h index 2d1c6fb..5efab17 100644 --- a/stratum/stratum.h +++ b/stratum/stratum.h @@ -124,6 +124,7 @@ void sha256_double_hash_hex(const char *input, char *output, unsigned int len); #include "algos/c11.h" #include "algos/x11.h" +#include "algos/x11evo.h" #include "algos/x13.h" #include "algos/x14.h" #include "algos/x15.h" diff --git a/web/yaamp/core/functions/yaamp.php b/web/yaamp/core/functions/yaamp.php index 1b886a7..fe4b8e0 100755 --- a/web/yaamp/core/functions/yaamp.php +++ b/web/yaamp/core/functions/yaamp.php @@ -23,6 +23,7 @@ function yaamp_get_algos() 'qubit', 'c11', 'x11', + 'x11evo', 'x13', 'x14', 'x15', @@ -106,8 +107,9 @@ function getAlgoColors($algo) 'c11' => '#a0a0d0', 'decred' => '#f0f0f0', 'x11' => '#f0f0a0', + 'x11evo' => '#c0f0c0', 'x13' => '#ffd880', - 'x14' => '#a0f0c0', + 'x14' => '#f0c080', 'x15' => '#f0b080', 'x17' => '#f0b0a0', 'argon2' => '#e0d0e0', @@ -151,6 +153,7 @@ function getAlgoPort($algo) 'scrypt' => 3433, 'c11' => 3573, 'x11' => 3533, + 'x11evo' => 3553, 'x13' => 3633, 'x15' => 3733, 'x17' => 3737,