From 1b4d4c788da6f6fb03c248824094390ea021dc63 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sun, 21 Aug 2016 01:15:12 +0200 Subject: [PATCH] veltor algo --- rc.local | 1 + stratum/algos/makefile | 2 +- stratum/algos/veltor.c | 40 ++++++++++++++++++++++++++++++ stratum/algos/veltor.h | 16 ++++++++++++ stratum/config.sample/veltor.conf | 16 ++++++++++++ stratum/stratum.cpp | 1 + stratum/stratum.h | 1 + web/yaamp/core/functions/yaamp.php | 2 ++ 8 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 stratum/algos/veltor.c create mode 100644 stratum/algos/veltor.h create mode 100644 stratum/config.sample/veltor.conf diff --git a/rc.local b/rc.local index d929410..4ba4d44 100644 --- a/rc.local +++ b/rc.local @@ -57,6 +57,7 @@ screen -dmS yescrypt $STRATUM_DIR/run.sh yescrypt screen -dmS zr5 $STRATUM_DIR/run.sh zr5 screen -dmS sib $STRATUM_DIR/run.sh sib screen -dmS m7m $STRATUM_DIR/run.sh m7m +screen -dmS veltor $STRATUM_DIR/run.sh veltor screen -dmS velvet $STRATUM_DIR/run.sh velvet screen -dmS argon2 $STRATUM_DIR/run.sh argon2 diff --git a/stratum/algos/makefile b/stratum/algos/makefile index 467d06f..dfaa281 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 x11evo.c + sib.c veltor.c gost.c x11evo.c OBJECTS=$(SOURCES:%.c=%.o) $(SOURCES:%.cpp=%.o) OUTPUT=libalgos.a diff --git a/stratum/algos/veltor.c b/stratum/algos/veltor.c new file mode 100644 index 0000000..e15490b --- /dev/null +++ b/stratum/algos/veltor.c @@ -0,0 +1,40 @@ +#include +#include +#include +#include + +#include +#include +#include +//#include + +#include "gost.h" + +void veltor_hash(const char *input, char* output, uint32_t len) +{ + uint32_t hash[16]; + + sph_skein512_context ctx_skein; + sph_shavite512_context ctx_shavite; + sph_shabal512_context ctx_shabal; + sph_gost512_context ctx_gost; + + sph_skein512_init(&ctx_skein); + sph_skein512(&ctx_skein, input, 80); + sph_skein512_close(&ctx_skein, (void*) hash); + + sph_shavite512_init(&ctx_shavite); + sph_shavite512(&ctx_shavite, (const void*) hash, 64); + sph_shavite512_close(&ctx_shavite, (void*) hash); + + sph_shabal512_init(&ctx_shabal); + sph_shabal512(&ctx_shabal, (const void*) hash, 64); + sph_shabal512_close(&ctx_shabal, (void*) hash); + + sph_gost512_init(&ctx_gost); + sph_gost512(&ctx_gost, (const void*) hash, 64); + sph_gost512_close(&ctx_gost, (void*) hash); + + memcpy(output, hash, 32); +} + diff --git a/stratum/algos/veltor.h b/stratum/algos/veltor.h new file mode 100644 index 0000000..7684da7 --- /dev/null +++ b/stratum/algos/veltor.h @@ -0,0 +1,16 @@ +#ifndef VELTOR_H +#define VELTOR_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +void veltor_hash(const char* input, char* output, uint32_t len); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/stratum/config.sample/veltor.conf b/stratum/config.sample/veltor.conf new file mode 100644 index 0000000..4560fe4 --- /dev/null +++ b/stratum/config.sample/veltor.conf @@ -0,0 +1,16 @@ +[TCP] +server = yaamp.com +port = 5034 +password = tu8tu5 + +[SQL] +host = yaampdb +database = yaamp +username = root +password = patofpaq + +[STRATUM] +algo = veltor +difficulty = 0.016 +max_ttf = 40000 + diff --git a/stratum/stratum.cpp b/stratum/stratum.cpp index 58863a5..ba5f655 100644 --- a/stratum/stratum.cpp +++ b/stratum/stratum.cpp @@ -127,6 +127,7 @@ YAAMP_ALGO g_algos[] = {"hive", hive_hash, 0x10000, 0, 0}, {"m7m", m7m_hash, 0x10000, 0, 0}, + {"veltor", veltor_hash, 1, 0, 0}, {"velvet", velvet_hash, 0x10000, 0, 0}, {"argon2", argon2_hash, 0x10000, 0, sha256_hash_hex }, diff --git a/stratum/stratum.h b/stratum/stratum.h index 7b8f768..15ee3a4 100644 --- a/stratum/stratum.h +++ b/stratum/stratum.h @@ -157,6 +157,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/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 9eab56a..0d68dc9 100755 --- a/web/yaamp/core/functions/yaamp.php +++ b/web/yaamp/core/functions/yaamp.php @@ -37,6 +37,7 @@ function yaamp_get_algos() 'skein', 'skein2', 'vanilla', + 'veltor', 'velvet', 'yescrypt', 'whirlpool', @@ -189,6 +190,7 @@ function getAlgoPort($algo) 'penta' => 5833, 'luffa' => 5933, 'm7m' => 6033, + 'veltor' => 5034, 'velvet' => 6133, 'yescrypt' => 6233, );