x12 algo + GCH multi-algos definition

This commit is contained in:
Tanguy Pruvot 2018-03-26 05:55:06 +02:00
parent 2d0a2df480
commit 2ad138591e
8 changed files with 128 additions and 1 deletions

View file

@ -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 tribus.c \
blake.c scrypt.c c11.c x11.c x12.c x13.c sha256.c sha256t.c jha.c keccak.c deep.c tribus.c \
hsr14.c sm3.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 x16r.c xevan.c bastion.c hmq17.c \

85
stratum/algos/x12.c Normal file
View file

@ -0,0 +1,85 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <sha3/sph_blake.h>
#include <sha3/sph_bmw.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_groestl.h>
#include <sha3/sph_skein.h>
#include <sha3/sph_jh.h>
#include <sha3/sph_keccak.h>
#include <sha3/sph_hamsi.h>
void x12_hash(const char* input, char* output, uint32_t len)
{
sph_blake512_context ctx_blake;
sph_bmw512_context ctx_bmw;
sph_luffa512_context ctx_luffa;
sph_cubehash512_context ctx_cubehash;
sph_shavite512_context ctx_shavite;
sph_simd512_context ctx_simd;
sph_echo512_context ctx_echo;
sph_groestl512_context ctx_groestl;
sph_skein512_context ctx_skein;
sph_jh512_context ctx_jh;
sph_keccak512_context ctx_keccak;
sph_hamsi512_context ctx_hamsi;
uint32_t hash[16];
sph_blake512_init(&ctx_blake);
sph_blake512(&ctx_blake, input, len);
sph_blake512_close(&ctx_blake, hash);
sph_bmw512_init(&ctx_bmw);
sph_bmw512(&ctx_bmw, hash, 64);
sph_bmw512_close(&ctx_bmw, hash);
sph_luffa512_init(&ctx_luffa);
sph_luffa512(&ctx_luffa, hash, 64);
sph_luffa512_close(&ctx_luffa, hash);
sph_cubehash512_init(&ctx_cubehash);
sph_cubehash512(&ctx_cubehash, hash, 64);
sph_cubehash512_close(&ctx_cubehash, hash);
sph_shavite512_init(&ctx_shavite);
sph_shavite512(&ctx_shavite, hash, 64);
sph_shavite512_close(&ctx_shavite, hash);
sph_simd512_init(&ctx_simd);
sph_simd512(&ctx_simd, hash, 64);
sph_simd512_close(&ctx_simd, hash);
sph_echo512_init(&ctx_echo);
sph_echo512(&ctx_echo, hash, 64);
sph_echo512_close(&ctx_echo, hash);
sph_groestl512_init(&ctx_groestl);
sph_groestl512(&ctx_groestl, hash, 64);
sph_groestl512_close(&ctx_groestl, hash);
sph_skein512_init(&ctx_skein);
sph_skein512(&ctx_skein, hash, 64);
sph_skein512_close(&ctx_skein, hash);
sph_jh512_init(&ctx_jh);
sph_jh512(&ctx_jh, hash, 64);
sph_jh512_close(&ctx_jh, hash);
sph_keccak512_init(&ctx_keccak);
sph_keccak512(&ctx_keccak, hash, 64);
sph_keccak512_close(&ctx_keccak, hash);
sph_hamsi512_init(&ctx_hamsi);
sph_hamsi512(&ctx_hamsi, hash, 64);
sph_hamsi512_close(&ctx_hamsi, hash);
memcpy(output, hash, 32);
}

16
stratum/algos/x12.h Normal file
View file

@ -0,0 +1,16 @@
#ifndef X12_H
#define X12_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
void x12_hash(const char* input, char* output, uint32_t len);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,16 @@
[TCP]
server = yaamp.com
port = 3233
password = tu8tu5
[SQL]
host = yaampdb
database = yaamp
username = root
password = patofpaq
[STRATUM]
algo = x12
difficulty = 0.008
max_ttf = 50000

View file

@ -115,6 +115,7 @@ YAAMP_ALGO g_algos[] =
{"c11", c11_hash, 1, 0, 0},
{"x11", x11_hash, 1, 0, 0},
{"x12", x12_hash, 1, 0, 0},
{"x13", x13_hash, 1, 0, 0},
{"x14", x14_hash, 1, 0, 0},
{"x15", x15_hash, 1, 0, 0},

View file

@ -150,6 +150,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/x12.h"
#include "algos/x13.h"
#include "algos/x14.h"
#include "algos/x15.h"

View file

@ -35,6 +35,7 @@ function yaamp_get_algos()
'c11',
'x11',
'x11evo',
'x12',
'x13',
'x14',
'x15',
@ -137,6 +138,7 @@ function getAlgoColors($algo)
'deep' => '#e0ffff',
'x11' => '#f0f0a0',
'x11evo' => '#c0f0c0',
'x12' => '#ffe090',
'x13' => '#ffd880',
'x14' => '#f0c080',
'x15' => '#f0b080',
@ -206,6 +208,7 @@ function getAlgoPort($algo)
'deep' => 3535,
'x11' => 3533,
'x11evo' => 3553,
'x12' => 3233,
'x13' => 3633,
'x15' => 3733,
'x16r' => 3636,

View file

@ -165,6 +165,9 @@ function versionToAlgo($coin, $version)
7 =>'nist5', 8 =>'myr-gr', 9=>'penta', 10=>'whirlpool',
11=>'luffa', 12=>'keccak', 13=>'quark', 15=>'bastion'
);
$algos['GCH'] = array(
0=>'x12', 1=>'x11', 2=>'x13', 3=>'sha256', 4=>'blake2s'
);
$algos['RICHX'] = array(
0=>'sha256', 1=>'scrypt', 2=>'myr-gr', 3=>'skein', 4=>'qubit'
);
@ -182,6 +185,8 @@ function versionToAlgo($coin, $version)
if ($symbol == 'J')
return arraySafeVal($algos[$symbol], $version, '');
else if($symbol == 'GCH')
return arraySafeVal($algos[$symbol], ($version - 9), '');
else if($symbol == 'XVG')
return arraySafeVal($algos[$symbol], ($version >> 11), 'scrypt');
else if (isset($algos[$symbol]))