mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 17:37:25 +00:00
handle bastion algo
This commit is contained in:
parent
eae758e308
commit
acdb0bd6fd
8 changed files with 141 additions and 2 deletions
102
stratum/algos/bastion.c
Normal file
102
stratum/algos/bastion.c
Normal file
|
@ -0,0 +1,102 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <sha3/sph_hefty1.h>
|
||||
#include <sha3/sph_echo.h>
|
||||
#include <sha3/sph_fugue.h>
|
||||
#include <sha3/sph_whirlpool.h>
|
||||
#include <sha3/sph_skein.h>
|
||||
#include <sha3/sph_echo.h>
|
||||
#include <sha3/sph_luffa.h>
|
||||
#include <sha3/sph_hamsi.h>
|
||||
#include <sha3/sph_shabal.h>
|
||||
|
||||
#define _ALIGN(x) __attribute__ ((aligned(x)))
|
||||
|
||||
void bastion_hash(const char* input, char* output, uint32_t len)
|
||||
{
|
||||
unsigned char _ALIGN(128) hash[64] = { 0 };
|
||||
|
||||
sph_echo512_context ctx_echo;
|
||||
sph_luffa512_context ctx_luffa;
|
||||
sph_fugue512_context ctx_fugue;
|
||||
sph_whirlpool_context ctx_whirlpool;
|
||||
sph_shabal512_context ctx_shabal;
|
||||
sph_skein512_context ctx_skein;
|
||||
sph_hamsi512_context ctx_hamsi;
|
||||
|
||||
HEFTY1(input, len, hash);
|
||||
|
||||
sph_luffa512_init(&ctx_luffa);
|
||||
sph_luffa512(&ctx_luffa, hash, 64);
|
||||
sph_luffa512_close(&ctx_luffa, hash);
|
||||
|
||||
if (hash[0] & 0x8)
|
||||
{
|
||||
sph_fugue512_init(&ctx_fugue);
|
||||
sph_fugue512(&ctx_fugue, hash, 64);
|
||||
sph_fugue512_close(&ctx_fugue, hash);
|
||||
} else {
|
||||
sph_skein512_init(&ctx_skein);
|
||||
sph_skein512(&ctx_skein, hash, 64);
|
||||
sph_skein512_close(&ctx_skein, hash);
|
||||
}
|
||||
|
||||
sph_whirlpool_init(&ctx_whirlpool);
|
||||
sph_whirlpool(&ctx_whirlpool, hash, 64);
|
||||
sph_whirlpool_close(&ctx_whirlpool, hash);
|
||||
|
||||
sph_fugue512_init(&ctx_fugue);
|
||||
sph_fugue512(&ctx_fugue, hash, 64);
|
||||
sph_fugue512_close(&ctx_fugue, hash);
|
||||
|
||||
if (hash[0] & 0x8)
|
||||
{
|
||||
sph_echo512_init(&ctx_echo);
|
||||
sph_echo512(&ctx_echo, hash, 64);
|
||||
sph_echo512_close(&ctx_echo, hash);
|
||||
} else {
|
||||
sph_luffa512_init(&ctx_luffa);
|
||||
sph_luffa512(&ctx_luffa, hash, 64);
|
||||
sph_luffa512_close(&ctx_luffa, hash);
|
||||
}
|
||||
|
||||
sph_shabal512_init(&ctx_shabal);
|
||||
sph_shabal512(&ctx_shabal, hash, 64);
|
||||
sph_shabal512_close(&ctx_shabal, hash);
|
||||
|
||||
sph_skein512_init(&ctx_skein);
|
||||
sph_skein512(&ctx_skein, hash, 64);
|
||||
sph_skein512_close(&ctx_skein, hash);
|
||||
|
||||
if (hash[0] & 0x8)
|
||||
{
|
||||
sph_shabal512_init(&ctx_shabal);
|
||||
sph_shabal512(&ctx_shabal, hash, 64);
|
||||
sph_shabal512_close(&ctx_shabal, hash);
|
||||
} else {
|
||||
sph_whirlpool_init(&ctx_whirlpool);
|
||||
sph_whirlpool(&ctx_whirlpool, hash, 64);
|
||||
sph_whirlpool_close(&ctx_whirlpool, hash);
|
||||
}
|
||||
|
||||
sph_shabal512_init(&ctx_shabal);
|
||||
sph_shabal512(&ctx_shabal, hash, 64);
|
||||
sph_shabal512_close(&ctx_shabal, hash);
|
||||
|
||||
if (hash[0] & 0x8)
|
||||
{
|
||||
sph_hamsi512_init(&ctx_hamsi);
|
||||
sph_hamsi512(&ctx_hamsi, hash, 64);
|
||||
sph_hamsi512_close(&ctx_hamsi, hash);
|
||||
} else {
|
||||
sph_luffa512_init(&ctx_luffa);
|
||||
sph_luffa512(&ctx_luffa, hash, 64);
|
||||
sph_luffa512_close(&ctx_luffa, hash);
|
||||
}
|
||||
|
||||
memcpy(output, hash, 32);
|
||||
}
|
||||
|
16
stratum/algos/bastion.h
Normal file
16
stratum/algos/bastion.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
#ifndef BASTION_H
|
||||
#define BASTION_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void bastion_hash(const char* input, char* output, uint32_t len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -11,7 +11,7 @@ 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 keccak.c deep.c \
|
||||
x14.c x15.c x17.c nist5.c fresh.c quark.c neoscrypt.c scryptn.c qubit.c skein.c groestl.c \
|
||||
timetravel.c xevan.c hmq17.c \
|
||||
timetravel.c xevan.c bastion.c hmq17.c \
|
||||
skein2.c zr5.c bmw.c luffa.c pentablake.c whirlpool.c whirlpoolx.c blakecoin.c \
|
||||
blake2.c \
|
||||
yescrypt.c yescrypt-opt.c sha256_Y.c lbry.c \
|
||||
|
|
16
stratum/config.sample/bastion.conf
Normal file
16
stratum/config.sample/bastion.conf
Normal file
|
@ -0,0 +1,16 @@
|
|||
[TCP]
|
||||
server = yaamp.com
|
||||
port = 6433
|
||||
password = tu8tu5
|
||||
|
||||
[SQL]
|
||||
host = yaampdb
|
||||
database = yaamp
|
||||
username = root
|
||||
password = patofpaq
|
||||
|
||||
[STRATUM]
|
||||
algo = bastion
|
||||
difficulty = 0.02
|
||||
max_ttf = 4000000
|
||||
|
|
@ -6,7 +6,7 @@ LDFLAGS=-O2
|
|||
|
||||
SOURCES=sph_jh.c sph_blake.c sph_bmw.c sph_groestl.c sph_skein.c sph_keccak.c sph_luffa.c sph_cubehash.c sph_shavite.c \
|
||||
sph_simd.c sph_echo.c sph_fugue.c sph_hamsi.c sph_shabal.c sph_whirlpool.c \
|
||||
sph_haval.c sph_ripemd.c sph_sha2.c sph_sha2big.c sph_tiger.c \
|
||||
sph_haval.c sph_hefty1.c sph_ripemd.c sph_sha2.c sph_sha2big.c sph_tiger.c \
|
||||
blake2s.c
|
||||
|
||||
OBJECTS=$(SOURCES:.c=.o)
|
||||
|
|
|
@ -110,6 +110,7 @@ YAAMP_ALGO g_algos[] =
|
|||
{"lyra2v2", lyra2v2_hash, 0x100, 0, 0},
|
||||
{"lyra2z", lyra2z_hash, 0x100, 0, 0},
|
||||
|
||||
{"bastion", bastion_hash, 1, 0 },
|
||||
{"blake", blake_hash, 1, 0 },
|
||||
{"blakecoin", blakecoin_hash, 1 /*0x100*/, 0, sha256_hash_hex },
|
||||
{"blake2s", blake2s_hash, 1, 0 },
|
||||
|
|
|
@ -154,6 +154,7 @@ void sha256_double_hash_hex(const char *input, char *output, unsigned int len);
|
|||
#include "algos/sha256t.h"
|
||||
#include "algos/timetravel.h"
|
||||
|
||||
#include "algos/bastion.h"
|
||||
#include "algos/bmw.h"
|
||||
#include "algos/deep.h"
|
||||
#include "algos/lbry.h"
|
||||
|
|
|
@ -9,6 +9,7 @@ function yaamp_get_algos()
|
|||
'scrypt',
|
||||
'scryptn',
|
||||
'argon2',
|
||||
'bastion',
|
||||
'blake',
|
||||
'blakecoin',
|
||||
'blake2s',
|
||||
|
@ -125,6 +126,7 @@ function getAlgoColors($algo)
|
|||
'x17' => '#f0b0a0',
|
||||
'xevan' => '#f0b0a0',
|
||||
'argon2' => '#e0d0e0',
|
||||
'bastion' => '#e0b0b0',
|
||||
'blake' => '#f0f0f0',
|
||||
'blakecoin' => '#f0f0f0',
|
||||
'groestl' => '#d0a0a0',
|
||||
|
@ -212,6 +214,7 @@ function getAlgoPort($algo)
|
|||
'veltor' => 5034,
|
||||
'velvet' => 6133,
|
||||
'yescrypt' => 6233,
|
||||
'bastion' => 6433,
|
||||
);
|
||||
|
||||
global $configCustomPorts;
|
||||
|
|
Loading…
Add table
Reference in a new issue