1
0
mirror of https://github.com/GOSTSec/ccminer synced 2025-01-11 15:27:56 +00:00

use gostd for merkle in case of stratum

This commit is contained in:
orignal 2017-09-16 17:41:43 -04:00
parent fc1b6f9b32
commit 23d5ea88c6
3 changed files with 19 additions and 0 deletions

View File

@ -1500,6 +1500,9 @@ static bool stratum_gen_work(struct stratum_ctx *sctx, struct work *work)
case ALGO_WHIRLCOIN:
SHA256((uchar*)sctx->job.coinbase, sctx->job.coinbase_size, (uchar*)merkle_root);
break;
case ALGO_GOSTD:
gostd(merkle_root, sctx->job.coinbase, (int)sctx->job.coinbase_size);
break;
case ALGO_WHIRLPOOL:
default:
sha256d(merkle_root, sctx->job.coinbase, (int)sctx->job.coinbase_size);
@ -1509,6 +1512,11 @@ static bool stratum_gen_work(struct stratum_ctx *sctx, struct work *work)
memcpy(merkle_root + 32, sctx->job.merkle[i], 32);
if (opt_algo == ALGO_HEAVY || opt_algo == ALGO_MJOLLNIR)
heavycoin_hash(merkle_root, merkle_root, 64);
if (opt_algo == ALGO_GOSTD)
{
memcpy(merkle_root + 32, merkle_root, 32);
gostd(merkle_root, merkle_root, 64);
}
else
sha256d(merkle_root, merkle_root, 64);
}

View File

@ -21,6 +21,15 @@ extern "C" void gostd_hash(void *output, const void *input)
memcpy(output, hash, 32);
}
extern "C" void gostd(void *output, const void *input, size_t len)
{
unsigned char _ALIGN(64) hash[64];
sph_gost512(hash, (const void*)input, len);
sph_gost256(hash, (const void*)hash, 64);
memcpy(output, hash, 32);
}
//#define _DEBUG
#define _DEBUG_PREFIX "gost"

View File

@ -268,6 +268,8 @@ void sha256_init(uint32_t *state);
void sha256_transform(uint32_t *state, const uint32_t *block, int swap);
void sha256d(unsigned char *hash, const unsigned char *data, int len);
void gostd(void *output, const void *input, size_t len);
#define HAVE_SHA256_4WAY 0
#define HAVE_SHA256_8WAY 0