Add LBK3 algo to yiimp (#319)

+ finitions
This commit is contained in:
Brandon 2018-10-03 12:37:46 -05:00 committed by Tanguy Pruvot
parent 64203358dd
commit 6889836ac7
7 changed files with 74 additions and 3 deletions

36
stratum/algos/lbk3.c Normal file
View file

@ -0,0 +1,36 @@
#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_keccak.h>
#define _ALIGN(x) __attribute__ ((aligned(x)))
extern uint64_t lbk3_height;
void lbk3_hash(const char* input, char* output, uint32_t len)
{
sph_bmw256_context ctx_bmw;
sph_blake256_context ctx_blake;
sph_keccak256_context ctx_keccak;
uint8_t _ALIGN(128) hash[96];
memset(&hash[32], 0, 64);
sph_bmw256_init(&ctx_bmw);
sph_bmw256 (&ctx_bmw, input, 80);
sph_bmw256_close(&ctx_bmw, &hash[0]);
sph_blake256_init(&ctx_blake);
sph_blake256 (&ctx_blake, &hash[0], 64);
sph_blake256_close(&ctx_blake, &hash[32]);
sph_keccak256_init(&ctx_keccak);
sph_keccak256 (&ctx_keccak, &hash[32], 64);
sph_keccak256_close(&ctx_keccak, &hash[64]);
memcpy(output, &hash[64], 32);
}

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

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

View file

@ -19,7 +19,7 @@ SOURCES=lyra2re.c lyra2v2.c Lyra2.c lyra2z.c Lyra2-z.c Sponge.c allium.c \
a5a.c a5amath.c m7m.c magimath.cpp velvet.c \ a5a.c a5amath.c m7m.c magimath.cpp velvet.c \
argon2a.c blake2/blake2b.c ar2/argon2.c ar2/core.c ar2/encoding.c ar2/opt.c ar2/thread.c ar2/ar2-scrypt-jane.c \ argon2a.c blake2/blake2b.c ar2/argon2.c ar2/core.c ar2/encoding.c ar2/opt.c ar2/thread.c ar2/ar2-scrypt-jane.c \
hive.c pomelo.c hex.c argon2d-dyn.c \ hive.c pomelo.c hex.c argon2d-dyn.c \
phi.c phi2.c polytimos.c rainforest.c skunk.c sib.c veltor.c gost.c aergo.c phi.c phi2.c polytimos.c rainforest.c skunk.c sib.c veltor.c gost.c aergo.c lbk3.c
OBJECTS=$(SOURCES:%.c=%.o) $(SOURCES:%.cpp=%.o) OBJECTS=$(SOURCES:%.c=%.o) $(SOURCES:%.cpp=%.o)
OUTPUT=libalgos.a OUTPUT=libalgos.a
@ -41,4 +41,4 @@ $(OUTPUT): $(OBJECTS)
clean: clean:
rm -f *.o rm -f *.o
rm -f ar2/*.o rm -f ar2/*.o
rm -f blake2/*.o rm -f blake2/*.o

View file

@ -0,0 +1,15 @@
[TCP]
server = yaamp.com
port = 5522
password = tu8tu5
[SQL]
host = yaampdb
database = yaamp
username = root
password = patofpaq
[STRATUM]
algo = lbk3
difficulty = 8
max_ttf = 40000

View file

@ -167,6 +167,7 @@ YAAMP_ALGO g_algos[] =
{"skunk", skunk_hash, 1, 0, 0}, {"skunk", skunk_hash, 1, 0, 0},
{"bmw", bmw_hash, 1, 0, 0}, {"bmw", bmw_hash, 1, 0, 0},
{"lbk3", lbk3_hash, 0x100, 0, 0},
{"lbry", lbry_hash, 0x100, 0, 0}, {"lbry", lbry_hash, 0x100, 0, 0},
{"luffa", luffa_hash, 1, 0, 0}, {"luffa", luffa_hash, 1, 0, 0},
{"penta", penta_hash, 1, 0, 0}, {"penta", penta_hash, 1, 0, 0},

View file

@ -1,4 +1,3 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/time.h> #include <sys/time.h>
@ -184,6 +183,7 @@ void sha256_double_hash_hex(const char *input, char *output, unsigned int len);
#include "algos/bastion.h" #include "algos/bastion.h"
#include "algos/bmw.h" #include "algos/bmw.h"
#include "algos/deep.h" #include "algos/deep.h"
#include "algos/lbk3.h"
#include "algos/lbry.h" #include "algos/lbry.h"
#include "algos/luffa.h" #include "algos/luffa.h"
#include "algos/pentablake.h" #include "algos/pentablake.h"

View file

@ -26,6 +26,7 @@ function yaamp_get_algos()
'hex', 'hex',
'hsr', 'hsr',
'lbry', 'lbry',
'lbk3',
'luffa', 'luffa',
'lyra2', 'lyra2',
'lyra2v2', 'lyra2v2',
@ -179,6 +180,7 @@ function getAlgoColors($algo)
'quark' => '#c0c0c0', 'quark' => '#c0c0c0',
'qubit' => '#d0a0f0', 'qubit' => '#d0a0f0',
'rainforest' => '#d0f0a0', 'rainforest' => '#d0f0a0',
'lbk3' => '#809aef',
'lyra2' => '#80a0f0', 'lyra2' => '#80a0f0',
'lyra2v2' => '#80c0f0', 'lyra2v2' => '#80c0f0',
'lyra2z' => '#80b0f0', 'lyra2z' => '#80b0f0',
@ -243,6 +245,7 @@ function getAlgoPort($algo)
'argon2d-dyn' => 4239, 'argon2d-dyn' => 4239,
'scryptn' => 4333, 'scryptn' => 4333,
'allium' => 4443, 'allium' => 4443,
'lbk3' => 5522,
'lyra2' => 4433, 'lyra2' => 4433,
'lyra2v2' => 4533, 'lyra2v2' => 4533,
'lyra2z' => 4553, 'lyra2z' => 4553,