Skip to content

Commit

Permalink
sha256q algo (#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
pyritepirate authored and tpruvot committed Dec 31, 2018
1 parent 31124f7 commit 94d3ba1
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stratum/algos/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ SOURCES=lyra2re.c lyra2v2.c Lyra2.c lyra2z.c Lyra2-z.c Sponge.c allium.c \
deep.c fresh.c groestl.c neoscrypt.c nist5.c quark.c qubit.c skein.c skein2.c \
bitcore.c timetravel.c x11evo.c x16r.c x16s.c xevan.c bastion.c hmq17.c sonoa.c \
bmw.c luffa.c pentablake.c vitalium.c whirlpool.c whirlpoolx.c zr5.c \
scrypt.c scryptn.c sha256.c sha256t.c \
scrypt.c scryptn.c sha256.c sha256t.c sha256q.c \
yescrypt.c yescrypt-opt.c sha256_Y.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 \
Expand Down
32 changes: 32 additions & 0 deletions stratum/algos/sha256q.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>

#include "sha256.h"

#include <stdlib.h>

void sha256q_hash(const char* input, char* output, uint32_t len)
{
unsigned char hash[64];

SHA256_CTX ctx_sha256;
SHA256_Init(&ctx_sha256);
SHA256_Update(&ctx_sha256, input, len);
SHA256_Final(hash, &ctx_sha256);

SHA256_Init(&ctx_sha256);
SHA256_Update(&ctx_sha256, hash, 32);
SHA256_Final(hash, &ctx_sha256);

SHA256_Init(&ctx_sha256);
SHA256_Update(&ctx_sha256, hash, 32);
SHA256_Final(hash, &ctx_sha256);

SHA256_Init(&ctx_sha256);
SHA256_Update(&ctx_sha256, hash, 32);
SHA256_Final((unsigned char*)output, &ctx_sha256);
}

16 changes: 16 additions & 0 deletions stratum/algos/sha256q.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef SHA256Q_H
#define SHA256Q_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>

void sha256q_hash(const char* input, char* output, uint32_t len);

#ifdef __cplusplus
}
#endif

#endif
17 changes: 17 additions & 0 deletions stratum/config.sample/sha256q.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[TCP]
server = yaamp.com
port = 3337
password = tu8tu5

[SQL]
host = yaampdb
database = yaamp
username = root
password = patofpaq

[STRATUM]
algo = sha256q
difficulty = 1
max_ttf = 40000
reconnect = 1

2 changes: 2 additions & 0 deletions stratum/stratum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ YAAMP_ALGO g_algos[] =

{"sha256t", sha256t_hash, 1, 0, 0}, // sha256 3x

{"sha256q", sha256q_hash, 1, 0, 0}, // sha256 4x

{"sib", sib_hash, 1, 0, 0},

{"whirlcoin", whirlpool_hash, 1, 0, sha256_hash_hex }, /* old sha merkleroot */
Expand Down
1 change: 1 addition & 0 deletions stratum/stratum.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ void sha256_double_hash_hex(const char *input, char *output, unsigned int len);
#include "algos/skein.h"
#include "algos/keccak.h"
#include "algos/sha256t.h"
#include "algos/sha256q.h"
#include "algos/skunk.h"
#include "algos/timetravel.h"
#include "algos/bitcore.h"
Expand Down
4 changes: 4 additions & 0 deletions web/yaamp/core/functions/yaamp.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ function yaamp_get_algos()
return array(
'sha256',
'sha256t',
'sha256q',
'scrypt',
'scryptn',
'allium',
Expand Down Expand Up @@ -84,6 +85,7 @@ function yaamp_algo_mBTC_factor($algo)
switch($algo) {
case 'sha256':
case 'sha256t':
case 'sha256q':
case 'blake':
case 'blakecoin':
case 'blake2s':
Expand Down Expand Up @@ -144,6 +146,7 @@ function getAlgoColors($algo)
$a = array(
'sha256' => '#d0d0a0',
'sha256t' => '#d0d0f0',
'sha256q' => '#9696dd',
'scrypt' => '#c0c0e0',
'neoscrypt' => '#a0d0f0',
'scryptn' => '#d0d0d0',
Expand Down Expand Up @@ -226,6 +229,7 @@ function getAlgoPort($algo)
$a = array(
'sha256' => 3333,
'sha256t' => 3339,
'sha256q' => 3337,
'lbry' => 3334,
'scrypt' => 3433,
'timetravel' => 3555,
Expand Down

0 comments on commit 94d3ba1

Please sign in to comment.