From 8c97bba761fb809d03a14e151e971d24310dfab4 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Tue, 6 Oct 2015 17:36:52 +0200 Subject: [PATCH] groestl: fix the algos mismatches, make 2 --- rc.local | 4 +-- stratum/algos/whirlpoolx.c | 29 ++++--------------- .../{groestl.conf => dmd-gr.conf} | 6 ++-- stratum/config.sample/myr-gr.conf | 16 ++++++++++ stratum/stratum.cpp | 6 ++-- web/yaamp/core/functions/yaamp.php | 12 ++++++-- 6 files changed, 40 insertions(+), 33 deletions(-) rename stratum/config.sample/{groestl.conf => dmd-gr.conf} (73%) create mode 100644 stratum/config.sample/myr-gr.conf diff --git a/rc.local b/rc.local index d728b89..64d56b9 100644 --- a/rc.local +++ b/rc.local @@ -32,7 +32,8 @@ screen -dmS nist5 $STRATUM_DIR/run.sh nist5 screen -dmS penta $STRATUM_DIR/run.sh penta screen -dmS quark $STRATUM_DIR/run.sh quark screen -dmS qubit $STRATUM_DIR/run.sh qubit -#screen -dmS groestl $STRATUM_DIR/run.sh groestl # dmd-gr -m 256 +#screen -dmS dmd-gr $STRATUM_DIR/run.sh dmd-gr +screen -dmS myr-gr $STRATUM_DIR/run.sh myr-gr screen -dmS lyra2 $STRATUM_DIR/run.sh lyra2 screen -dmS lyra2v2 $STRATUM_DIR/run.sh lyra2v2 @@ -40,6 +41,5 @@ screen -dmS skein $STRATUM_DIR/run.sh skein screen -dmS skein2 $STRATUM_DIR/run.sh skein2 screen -dmS zr5 $STRATUM_DIR/run.sh zr5 screen -dmS sib $STRATUM_DIR/run.sh sib -#screen -dmS hive $STRATUM_DIR/run.sh hive screen -dmS m7m $STRATUM_DIR/run.sh m7m diff --git a/stratum/algos/whirlpoolx.c b/stratum/algos/whirlpoolx.c index 5a2a933..d6c0144 100644 --- a/stratum/algos/whirlpoolx.c +++ b/stratum/algos/whirlpoolx.c @@ -3,39 +3,22 @@ #include #include -#include "../sha3/sph_blake.h" -#include "../sha3/sph_bmw.h" -#include "../sha3/sph_groestl.h" -#include "../sha3/sph_jh.h" -#include "../sha3/sph_keccak.h" -#include "../sha3/sph_skein.h" -#include "../sha3/sph_luffa.h" -#include "../sha3/sph_cubehash.h" -#include "../sha3/sph_shavite.h" -#include "../sha3/sph_simd.h" -#include "../sha3/sph_echo.h" -#include "../sha3/sph_hamsi.h" -#include "../sha3/sph_fugue.h" -#include "../sha3/sph_shabal.h" #include "../sha3/sph_whirlpool.h" void whirlpoolx_hash(const char* input, char* output, uint32_t len) { - unsigned char hash[64]; - memset(hash, 0, sizeof(hash)); + unsigned char hash[64] = { 0 }; + unsigned char hash_xored[32] = { 0 }; + int i; sph_whirlpool_context ctx_whirlpool; sph_whirlpool_init(&ctx_whirlpool); - sph_whirlpool(&ctx_whirlpool, input, len); + sph_whirlpool(&ctx_whirlpool, input, len); /* 80 */ sph_whirlpool_close(&ctx_whirlpool, hash); - unsigned char hash_xored[sizeof(hash) / 2]; - - uint32_t i; - for (i = 0; i < (sizeof(hash) / 2); i++) - { - hash_xored[i] = hash[i] ^ hash[i + ((sizeof(hash) / 2) / 2)]; + for (i = 0; i < 32; i++) { + hash_xored[i] = hash[i] ^ hash[i + 16]; } memcpy(output, hash_xored, 32); diff --git a/stratum/config.sample/groestl.conf b/stratum/config.sample/dmd-gr.conf similarity index 73% rename from stratum/config.sample/groestl.conf rename to stratum/config.sample/dmd-gr.conf index d9a4d51..3a1c02f 100644 --- a/stratum/config.sample/groestl.conf +++ b/stratum/config.sample/dmd-gr.conf @@ -1,6 +1,6 @@ [TCP] server = yaamp.com -port = 5033 +port = 5333 password = tu8tu5 [SQL] @@ -10,7 +10,7 @@ username = root password = patofpaq [STRATUM] -algo = groestl +algo = dmd-gr difficulty = 0.1 -max_ttf = 200000000000000 +max_ttf = 20000000000 diff --git a/stratum/config.sample/myr-gr.conf b/stratum/config.sample/myr-gr.conf new file mode 100644 index 0000000..ad50d62 --- /dev/null +++ b/stratum/config.sample/myr-gr.conf @@ -0,0 +1,16 @@ +[TCP] +server = yaamp.com +port = 5433 +password = tu8tu5 + +[SQL] +host = yaampdb +database = yaamp +username = root +password = patofpaq + +[STRATUM] +algo = myr-gr +difficulty = 0.1 +max_ttf = 20000000000 + diff --git a/stratum/stratum.cpp b/stratum/stratum.cpp index 70de20e..15bf7f7 100644 --- a/stratum/stratum.cpp +++ b/stratum/stratum.cpp @@ -101,7 +101,9 @@ YAAMP_ALGO g_algos[] = {"quark", quark_hash, 1, 0, 0}, {"nist5", nist5_hash, 1, 0, 0}, {"qubit", qubit_hash, 1, 0, 0}, - {"groestl", groestl_hash, 1, 0, 0}, + {"groestl", groestl_hash, 1, 0, 0}, /* diamond (double groestl) */ + {"dmd-gr", groestl_hash, 0x100, 0, 0}, /* diamond (double groestl) */ + {"myr-gr", groestlmyriad_hash, 0x100, 0, 0}, /* groestl + sha 64 */ {"skein", skein_hash, 1, 0, 0}, {"keccak", keccak_hash, 1, 0, 0}, @@ -114,7 +116,7 @@ YAAMP_ALGO g_algos[] = {"hive", hive_hash, 0x10000, 0, 0}, {"sib", sib_hash, 1, 0, 0}, -// {"whirlpoolx", whirlpoolx_hash, 1, 0, 0}, + {"whirlpoolx", whirlpoolx_hash, 1, 0, 0}, // {"jha", jha_hash, 1, 0, 0}, {"m7m", m7m_hash, 0x10000, 0, 0}, diff --git a/web/yaamp/core/functions/yaamp.php b/web/yaamp/core/functions/yaamp.php index 6a26d0b..6d2de68 100755 --- a/web/yaamp/core/functions/yaamp.php +++ b/web/yaamp/core/functions/yaamp.php @@ -19,7 +19,9 @@ function yaamp_get_algos() 'x11', 'x13', 'x15', - 'groestl', // dmd-gr -m 256 + 'groestl', // dmd-gr -m 256 (deprecated) + 'dmd-gr', + 'myr-gr', 'm7m', 'sib', 'skein', @@ -74,7 +76,9 @@ function getAlgoColors($algo) 'x13' => '#d0f0c0', 'x14' => '#a0f0c0', 'x15' => '#f0b0a0', - 'hive' => '#d0a0a0', + 'groestl' => '#d0a0a0', + 'dmd-gr' => '#a0c0f0', + 'myr-gr' => '#a0c0f0', 'luffa' => '#a0c0c0', 'm7m' => '#d0a0a0', 'penta' => '#80c0c0', @@ -122,7 +126,9 @@ function getAlgoPort($algo) 'sib' => 5033, 'keccak' => 5133, 'skein2' => 5233, - 'groestl' => 5333, + //'groestl' => 5333, + 'dmd-gr' => 5333, + 'myr-gr' => 5433, 'zr5' => 5533, // 5555 to 5683 reserved 'blake' => 5733,