From 52ec8830b1a9231b35bf44286a8f07d6ac0eb5b1 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sat, 6 Sep 2014 01:21:30 +0200 Subject: [PATCH] blake: blakecoin variant now works --- README.txt | 1 + blake32.cu | 4 ++-- configure.ac | 2 +- cpu-miner.c | 5 +++-- sph/blake.c | 4 ++-- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.txt b/README.txt index 15c7c72..ea4cd5b 100644 --- a/README.txt +++ b/README.txt @@ -62,6 +62,7 @@ its command line interface and options. quark use to mine Quarkcoin anime use to mine Animecoin blake use to mine NEOS (Blake 256) + blakecoin use to mine Old Blake 256 nist5 use to mine TalkCoin fresh use to mine Freshcoin whirl use to mine Whirlcoin diff --git a/blake32.cu b/blake32.cu index 638cfbe..2ce2acd 100644 --- a/blake32.cu +++ b/blake32.cu @@ -191,7 +191,7 @@ void blake256_compress(uint32_t *h, const uint32_t *block, const uint32_t T0, in } __global__ -void blake256_gpu_hash_80(uint32_t threads, uint32_t startNounce, uint32_t *resNounce, int blakerounds) +void blake256_gpu_hash_80(uint32_t threads, uint32_t startNounce, uint32_t *resNounce, const int blakerounds) { uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); if (thread < threads) @@ -232,7 +232,7 @@ void blake256_gpu_hash_80(uint32_t threads, uint32_t startNounce, uint32_t *resN } __host__ -uint32_t blake256_cpu_hash_80(int thr_id, uint32_t threads, uint32_t startNounce, int blakerounds) +uint32_t blake256_cpu_hash_80(int thr_id, uint32_t threads, uint32_t startNounce, const int blakerounds) { const int threadsperblock = TPB; uint32_t result = MAXU; diff --git a/configure.ac b/configure.ac index f7924d4..2a554f1 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([ccminer], [2014.09.01]) +AC_INIT([ccminer], [2014.09.06]) AC_PREREQ([2.59c]) AC_CANONICAL_SYSTEM diff --git a/cpu-miner.c b/cpu-miner.c index 9110d74..b3a6ba7 100644 --- a/cpu-miner.c +++ b/cpu-miner.c @@ -789,7 +789,7 @@ static void stratum_gen_work(struct stratum_ctx *sctx, struct work *work) if (opt_algo == ALGO_HEAVY || opt_algo == ALGO_MJOLLNIR) heavycoin_hash(merkle_root, sctx->job.coinbase, (int)sctx->job.coinbase_size); else - if (opt_algo == ALGO_FUGUE256 || opt_algo == ALGO_GROESTL || opt_algo == ALGO_WHC) + if (opt_algo == ALGO_FUGUE256 || opt_algo == ALGO_GROESTL || opt_algo == ALGO_WHC || opt_algo == ALGO_BLAKECOIN) SHA256((unsigned char*)sctx->job.coinbase, sctx->job.coinbase_size, (unsigned char*)merkle_root); else sha256d(merkle_root, sctx->job.coinbase, (int)sctx->job.coinbase_size); @@ -964,6 +964,7 @@ static void *miner_thread(void *userdata) max64 = 0x1fffLL; break; case ALGO_BLAKECOIN: + max64 = 0x3ffffffLL; case ALGO_BLAKE: /* based on the 750Ti hashrate (100kH) */ max64 = 0x3ffffffLL; @@ -1373,7 +1374,7 @@ out: return NULL; } -#define PROGRAM_VERSION "1.4" +#define PROGRAM_VERSION "1.4.1" static void show_version_and_exit(void) { printf("%s v%s\n" diff --git a/sph/blake.c b/sph/blake.c index ea829f0..c89de5e 100644 --- a/sph/blake.c +++ b/sph/blake.c @@ -592,7 +592,6 @@ static const sph_u64 CB[16] = { M6 = sph_dec32be_aligned(buf + 24); \ M7 = sph_dec32be_aligned(buf + 28); \ M8 = sph_dec32be_aligned(buf + 32); \ - if (blake256_rounds == 14) { \ M9 = sph_dec32be_aligned(buf + 36); \ MA = sph_dec32be_aligned(buf + 40); \ MB = sph_dec32be_aligned(buf + 44); \ @@ -600,7 +599,6 @@ static const sph_u64 CB[16] = { MD = sph_dec32be_aligned(buf + 52); \ ME = sph_dec32be_aligned(buf + 56); \ MF = sph_dec32be_aligned(buf + 60); \ - } \ ROUND_S(0); \ ROUND_S(1); \ ROUND_S(2); \ @@ -609,12 +607,14 @@ static const sph_u64 CB[16] = { ROUND_S(5); \ ROUND_S(6); \ ROUND_S(7); \ + if (blake256_rounds == 14) { \ ROUND_S(8); \ ROUND_S(9); \ ROUND_S(0); \ ROUND_S(1); \ ROUND_S(2); \ ROUND_S(3); \ + } \ H0 ^= S0 ^ V0 ^ V8; \ H1 ^= S1 ^ V1 ^ V9; \ H2 ^= S2 ^ V2 ^ VA; \