Skip to content

Commit

Permalink
Add sha256d algo (bitcoin) btw...
Browse files Browse the repository at this point in the history
even if it works on yiimp, the stratum diff is too high for gpus (for now)
  • Loading branch information
tpruvot committed Mar 11, 2017
1 parent 61231bc commit 80c7551
Show file tree
Hide file tree
Showing 12 changed files with 639 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ ccminer_SOURCES = elist.h miner.h compat.h \
quark/quarkcoin.cu quark/cuda_quark_compactionTest.cu \
neoscrypt/neoscrypt.cpp neoscrypt/neoscrypt-cpu.c neoscrypt/cuda_neoscrypt.cu \
pentablake.cu skein.cu cuda_skeincoin.cu skein2.cpp zr5.cu \
sha256/sha256t.cu sha256/cuda_sha256t.cu \
sha256/sha256d.cu sha256/cuda_sha256d.cu sha256/sha256t.cu sha256/cuda_sha256t.cu \
sia/sia.cu sia/sia-rpc.cpp sph/blake2b.c \
sph/bmw.c sph/blake.c sph/groestl.c sph/jh.c sph/keccak.c sph/skein.c \
sph/cubehash.c sph/echo.c sph/luffa.c sph/sha2.c sph/shavite.c sph/simd.c \
Expand Down
6 changes: 6 additions & 0 deletions algos.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ enum sha_algos {
ALGO_QUBIT,
ALGO_SCRYPT,
ALGO_SCRYPT_JANE,
ALGO_SHA256D,
ALGO_SHA256T,
ALGO_SIA,
ALGO_SIB,
Expand Down Expand Up @@ -96,6 +97,7 @@ static const char *algo_names[] = {
"qubit",
"scrypt",
"scrypt-jane",
"sha256d",
"sha256t",
"sia",
"sib",
Expand Down Expand Up @@ -151,6 +153,10 @@ static inline int algo_to_int(char* arg)
i = ALGO_LYRA2;
else if (!strcasecmp("lyra2rev2", arg))
i = ALGO_LYRA2v2;
else if (!strcasecmp("bitcoin", arg))
i = ALGO_SHA256D;
else if (!strcasecmp("sha256", arg))
i = ALGO_SHA256D;
else if (!strcasecmp("thorsriddle", arg))
i = ALGO_VELTOR;
else if (!strcasecmp("whirl", arg))
Expand Down
2 changes: 1 addition & 1 deletion bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ void algo_free_all(int thr_id)
free_qubit(thr_id);
free_skeincoin(thr_id);
free_skein2(thr_id);
free_sha256d(thr_id);
free_sha256t(thr_id);
free_sia(thr_id);
free_sib(thr_id);
Expand All @@ -90,7 +91,6 @@ void algo_free_all(int thr_id)
free_x15(thr_id);
free_x17(thr_id);
free_zr5(thr_id);
//free_sha256d(thr_id);
free_scrypt(thr_id);
free_scrypt_jane(thr_id);
free_timetravel(thr_id);
Expand Down
6 changes: 6 additions & 0 deletions ccminer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ Options:\n\
penta Pentablake hash (5x Blake 512)\n\
quark Quark\n\
qubit Qubit\n\
sha256d SHA256d (bitcoin)\n\
sha256t SHA256 x3\n\
sia SIA (Blake2B)\n\
sib Sibcoin (X11+Streebog)\n\
Expand Down Expand Up @@ -882,6 +883,7 @@ static bool submit_upstream_work(CURL *curl, struct work *work)
case ALGO_BLAKECOIN:
case ALGO_BLAKE2S:
case ALGO_BMW:
case ALGO_SHA256D:
case ALGO_SHA256T:
case ALGO_VANILLA:
// fast algos require that... (todo: regen hash)
Expand Down Expand Up @@ -2106,6 +2108,7 @@ static void *miner_thread(void *userdata)
case ALGO_BLAKE:
case ALGO_BMW:
case ALGO_DECRED:
case ALGO_SHA256D:
case ALGO_SHA256T:
//case ALGO_WHIRLPOOLX:
minmax = 0x40000000U;
Expand Down Expand Up @@ -2308,6 +2311,9 @@ static void *miner_thread(void *userdata)
case ALGO_SKEIN2:
rc = scanhash_skein2(thr_id, &work, max_nonce, &hashes_done);
break;
case ALGO_SHA256D:
rc = scanhash_sha256d(thr_id, &work, max_nonce, &hashes_done);
break;
case ALGO_SHA256T:
rc = scanhash_sha256t(thr_id, &work, max_nonce, &hashes_done);
break;
Expand Down
2 changes: 2 additions & 0 deletions ccminer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@
<CudaCompile Include="scrypt\titan_kernel.cu">
<CodeGeneration>compute_35,sm_35;compute_50,sm_50</CodeGeneration>
</CudaCompile>
<CudaCompile Include="sha256\cuda_sha256d.cu" />
<CudaCompile Include="sha256\sha256d.cu" />
<CudaCompile Include="sha256\cuda_sha256t.cu" />
<CudaCompile Include="sha256\sha256t.cu" />
<CudaCompile Include="zr5.cu" />
Expand Down
6 changes: 6 additions & 0 deletions ccminer.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,12 @@
<CudaCompile Include="lbry\lbry.cu">
<Filter>Source Files\CUDA\lbry</Filter>
</CudaCompile>
<CudaCompile Include="sha256\cuda_sha256d.cu">
<Filter>Source Files\sha256</Filter>
</CudaCompile>
<CudaCompile Include="sha256\sha256d.cu">
<Filter>Source Files\sha256</Filter>
</CudaCompile>
<CudaCompile Include="sha256\cuda_sha256t.cu">
<Filter>Source Files\sha256</Filter>
</CudaCompile>
Expand Down
4 changes: 3 additions & 1 deletion miner.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ extern int scanhash_nist5(int thr_id, struct work *work, uint32_t max_nonce, uns
extern int scanhash_pentablake(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done);
extern int scanhash_quark(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done);
extern int scanhash_qubit(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done);
extern int scanhash_sha256d(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done);
extern int scanhash_sha256t(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done);
extern int scanhash_sia(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done);
extern int scanhash_sib(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done);
Expand All @@ -319,7 +320,6 @@ extern int scanhash_x15(int thr_id, struct work* work, uint32_t max_nonce, unsig
extern int scanhash_x17(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done);
extern int scanhash_zr5(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done);

extern int scanhash_sha256d(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done);
extern int scanhash_scrypt(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done,
unsigned char *scratchbuf, struct timeval *tv_start, struct timeval *tv_end);
extern int scanhash_scrypt_jane(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done,
Expand Down Expand Up @@ -355,6 +355,7 @@ extern void free_nist5(int thr_id);
extern void free_pentablake(int thr_id);
extern void free_quark(int thr_id);
extern void free_qubit(int thr_id);
extern void free_sha256d(int thr_id);
extern void free_sha256t(int thr_id);
extern void free_sia(int thr_id);
extern void free_sib(int thr_id);
Expand Down Expand Up @@ -879,6 +880,7 @@ void quarkhash(void *state, const void *input);
void qubithash(void *state, const void *input);
void scrypthash(void* output, const void* input);
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 skeincoinhash(void *output, const void *input);
Expand Down
Loading

0 comments on commit 80c7551

Please sign in to comment.