stratum: add vitalium algo (#261)

note: beware of the masterscams
This commit is contained in:
Jia Wu 2018-05-02 08:27:39 -04:00 committed by Tanguy Pruvot
parent 6fe2208e2e
commit 8fb9a74164
7 changed files with 126 additions and 2 deletions

View file

@ -20,7 +20,7 @@ SOURCES=lyra2re.c lyra2v2.c Lyra2.c lyra2z.c Lyra2z.c Sponge.c \
argon2a.c ar2/blake2b.c ar2/argon2.c ar2/ref.c ar2/cores.c ar2/ar2-scrypt-jane.c \
a5a.c a5amath.c \
hive.c pomelo.c \
phi.c polytimos.c skunk.c sib.c veltor.c gost.c x11evo.c
phi.c polytimos.c skunk.c sib.c veltor.c gost.c x11evo.c vitalium.c
OBJECTS=$(SOURCES:%.c=%.o) $(SOURCES:%.cpp=%.o)
OUTPUT=libalgos.a

87
stratum/algos/vitalium.c Normal file
View file

@ -0,0 +1,87 @@
#include "vitalium.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <sha3/sph_skein.h>
#include <sha3/sph_cubehash.h>
#include <sha3/sph_fugue.h>
#include <sha3/sph_echo.h>
#include <sha3/sph_shavite.h>
#include <sha3/sph_luffa.h>
#include "gost.h"
#include "common.h"
void vitalium_hash(const char* input, char* output, uint32_t len)
{
sph_skein512_context ctx_skein;
sph_cubehash512_context ctx_cubehash;
sph_fugue512_context ctx_fugue;
sph_gost512_context ctx_gost;
sph_echo512_context ctx_echo;
sph_shavite512_context ctx_shavite;
sph_luffa512_context ctx_luffa;
//these uint512 in the c++ source of the client are backed by an array of uint32
uint32_t hashA[16], hashB[16];
sph_skein512_init(&ctx_skein);
sph_skein512 (&ctx_skein, input, len);
sph_skein512_close (&ctx_skein, hashA);
sph_cubehash512_init(&ctx_cubehash);
sph_cubehash512 (&ctx_cubehash, hashA, 64);
sph_cubehash512_close(&ctx_cubehash, hashB);
sph_fugue512_init(&ctx_fugue);
sph_fugue512 (&ctx_fugue, hashB, 64);
sph_fugue512_close(&ctx_fugue, hashA);
sph_gost512_init(&ctx_gost);
sph_gost512 (&ctx_gost, hashA, 64);
sph_gost512_close (&ctx_gost, hashB);
sph_echo512_init(&ctx_echo);
sph_echo512 (&ctx_echo, hashB, 64);
sph_echo512_close(&ctx_echo, hashA);
sph_shavite512_init(&ctx_shavite);
sph_shavite512 (&ctx_shavite, hashA, 64);
sph_shavite512_close(&ctx_shavite, hashB);
sph_luffa512_init (&ctx_luffa);
sph_luffa512 (&ctx_luffa, hashB, 64);
sph_luffa512_close (&ctx_luffa, hashA);
sph_gost512_init(&ctx_gost);
sph_gost512 (&ctx_gost, hashA, 64);
sph_gost512_close (&ctx_gost, hashB);
sph_cubehash512_init(&ctx_cubehash);
sph_cubehash512 (&ctx_cubehash, hashB, 64);
sph_cubehash512_close(&ctx_cubehash, hashA);
sph_fugue512_init(&ctx_fugue);
sph_fugue512 (&ctx_fugue, hashA, 64);
sph_fugue512_close(&ctx_fugue, hashB);
sph_gost512_init(&ctx_gost);
sph_gost512 (&ctx_gost, hashB, 64);
sph_gost512_close (&ctx_gost, hashA);
sph_echo512_init(&ctx_echo);
sph_echo512 (&ctx_echo, hashA, 64);
sph_echo512_close(&ctx_echo, hashB);
sph_shavite512_init(&ctx_shavite);
sph_shavite512 (&ctx_shavite, hashB, 64);
sph_shavite512_close(&ctx_shavite, hashA);
sph_luffa512_init (&ctx_luffa);
sph_luffa512 (&ctx_luffa, hashA, 64);
sph_luffa512_close (&ctx_luffa, hashB);
memcpy(output, hashB, 32);
}

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

@ -0,0 +1,16 @@
#ifndef VITALITY_H
#define VITALITY_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
void vitalium_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 = vitalium
difficulty = 0.001
max_ttf = 400000000

View file

@ -176,6 +176,7 @@ YAAMP_ALGO g_algos[] =
{"veltor", veltor_hash, 1, 0, 0},
{"velvet", velvet_hash, 0x10000, 0, 0},
{"argon2", argon2_hash, 0x10000, 0, sha256_hash_hex },
{"vitalium", vitalium_hash, 1, 0, 0},
{"sha256t", sha256t_hash, 1, 0, 0}, // sha256 3x

View file

@ -200,4 +200,5 @@ void sha256_double_hash_hex(const char *input, char *output, unsigned int len);
#include "algos/veltor.h"
#include "algos/velvet.h"
#include "algos/argon2a.h"
#include "algos/vitalium.h"

View file

@ -58,6 +58,7 @@ function yaamp_get_algos()
'vanilla',
'veltor',
'velvet',
'vitalium',
'yescrypt',
'yescryptR16',
'yescryptR32',
@ -178,9 +179,10 @@ function getAlgoColors($algo)
'bitcore' => '#f790c0',
'skunk' => '#dedefe',
'tribus' => '#c0d0d0',
'a5a' => '#f0f0f0',
'a5a' => '#f0f0f0',
'vanilla' => '#f0f0f0',
'velvet' => '#aac0cc',
'vitalium' => '#f0b0a0',
'whirlpool' => '#d0e0e0',
'yescrypt' => '#e0d0e0',
'yescryptR16' => '#e2d0e2',
@ -251,6 +253,7 @@ function getAlgoPort($algo)
'm7m' => 6033,
'veltor' => 5034,
'velvet' => 6133,
'vitalium' => 3233,
'yescrypt' => 6233,
'yescryptR16' => 6333,
'yescryptR32' => 6343,