mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 17:37:25 +00:00
stratum: add support for sib and hive algos
PS: hive is just a test, this (scam/trojan) coin is broken...
This commit is contained in:
parent
9a8c40c71b
commit
f9fc2084e6
15 changed files with 1616 additions and 6 deletions
4
rc.local
4
rc.local
|
@ -39,6 +39,6 @@ screen -dmS lyra2v2 $STRATUM_DIR/run.sh lyra2v2
|
|||
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 drop $STRATUM_DIR/run.sh drop
|
||||
|
||||
screen -dmS sib $STRATUM_DIR/run.sh sib
|
||||
#screen -dmS hive $STRATUM_DIR/run.sh hive
|
||||
|
||||
|
|
1045
stratum/algos/gost.c
Normal file
1045
stratum/algos/gost.c
Normal file
File diff suppressed because it is too large
Load diff
185
stratum/algos/gost.h
Normal file
185
stratum/algos/gost.h
Normal file
|
@ -0,0 +1,185 @@
|
|||
/* $Id: sph_gost.h 216 2010-06-08 09:46:57Z tp $ */
|
||||
/**
|
||||
* GOST interface. This is the interface for GOST R 12 with the
|
||||
* recommended parameters for SHA-3, with output lengths 256
|
||||
* and 512 bits.
|
||||
*
|
||||
* ==========================(LICENSE BEGIN)============================
|
||||
*
|
||||
* Copyright (c) 2007-2010 Projet RNRT SAPHIR
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* ===========================(LICENSE END)=============================
|
||||
*
|
||||
* @file sph_gost.h
|
||||
* @author Mish <mish@btchouse.com>
|
||||
*/
|
||||
|
||||
#ifndef SPH_GOST_H__
|
||||
#define SPH_GOST_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include "../sha3/sph_types.h"
|
||||
|
||||
/**
|
||||
* Output size (in bits) for GOST-256.
|
||||
*/
|
||||
#define SPH_SIZE_gost256 256
|
||||
|
||||
/**
|
||||
* Output size (in bits) for GOST-512.
|
||||
*/
|
||||
#define SPH_SIZE_gost512 512
|
||||
|
||||
/**
|
||||
* This structure is a context for Keccak computations: it contains the
|
||||
* intermediate values and some data from the last entered block. Once a
|
||||
* GOST computation has been performed, the context can be reused for
|
||||
* another computation.
|
||||
*
|
||||
* The contents of this structure are private. A running GOST computation
|
||||
* can be cloned by copying the context (e.g. with a simple
|
||||
* <code>memcpy()</code>).
|
||||
*/
|
||||
|
||||
/**
|
||||
* This structure is a context for Gost-256 computations.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
#ifndef DOXYGEN_IGNORE
|
||||
unsigned char buf[32]; /* first field, for alignment */
|
||||
size_t ptr;
|
||||
sph_u32 V[3][8];
|
||||
#endif
|
||||
} sph_gost256_context;
|
||||
|
||||
/**
|
||||
* This structure is a context for Gost-512 computations.
|
||||
*/
|
||||
typedef struct {
|
||||
#ifndef DOXYGEN_IGNORE
|
||||
unsigned char buf[64]; /* first field, for alignment */
|
||||
size_t ptr;
|
||||
sph_u32 V[5][8];
|
||||
#endif
|
||||
} sph_gost512_context;
|
||||
|
||||
|
||||
/**
|
||||
* Initialize a GOST-256 context. This process performs no memory allocation.
|
||||
*
|
||||
* @param cc the GOST-256 context (pointer to a
|
||||
* <code>sph_gost256_context</code>)
|
||||
*/
|
||||
void sph_gost256_init(void *cc);
|
||||
|
||||
/**
|
||||
* Process some data bytes. It is acceptable that <code>len</code> is zero
|
||||
* (in which case this function does nothing).
|
||||
*
|
||||
* @param cc the Gost-256 context
|
||||
* @param data the input data
|
||||
* @param len the input data length (in bytes)
|
||||
*/
|
||||
void sph_gost256(void *cc, const void *data, size_t len);
|
||||
|
||||
/**
|
||||
* Terminate the current GOST-256 computation and output the result into
|
||||
* the provided buffer. The destination buffer must be wide enough to
|
||||
* accomodate the result (32 bytes). The context is automatically
|
||||
* reinitialized.
|
||||
*
|
||||
* @param cc the GOST-256 context
|
||||
* @param dst the destination buffer
|
||||
*/
|
||||
void sph_gost256_close(void *cc, void *dst);
|
||||
|
||||
/**
|
||||
* Add a few additional bits (0 to 7) to the current computation, then
|
||||
* terminate it and output the result in the provided buffer, which must
|
||||
* be wide enough to accomodate the result (32 bytes). If bit number i
|
||||
* in <code>ub</code> has value 2^i, then the extra bits are those
|
||||
* numbered 7 downto 8-n (this is the big-endian convention at the byte
|
||||
* level). The context is automatically reinitialized.
|
||||
*
|
||||
* @param cc the GOST-256 context
|
||||
* @param ub the extra bits
|
||||
* @param n the number of extra bits (0 to 7)
|
||||
* @param dst the destination buffer
|
||||
*/
|
||||
void sph_gost256_addbits_and_close(
|
||||
void *cc, unsigned ub, unsigned n, void *dst);
|
||||
|
||||
/**
|
||||
* Initialize a Gost-512 context. This process performs no memory allocation.
|
||||
*
|
||||
* @param cc the GOST-512 context (pointer to a
|
||||
* <code>sph_gost512_context</code>)
|
||||
*/
|
||||
void sph_gost512_init(void *cc);
|
||||
|
||||
/**
|
||||
* Process some data bytes. It is acceptable that <code>len</code> is zero
|
||||
* (in which case this function does nothing).
|
||||
*
|
||||
* @param cc the GOST-512 context
|
||||
* @param data the input data
|
||||
* @param len the input data length (in bytes)
|
||||
*/
|
||||
void sph_gost512(void *cc, const void *data, size_t len);
|
||||
|
||||
/**
|
||||
* Terminate the current GOST-512 computation and output the result into
|
||||
* the provided buffer. The destination buffer must be wide enough to
|
||||
* accomodate the result (64 bytes). The context is automatically
|
||||
* reinitialized.
|
||||
*
|
||||
* @param cc the GOST-512 context
|
||||
* @param dst the destination buffer
|
||||
*/
|
||||
void sph_gost512_close(void *cc, void *dst);
|
||||
|
||||
/**
|
||||
* Add a few additional bits (0 to 7) to the current computation, then
|
||||
* terminate it and output the result in the provided buffer, which must
|
||||
* be wide enough to accomodate the result (64 bytes). If bit number i
|
||||
* in <code>ub</code> has value 2^i, then the extra bits are those
|
||||
* numbered 7 downto 8-n (this is the big-endian convention at the byte
|
||||
* level). The context is automatically reinitialized.
|
||||
*
|
||||
* @param cc the GOST-512 context
|
||||
* @param ub the extra bits
|
||||
* @param n the number of extra bits (0 to 7)
|
||||
* @param dst the destination buffer
|
||||
*/
|
||||
void sph_gost512_addbits_and_close(
|
||||
void *cc, unsigned ub, unsigned n, void *dst);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
36
stratum/algos/hive.c
Normal file
36
stratum/algos/hive.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../sha3/sph_types.h"
|
||||
#include "../sha3/sph_keccak.h"
|
||||
#include "../sha3/sph_shabal.h"
|
||||
#include "../sha3/sph_blake.h"
|
||||
|
||||
#include "pomelo.h"
|
||||
|
||||
void hive_hash(const char *input, char *output, uint32_t len)
|
||||
{
|
||||
uint32_t hash[8], hashB[8];
|
||||
sph_shabal256_context ctx_shabal;
|
||||
sph_blake256_context ctx_blake;
|
||||
sph_keccak256_context ctx_keccak;
|
||||
|
||||
|
||||
sph_shabal256_init(&ctx_shabal);
|
||||
sph_shabal256 (&ctx_shabal, input, 80);
|
||||
sph_shabal256_close (&ctx_shabal, hash);
|
||||
|
||||
POMELO(hashB, 32, hash, 32, hash, 32, 2, 10);
|
||||
|
||||
sph_blake256_init(&ctx_blake);
|
||||
sph_blake256 (&ctx_blake, hashB, 32);
|
||||
sph_blake256_close(&ctx_blake, hash);
|
||||
|
||||
sph_keccak256_init(&ctx_keccak);
|
||||
sph_keccak256 (&ctx_keccak, hash, 32);
|
||||
sph_keccak256_close(&ctx_keccak, output);
|
||||
}
|
||||
|
16
stratum/algos/hive.h
Normal file
16
stratum/algos/hive.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
#ifndef HIVE_H
|
||||
#define HIVE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void hive_hash(const char* input, char* output, uint32_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -9,7 +9,9 @@ LDFLAGS=-O2
|
|||
|
||||
SOURCES=lyra2re.c lyra2v2.c Lyra2.c Sponge.c blake.c scrypt.c c11.c x11.c x13.c sha256.c keccak.c \
|
||||
x14.c x15.c nist5.c fresh.c quark.c neoscrypt.c scryptn.c qubit.c skein.c groestl.c \
|
||||
skein2.c zr5.c drop.c bmw.c luffa.c pentablake.c
|
||||
skein2.c zr5.c bmw.c luffa.c pentablake.c \
|
||||
hive.c pomelo.c \
|
||||
sib.c gost.c
|
||||
|
||||
OBJECTS=$(SOURCES:.c=.o)
|
||||
OUTPUT=libalgos.a
|
||||
|
|
167
stratum/algos/pomelo.c
Normal file
167
stratum/algos/pomelo.c
Normal file
|
@ -0,0 +1,167 @@
|
|||
// PHC submission: POMELO v2
|
||||
// Designed by: Hongjun Wu (Email: wuhongjun@gmail.com)
|
||||
// This code was written by Hongjun Wu on Jan 31, 2015.
|
||||
|
||||
// This codes gives the C implementation of POMELO on 64-bit platform (little-endian)
|
||||
|
||||
// m_cost is an integer, 0 <= m_cost <= 25; the memory size is 2**(13+m_cost) bytes
|
||||
// t_cost is an integer, 0 <= t_cost <= 25; the number of steps is roughly: 2**(8+m_cost+t_cost)
|
||||
// For the machine today, it is recommended that: 5 <= t_cost + m_cost <= 25;
|
||||
// one may use the parameters: m_cost = 15; t_cost = 0; (256 MegaByte memory)
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "pomelo.h"
|
||||
|
||||
#define F0(i) { \
|
||||
i0 = ((i) - 0*4) & mask1; \
|
||||
i1 = ((i) - 2*4) & mask1; \
|
||||
i2 = ((i) - 3*4) & mask1; \
|
||||
i3 = ((i) - 7*4) & mask1; \
|
||||
i4 = ((i) - 13*4) & mask1; \
|
||||
S[i0+1] = ((S[i1+0] ^ S[i2+0]) + S[i3+0]) ^ S[i4+0]; \
|
||||
S[i0+2] = ((S[i1+1] ^ S[i2+1]) + S[i3+1]) ^ S[i4+1]; \
|
||||
S[i0+3] = ((S[i1+2] ^ S[i2+2]) + S[i3+2]) ^ S[i4+2]; \
|
||||
S[i0+0] = ((S[i1+3] ^ S[i2+3]) + S[i3+3]) ^ S[i4+3]; \
|
||||
S[i0+0] = (S[i0+0] << 17) | (S[i0+0] >> 47); \
|
||||
S[i0+1] = (S[i0+1] << 17) | (S[i0+1] >> 47); \
|
||||
S[i0+2] = (S[i0+2] << 17) | (S[i0+2] >> 47); \
|
||||
S[i0+3] = (S[i0+3] << 17) | (S[i0+3] >> 47); \
|
||||
}
|
||||
|
||||
#define F(i) { \
|
||||
i0 = ((i) - 0*4) & mask1; \
|
||||
i1 = ((i) - 2*4) & mask1; \
|
||||
i2 = ((i) - 3*4) & mask1; \
|
||||
i3 = ((i) - 7*4) & mask1; \
|
||||
i4 = ((i) - 13*4) & mask1; \
|
||||
S[i0+0] += ((S[i1+0] ^ S[i2+0]) + S[i3+0]) ^ S[i4+0]; \
|
||||
S[i0+1] += ((S[i1+1] ^ S[i2+1]) + S[i3+1]) ^ S[i4+1]; \
|
||||
S[i0+2] += ((S[i1+2] ^ S[i2+2]) + S[i3+2]) ^ S[i4+2]; \
|
||||
S[i0+3] += ((S[i1+3] ^ S[i2+3]) + S[i3+3]) ^ S[i4+3]; \
|
||||
temp = S[i0+3]; \
|
||||
S[i0+3] = S[i0+2]; \
|
||||
S[i0+2] = S[i0+1]; \
|
||||
S[i0+1] = S[i0+0]; \
|
||||
S[i0+0] = temp; \
|
||||
S[i0+0] = (S[i0+0] << 17) | (S[i0+0] >> 47); \
|
||||
S[i0+1] = (S[i0+1] << 17) | (S[i0+1] >> 47); \
|
||||
S[i0+2] = (S[i0+2] << 17) | (S[i0+2] >> 47); \
|
||||
S[i0+3] = (S[i0+3] << 17) | (S[i0+3] >> 47); \
|
||||
}
|
||||
|
||||
#define G(i,random_number) { \
|
||||
index_global = ((random_number >> 16) & mask) << 2; \
|
||||
for (j = 0; j < 128; j = j+4) \
|
||||
{ \
|
||||
F(i+j); \
|
||||
index_global = (index_global + 4) & mask1; \
|
||||
index_local = (((i + j) >> 2) - 0x1000 + (random_number & 0x1fff)) & mask; \
|
||||
index_local = index_local << 2; \
|
||||
S[i0+0] += (S[index_local+0] << 1); \
|
||||
S[i0+1] += (S[index_local+1] << 1); \
|
||||
S[i0+2] += (S[index_local+2] << 1); \
|
||||
S[i0+3] += (S[index_local+3] << 1); \
|
||||
S[index_local+0] += (S[i0+0] << 2); \
|
||||
S[index_local+1] += (S[i0+1] << 2); \
|
||||
S[index_local+2] += (S[i0+2] << 2); \
|
||||
S[index_local+3] += (S[i0+3] << 2); \
|
||||
S[i0+0] += (S[index_global+0] << 1); \
|
||||
S[i0+1] += (S[index_global+1] << 1); \
|
||||
S[i0+2] += (S[index_global+2] << 1); \
|
||||
S[i0+3] += (S[index_global+3] << 1); \
|
||||
S[index_global+0] += (S[i0+0] << 3); \
|
||||
S[index_global+1] += (S[i0+1] << 3); \
|
||||
S[index_global+2] += (S[i0+2] << 3); \
|
||||
S[index_global+3] += (S[i0+3] << 3); \
|
||||
random_number += (random_number << 2); \
|
||||
random_number = (random_number << 19) ^ (random_number >> 45) ^ 3141592653589793238ULL; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define H(i, random_number) { \
|
||||
index_global = ((random_number >> 16) & mask) << 2; \
|
||||
for (j = 0; j < 128; j = j+4) \
|
||||
{ \
|
||||
F(i+j); \
|
||||
index_global = (index_global + 4) & mask1; \
|
||||
index_local = (((i + j) >> 2) - 0x1000 + (random_number & 0x1fff)) & mask; \
|
||||
index_local = index_local << 2; \
|
||||
S[i0+0] += (S[index_local+0] << 1); \
|
||||
S[i0+1] += (S[index_local+1] << 1); \
|
||||
S[i0+2] += (S[index_local+2] << 1); \
|
||||
S[i0+3] += (S[index_local+3] << 1); \
|
||||
S[index_local+0] += (S[i0+0] << 2); \
|
||||
S[index_local+1] += (S[i0+1] << 2); \
|
||||
S[index_local+2] += (S[i0+2] << 2); \
|
||||
S[index_local+3] += (S[i0+3] << 2); \
|
||||
S[i0+0] += (S[index_global+0] << 1); \
|
||||
S[i0+1] += (S[index_global+1] << 1); \
|
||||
S[i0+2] += (S[index_global+2] << 1); \
|
||||
S[i0+3] += (S[index_global+3] << 1); \
|
||||
S[index_global+0] += (S[i0+0] << 3); \
|
||||
S[index_global+1] += (S[i0+1] << 3); \
|
||||
S[index_global+2] += (S[i0+2] << 3); \
|
||||
S[index_global+3] += (S[i0+3] << 3); \
|
||||
random_number = S[i3]; \
|
||||
} \
|
||||
}
|
||||
|
||||
int POMELO(void *out, size_t outlen, const void *in, size_t inlen, const void *salt, size_t saltlen, unsigned int t_cost, unsigned int m_cost);
|
||||
|
||||
int POMELO(void *out, size_t outlen, const void *in, size_t inlen, const void *salt, size_t saltlen, unsigned int t_cost, unsigned int m_cost)
|
||||
{
|
||||
unsigned long long i,j,k,temp;
|
||||
unsigned long long i0,i1,i2,i3,i4;
|
||||
unsigned long long *S;
|
||||
unsigned long long random_number, index_global, index_local;
|
||||
unsigned long long state_size, mask, mask1, mask2;
|
||||
|
||||
//check the size of password, salt and output. Password is at most 256 bytes; the salt is at most 32 bytes.
|
||||
if (inlen > 256 || saltlen > 64 || outlen > 256 || inlen < 0 || saltlen < 0 || outlen < 0) return 1;
|
||||
|
||||
//Step 1: Initialize the state S
|
||||
state_size = 1ULL << (13+m_cost); // state size is 2**(13+m_cost) bytes
|
||||
S = (unsigned long long *)malloc(state_size);
|
||||
mask = (1ULL << (8+m_cost)) - 1; // mask is used for modulation: modulo size_size/32;
|
||||
mask1 = (1ULL << (10+m_cost)) - 1; // mask is used for modulation: modulo size_size/8;
|
||||
|
||||
//Step 2: Load the password, salt, input/output sizes into the state S
|
||||
for (i = 0; i < inlen; i++) ((unsigned char*)S)[i] = ((unsigned char*)in)[i]; // load password into S
|
||||
for (i = 0; i < saltlen; i++) ((unsigned char*)S)[inlen+i] = ((unsigned char*)salt)[i]; // load salt into S
|
||||
for (i = inlen+saltlen; i < 384; i++) ((unsigned char*)S)[i] = 0;
|
||||
((unsigned char*)S)[384] = inlen & 0xff; // load password length (in bytes) into S;
|
||||
((unsigned char*)S)[385] = (inlen >> 8) & 0xff; // load password length (in bytes) into S;
|
||||
((unsigned char*)S)[386] = saltlen; // load salt length (in bytes) into S;
|
||||
((unsigned char*)S)[387] = outlen & 0xff; // load output length (in bytes into S)
|
||||
((unsigned char*)S)[388] = (outlen >> 8) & 0xff; // load output length (in bytes into S)
|
||||
((unsigned char*)S)[389] = 0;
|
||||
((unsigned char*)S)[390] = 0;
|
||||
((unsigned char*)S)[391] = 0;
|
||||
|
||||
((unsigned char*)S)[392] = 1;
|
||||
((unsigned char*)S)[393] = 1;
|
||||
for (i = 394; i < 416; i++) ((unsigned char*)S)[i] = ((unsigned char*)S)[i-1] + ((unsigned char*)S)[i-2];
|
||||
|
||||
//Step 3: Expand the data into the whole state
|
||||
for (i = 13*4; i < (1ULL << (10+m_cost)); i=i+4) F0(i);
|
||||
|
||||
//Step 4: Update the state using function G
|
||||
random_number = 123456789ULL;
|
||||
for (i = 0; i < (1ULL << (9+m_cost+t_cost)); i=i+128) G(i,random_number);
|
||||
|
||||
//Step 5: Update the state using function H
|
||||
for (i = 1ULL << (9+m_cost+t_cost); i < (1ULL << (10+m_cost+t_cost)); i=i+128) H(i,random_number);
|
||||
|
||||
//Step 6: Update the state using function F
|
||||
for (i = 0; i < (1ULL << (10+m_cost)); i=i+4) F(i);
|
||||
|
||||
//Step 7: Generate the output
|
||||
memcpy(out, ((unsigned char*)S)+state_size-outlen, outlen);
|
||||
memset(S, 0, state_size); // clear the memory
|
||||
free(S); // free the memory
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
15
stratum/algos/pomelo.h
Normal file
15
stratum/algos/pomelo.h
Normal file
|
@ -0,0 +1,15 @@
|
|||
#ifndef POMELO_H
|
||||
#define POMELO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int POMELO(void *out, size_t outlen, const void *in, size_t inlen, const void *salt, size_t saltlen, unsigned int t_cost, unsigned int m_cost);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
88
stratum/algos/sib.c
Normal file
88
stratum/algos/sib.c
Normal file
|
@ -0,0 +1,88 @@
|
|||
#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_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 "gost.h"
|
||||
|
||||
void sib_hash(const char *input, char* output, uint32_t len)
|
||||
{
|
||||
sph_blake512_context ctx_blake;
|
||||
sph_bmw512_context ctx_bmw;
|
||||
sph_groestl512_context ctx_groestl;
|
||||
sph_skein512_context ctx_skein;
|
||||
sph_jh512_context ctx_jh;
|
||||
sph_keccak512_context ctx_keccak;
|
||||
sph_gost512_context ctx_gost;
|
||||
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;
|
||||
|
||||
//these uint512 in the c++ source of the client are backed by an array of uint32
|
||||
uint32_t hashA[16], hashB[16];
|
||||
|
||||
sph_blake512_init(&ctx_blake);
|
||||
sph_blake512(&ctx_blake, input, 80);
|
||||
sph_blake512_close(&ctx_blake, hashA);
|
||||
|
||||
sph_bmw512_init(&ctx_bmw);
|
||||
sph_bmw512(&ctx_bmw, hashA, 64);
|
||||
sph_bmw512_close(&ctx_bmw, hashB);
|
||||
|
||||
sph_groestl512_init(&ctx_groestl);
|
||||
sph_groestl512(&ctx_groestl, hashB, 64);
|
||||
sph_groestl512_close(&ctx_groestl, hashA);
|
||||
|
||||
sph_skein512_init(&ctx_skein);
|
||||
sph_skein512(&ctx_skein, hashA, 64);
|
||||
sph_skein512_close(&ctx_skein, hashB);
|
||||
|
||||
sph_jh512_init(&ctx_jh);
|
||||
sph_jh512(&ctx_jh, hashB, 64);
|
||||
sph_jh512_close(&ctx_jh, hashA);
|
||||
|
||||
sph_keccak512_init(&ctx_keccak);
|
||||
sph_keccak512(&ctx_keccak, hashA, 64);
|
||||
sph_keccak512_close(&ctx_keccak, hashB);
|
||||
|
||||
sph_gost512_init(&ctx_gost);
|
||||
sph_gost512(&ctx_gost, hashB, 64);
|
||||
sph_gost512_close(&ctx_gost, hashA);
|
||||
|
||||
sph_luffa512_init(&ctx_luffa);
|
||||
sph_luffa512(&ctx_luffa, hashA, 64);
|
||||
sph_luffa512_close(&ctx_luffa, hashB);
|
||||
|
||||
sph_cubehash512_init(&ctx_cubehash);
|
||||
sph_cubehash512(&ctx_cubehash, hashB, 64);
|
||||
sph_cubehash512_close(&ctx_cubehash, hashA);
|
||||
|
||||
sph_shavite512_init(&ctx_shavite);
|
||||
sph_shavite512(&ctx_shavite, hashA, 64);
|
||||
sph_shavite512_close(&ctx_shavite, hashB);
|
||||
|
||||
sph_simd512_init(&ctx_simd);
|
||||
sph_simd512(&ctx_simd, hashB, 64);
|
||||
sph_simd512_close(&ctx_simd, hashA);
|
||||
|
||||
sph_echo512_init(&ctx_echo);
|
||||
sph_echo512(&ctx_echo, hashA, 64);
|
||||
sph_echo512_close(&ctx_echo, hashB);
|
||||
|
||||
memcpy(output, hashB, 32);
|
||||
}
|
||||
|
16
stratum/algos/sib.h
Normal file
16
stratum/algos/sib.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
#ifndef SIB_H
|
||||
#define SIB_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void sib_hash(const char* input, char* output, uint32_t len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
16
stratum/config.sample/hive.conf
Normal file
16
stratum/config.sample/hive.conf
Normal file
|
@ -0,0 +1,16 @@
|
|||
[TCP]
|
||||
server = yaamp.com
|
||||
port = 6033
|
||||
password = tu8tu5
|
||||
|
||||
[SQL]
|
||||
host = yaampdb
|
||||
database = yaamp
|
||||
username = root
|
||||
password = patofpaq
|
||||
|
||||
[STRATUM]
|
||||
algo = hive
|
||||
difficulty = 1
|
||||
max_ttf = 1048576
|
||||
|
16
stratum/config.sample/sib.conf
Normal file
16
stratum/config.sample/sib.conf
Normal file
|
@ -0,0 +1,16 @@
|
|||
[TCP]
|
||||
server = yaamp.com
|
||||
port = 5033
|
||||
password = tu8tu5
|
||||
|
||||
[SQL]
|
||||
host = yaampdb
|
||||
database = yaamp
|
||||
username = root
|
||||
password = patofpaq
|
||||
|
||||
[STRATUM]
|
||||
algo = sib
|
||||
difficulty = 0.016
|
||||
max_ttf = 40000
|
||||
|
|
@ -110,7 +110,9 @@ YAAMP_ALGO g_algos[] =
|
|||
{"penta", penta_hash, 1, 0, 0},
|
||||
{"skein2", skein2_hash, 1, 0, 0},
|
||||
{"zr5", zr5_hash, 1, 0, 0},
|
||||
{"drop", drop_hash, 0x10000, 0x10000, 0},
|
||||
|
||||
{"hive", hive_hash, 0x10000, 0, 0},
|
||||
{"sib", sib_hash, 1, 0, 0},
|
||||
|
||||
// {"whirlpoolx", whirlpoolx_hash, 1, 0, 0},
|
||||
// {"jha", jha_hash, 1, 0, 0},
|
||||
|
|
|
@ -146,7 +146,8 @@ void sha256_double_hash_hex(const char *input, char *output, unsigned int len);
|
|||
//#include "algos/whirlpoolx.h"
|
||||
#include "algos/skein2.h"
|
||||
#include "algos/zr5.h"
|
||||
#include "algos/drop.h"
|
||||
#include "algos/hive.h"
|
||||
#include "algos/sib.h"
|
||||
//#include "jha.h"
|
||||
//#include "hash/m7m.h"
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ function yaamp_get_algos()
|
|||
'x13',
|
||||
'x15',
|
||||
'groestl', // dmd-gr -m 256
|
||||
//'hive',
|
||||
'sib',
|
||||
'skein',
|
||||
'skein2',
|
||||
'zr5',
|
||||
|
@ -72,6 +74,7 @@ function getAlgoColors($algo)
|
|||
'x13' => '#d0f0c0',
|
||||
'x14' => '#a0f0c0',
|
||||
'x15' => '#f0b0a0',
|
||||
'hive' => '#d0a0a0',
|
||||
'luffa' => '#a0c0c0',
|
||||
'penta' => '#80c0c0',
|
||||
'nist5' => '#e0d0e0',
|
||||
|
@ -79,6 +82,7 @@ function getAlgoColors($algo)
|
|||
'qubit' => '#d0a0f0',
|
||||
'lyra2' => '#80a0f0',
|
||||
'lyra2v2' => '#80c0f0',
|
||||
'sib' => '#a0a0c0',
|
||||
'skein' => '#80a0a0',
|
||||
'skein2' => '#a0a0a0',
|
||||
'zr5' => '#d0b0d0',
|
||||
|
@ -114,7 +118,7 @@ function getAlgoPort($algo)
|
|||
'qubit' => 4733,
|
||||
'zr5' => 4833,
|
||||
'skein' => 4933,
|
||||
//'drop' => 5033,
|
||||
'sib' => 5033,
|
||||
'keccak' => 5133,
|
||||
'skein2' => 5233,
|
||||
'groestl' => 5333,
|
||||
|
@ -123,6 +127,7 @@ function getAlgoPort($algo)
|
|||
'blake' => 5733,
|
||||
'penta' => 5833,
|
||||
'luffa' => 5933,
|
||||
'hive' => 6033,
|
||||
);
|
||||
|
||||
global $configCustomPorts;
|
||||
|
|
Loading…
Add table
Reference in a new issue