From c3721b77c98d65c255d3abd686a9286b829fce91 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Thu, 15 Jun 2017 06:18:28 +0200 Subject: [PATCH] tribus algo, nothing complicated... Signed-off-by: Tanguy Pruvot --- rc.local | 1 + stratum/algos/makefile | 2 +- stratum/algos/tribus.c | 34 ++++++++++++++++++++++++++++++ stratum/algos/tribus.h | 16 ++++++++++++++ stratum/config.sample/tribus.conf | 16 ++++++++++++++ stratum/stratum.cpp | 2 ++ stratum/stratum.h | 1 + web/yaamp/core/functions/yaamp.php | 3 +++ 8 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 stratum/algos/tribus.c create mode 100644 stratum/algos/tribus.h create mode 100644 stratum/config.sample/tribus.conf diff --git a/rc.local b/rc.local index cecc85c..7ea3e67 100644 --- a/rc.local +++ b/rc.local @@ -32,6 +32,7 @@ screen -dmS xevan $STRATUM_DIR/run.sh xevan screen -dmS timetravel $STRATUM_DIR/run.sh timetravel screen -dmS bitcore $STRATUM_DIR/run.sh bitcore screen -dmS hmq1725 $STRATUM_DIR/run.sh hmq1725 +screen -dmS tribus $STRATUM_DIR/run.sh tribus screen -dmS sha $STRATUM_DIR/run.sh sha screen -dmS sha256t $STRATUM_DIR/run.sh sha256t diff --git a/stratum/algos/makefile b/stratum/algos/makefile index ffde27f..e430ebc 100644 --- a/stratum/algos/makefile +++ b/stratum/algos/makefile @@ -9,7 +9,7 @@ CFLAGS= $(CXXFLAGS) -std=gnu99 LDFLAGS=-O2 -lgmp SOURCES=lyra2re.c lyra2v2.c Lyra2.c lyra2z.c Lyra2z.c Sponge.c \ - blake.c scrypt.c c11.c x11.c x13.c sha256.c sha256t.c jha.c keccak.c deep.c \ + blake.c scrypt.c c11.c x11.c x13.c sha256.c sha256t.c jha.c keccak.c deep.c tribus.c \ x14.c x15.c x17.c nist5.c fresh.c quark.c neoscrypt.c scryptn.c qubit.c skein.c groestl.c \ bitcore.c timetravel.c xevan.c bastion.c hmq17.c \ skein2.c zr5.c bmw.c luffa.c pentablake.c whirlpool.c whirlpoolx.c blakecoin.c \ diff --git a/stratum/algos/tribus.c b/stratum/algos/tribus.c new file mode 100644 index 0000000..fbe2e63 --- /dev/null +++ b/stratum/algos/tribus.c @@ -0,0 +1,34 @@ +#include +#include +#include +#include + +#include +#include +#include + +#include "common.h" + +void tribus_hash(const char* input, char* output, uint32_t len) +{ + uint8_t _ALIGN(64) hash[64]; + + sph_jh512_context ctx_jh; + sph_keccak512_context ctx_keccak; + sph_echo512_context ctx_echo; + + sph_jh512_init(&ctx_jh); + sph_jh512(&ctx_jh, input, 80); + sph_jh512_close(&ctx_jh, (void*) hash); + + sph_keccak512_init(&ctx_keccak); + sph_keccak512(&ctx_keccak, (const void*) hash, 64); + sph_keccak512_close(&ctx_keccak, (void*) hash); + + sph_echo512_init(&ctx_echo); + sph_echo512(&ctx_echo, (const void*) hash, 64); + sph_echo512_close(&ctx_echo, (void*) hash); + + memcpy(output, hash, 32); +} + diff --git a/stratum/algos/tribus.h b/stratum/algos/tribus.h new file mode 100644 index 0000000..b1fd9ae --- /dev/null +++ b/stratum/algos/tribus.h @@ -0,0 +1,16 @@ +#ifndef TRIBUS_H +#define TRIBUS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +void tribus_hash(const char* input, char* output, uint32_t len); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/stratum/config.sample/tribus.conf b/stratum/config.sample/tribus.conf new file mode 100644 index 0000000..e5c3bc3 --- /dev/null +++ b/stratum/config.sample/tribus.conf @@ -0,0 +1,16 @@ +[TCP] +server = yaamp.com +port = 8533 +password = tu8tu5 + +[SQL] +host = yaampdb +database = yaamp +username = root +password = patofpaq + +[STRATUM] +algo = tribus +difficulty = 0.25 +max_ttf = 4000000 + diff --git a/stratum/stratum.cpp b/stratum/stratum.cpp index 5a9f393..5167a67 100644 --- a/stratum/stratum.cpp +++ b/stratum/stratum.cpp @@ -132,6 +132,7 @@ YAAMP_ALGO g_algos[] = {"dmd-gr", groestl_hash, 0x100, 0, 0}, /* diamond (double groestl) */ {"myr-gr", groestlmyriad_hash, 1, 0, 0}, /* groestl + sha 64 */ {"skein", skein_hash, 1, 0, 0}, + {"tribus", tribus_hash, 1, 0, 0}, {"keccak", keccak256_hash, 0x80, 0, sha256_hash_hex }, {"bmw", bmw_hash, 1, 0, 0}, @@ -382,6 +383,7 @@ void *stratum_thread(void *p) if(sock <= 0) { stratumlog("%s accept error %d %d\n", g_current_algo->name, res, errno); + usleep(10000); continue; } diff --git a/stratum/stratum.h b/stratum/stratum.h index e3c00c3..72d6d99 100644 --- a/stratum/stratum.h +++ b/stratum/stratum.h @@ -171,6 +171,7 @@ void sha256_double_hash_hex(const char *input, char *output, unsigned int len); #include "algos/hive.h" #include "algos/sib.h" #include "algos/m7m.h" +#include "algos/tribus.h" #include "algos/veltor.h" #include "algos/velvet.h" #include "algos/argon2a.h" diff --git a/web/yaamp/core/functions/yaamp.php b/web/yaamp/core/functions/yaamp.php index 9608b18..698a9ff 100755 --- a/web/yaamp/core/functions/yaamp.php +++ b/web/yaamp/core/functions/yaamp.php @@ -45,6 +45,7 @@ function yaamp_get_algos() 'skein', 'skein2', 'timetravel', + 'tribus', 'vanilla', 'veltor', 'velvet', @@ -152,6 +153,7 @@ function getAlgoColors($algo) 'skein2' => '#c8a060', 'timetravel' => '#f0b0d0', 'bitcore' => '#f790c0', + 'tribus' => '#c0d0d0', 'vanilla' => '#f0f0f0', 'velvet' => '#aac0cc', 'whirlpool' => '#d0e0e0', @@ -220,6 +222,7 @@ function getAlgoPort($algo) 'velvet' => 6133, 'yescrypt' => 6233, 'bastion' => 6433, + 'tribus' => 8533, ); global $configCustomPorts;