From 1042762dc48be7beebf62476acc33962e1432d3f Mon Sep 17 00:00:00 2001 From: orignal Date: Mon, 17 Apr 2017 12:55:01 -0400 Subject: [PATCH] gost added --- Makefile.am | 3 ++- gost/gost.cu | 34 ++++++++++++++++++++++++++++++++++ miner.h | 1 + util.cpp | 3 +++ 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 gost/gost.cu diff --git a/Makefile.am b/Makefile.am index 4ed9679..78c27a5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -69,7 +69,8 @@ ccminer_SOURCES = elist.h miner.h compat.h \ x15/x14.cu x15/x15.cu x15/cuda_x14_shabal512.cu x15/cuda_x15_whirlpool.cu \ x15/whirlpool.cu x15/cuda_x15_whirlpool_sm3.cu \ x17/x17.cu x17/hmq17.cu x17/cuda_x17_haval256.cu x17/cuda_x17_sha512.cu \ - x11/c11.cu x11/s3.cu x11/sib.cu x11/veltor.cu x11/cuda_streebog.cu + x11/c11.cu x11/s3.cu x11/sib.cu x11/veltor.cu x11/cuda_streebog.cu \ + gost/gost.cu # scrypt ccminer_SOURCES += scrypt.cpp scrypt-jane.cpp \ diff --git a/gost/gost.cu b/gost/gost.cu new file mode 100644 index 0000000..65bea9f --- /dev/null +++ b/gost/gost.cu @@ -0,0 +1,34 @@ +extern "C" { +#include "sph/sph_streebog.h" +} + +#include "miner.h" +#include "cuda_helper.h" + +#include +#include + +#define NBN 2 +static uint32_t *d_hash[MAX_GPUS]; +static uint32_t *d_resNonce[MAX_GPUS]; +static uint32_t *h_resNonce[MAX_GPUS]; + +// GOST CPU Hash +extern "C" void gosthash(void *output, const void *input) +{ + unsigned char _ALIGN(128) hash[128] = { 0 }; + + sph_gost512_context ctx_gost1; + sph_gost256_context ctx_gost2; + + sph_gost512_init(&ctx_gost1); + sph_gost512(&ctx_gost1, (const void*) input, 80); + sph_gost512_close(&ctx_gost1, (void*) hash); + + sph_gost256_init(&ctx_gost2); + sph_gost256(&ctx_gost2, (const void*)hash, 64); + sph_gost256_close(&ctx_gost1, (void*) hash); + + memcpy(output, hash, 32); +} + diff --git a/miner.h b/miner.h index c4c739f..2f5c812 100644 --- a/miner.h +++ b/miner.h @@ -883,6 +883,7 @@ void scryptjane_hash(void* output, const void* input); void sha256d_hash(void *output, const void *input); void sha256t_hash(void *output, const void *input); void sibhash(void *output, const void *input); +void gosthash(void *output, const void *input); void skeincoinhash(void *output, const void *input); void skein2hash(void *output, const void *input); void s3hash(void *output, const void *input); diff --git a/util.cpp b/util.cpp index a01bf30..10b8d92 100644 --- a/util.cpp +++ b/util.cpp @@ -2240,6 +2240,9 @@ void print_hash_tests(void) sibhash(&hash[0], &buf[0]); printpfx("sib", hash); + gosthash(&hash[0], &buf[0]); + printpfx("gost", hash); + skeincoinhash(&hash[0], &buf[0]); printpfx("skein", hash);