From c984f96fb3fe5d043ce1f8a525e7f3ad71fc9c0f Mon Sep 17 00:00:00 2001 From: monkins1010 <34682781+monkins1010@users.noreply.github.com> Date: Sat, 13 Oct 2018 13:52:49 +0100 Subject: [PATCH] Add files via upload --- Makefile.am | 160 +------------------ bignum.cpp | 41 ----- bignum.hpp | 27 ++-- ccminer.cpp | 438 ++++++---------------------------------------------- util.cpp | 240 +--------------------------- 5 files changed, 74 insertions(+), 832 deletions(-) diff --git a/Makefile.am b/Makefile.am index 4ee193e934..ce567d17bc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,85 +16,14 @@ SUBDIRS = compat bin_PROGRAMS = ccminer ccminer_SOURCES = elist.h miner.h compat.h \ - compat/inttypes.h compat/stdbool.h compat/unistd.h \ + compat/inttypes.h compat/stdbool.h compat/unistd.h bignum.cpp bignum.hpp \ compat/sys/time.h compat/getopt/getopt.h \ crc32.c hefty1.c \ - ccminer.cpp pools.cpp util.cpp bench.cpp bignum.cpp \ - api.cpp hashlog.cpp nvml.cpp stats.cpp sysinfos.cpp cuda.cpp \ - nvsettings.cpp \ - equi/equi-stratum.cpp equi/equi.cpp equi/blake2/blake2bx.cpp \ - equi/equihash.cpp equi/cuda_equi.cu \ - heavy/heavy.cu \ - heavy/cuda_blake512.cu heavy/cuda_blake512.h \ - heavy/cuda_combine.cu heavy/cuda_combine.h \ - heavy/cuda_groestl512.cu heavy/cuda_groestl512.h \ - heavy/cuda_hefty1.cu heavy/cuda_hefty1.h \ - heavy/cuda_keccak512.cu heavy/cuda_keccak512.h \ - heavy/cuda_sha256.cu heavy/cuda_sha256.h \ - heavy/bastion.cu heavy/cuda_bastion.cu \ - fuguecoin.cpp Algo256/cuda_fugue256.cu sph/fugue.c uint256.h \ - groestlcoin.cpp cuda_groestlcoin.cu cuda_groestlcoin.h \ - myriadgroestl.cpp cuda_myriadgroestl.cu \ - lyra2/Lyra2.c lyra2/Sponge.c \ - lyra2/lyra2RE.cu lyra2/cuda_lyra2.cu \ - lyra2/lyra2REv2.cu lyra2/cuda_lyra2v2.cu \ - lyra2/Lyra2Z.c lyra2/lyra2Z.cu lyra2/cuda_lyra2Z.cu \ - lyra2/allium.cu \ - Algo256/cuda_bmw256.cu Algo256/cuda_cubehash256.cu \ - Algo256/cuda_blake256.cu Algo256/cuda_groestl256.cu \ - Algo256/cuda_keccak256_sm3.cu Algo256/cuda_keccak256.cu Algo256/cuda_skein256.cu \ - Algo256/blake256.cu Algo256/decred.cu Algo256/vanilla.cu Algo256/keccak256.cu \ - Algo256/blake2s.cu sph/blake2s.c \ - Algo256/bmw.cu Algo256/cuda_bmw.cu \ - crypto/xmr-rpc.cpp crypto/wildkeccak-cpu.cpp crypto/wildkeccak.cu \ - crypto/cryptolight.cu crypto/cryptolight-core.cu crypto/cryptolight-cpu.cpp \ - crypto/cryptonight.cu crypto/cryptonight-core.cu crypto/cryptonight-extra.cu \ - crypto/cryptonight-cpu.cpp crypto/oaes_lib.cpp crypto/aesb.cpp crypto/cpu/c_keccak.c \ - JHA/jha.cu JHA/jackpotcoin.cu JHA/cuda_jha_keccak512.cu \ - JHA/cuda_jha_compactionTest.cu cuda_checkhash.cu \ - quark/cuda_jh512.cu quark/cuda_quark_blake512.cu quark/cuda_quark_groestl512.cu quark/cuda_skein512.cu \ - quark/cuda_bmw512.cu quark/cuda_quark_keccak512.cu \ - quark/nist5.cu \ - 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 \ - skunk/skunk.cu skunk/cuda_skunk.cu skunk/cuda_skunk_streebog.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 \ - sph/hamsi.c sph/hamsi_helper.c sph/streebog.c \ - sph/shabal.c sph/whirlpool.c sph/sha2big.c sph/haval.c \ - sph/ripemd.c sph/sph_sha2.c \ - polytimos.cu \ - lbry/lbry.cu lbry/cuda_sha256_lbry.cu lbry/cuda_sha512_lbry.cu lbry/cuda_lbry_merged.cu \ - qubit/qubit.cu qubit/qubit_luffa512.cu qubit/deep.cu qubit/luffa.cu \ - tribus/tribus.cu tribus/cuda_echo512_final.cu \ - x11/x11.cu x12/x12.cu x11/fresh.cu x11/cuda_x11_luffa512.cu x11/cuda_x11_cubehash512.cu \ - x11/cuda_x11_shavite512.cu x11/cuda_x11_simd512.cu x11/cuda_x11_echo.cu \ - x11/cuda_x11_luffa512_Cubehash.cu x11/x11evo.cu x11/timetravel.cu x11/bitcore.cu \ - x13/x13.cu x13/cuda_x13_hamsi512.cu x13/cuda_x13_fugue512.cu \ - x13/hsr.cu x13/cuda_hsr_sm3.cu x13/sm3.c \ - 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 \ - x16/x16r.cu x16/x16s.cu x16/cuda_x16_echo512.cu x16/cuda_x16_fugue512.cu \ - x16/cuda_x16_shabal512.cu x16/cuda_x16_simd512_80.cu \ - x16/cuda_x16_echo512_64.cu \ - x17/x17.cu x17/hmq17.cu x17/sonoa.cu x17/cuda_x17_haval256.cu x17/cuda_x17_sha512.cu \ - phi/phi.cu phi/phi2.cu phi/cuda_phi2.cu phi/cuda_phi2_cubehash512.cu x11/cuda_streebog_maxwell.cu \ - x11/c11.cu x11/s3.cu x11/sib.cu x11/veltor.cu x11/cuda_streebog.cu \ - verus/haraka.c verus/haraka.h verus/verus.cu verus/verusscan.cpp -# scrypt -ccminer_SOURCES += scrypt.cpp scrypt-jane.cpp \ - scrypt/blake.cu scrypt/keccak.cu scrypt/sha256.cu \ - scrypt/salsa_kernel.cu scrypt/test_kernel.cu \ - scrypt/fermi_kernel.cu scrypt/kepler_kernel.cu \ - scrypt/nv_kernel.cu scrypt/nv_kernel2.cu scrypt/titan_kernel.cu - -if HAVE_NVML -nvml_defs = -DUSE_WRAPNVML -nvml_libs = -ldl -endif + ccminer.cpp pools.cpp util.cpp bench.cpp \ + api.cpp hashlog.cpp stats.cpp sysinfos.cpp \ + equi/equi-stratum.cpp verus/verusscan.cpp verus/haraka.c verus/haraka.h + + if HAVE_WINDOWS ccminer_SOURCES += compat/winansi.c @@ -102,7 +31,7 @@ endif ccminer_LDFLAGS = $(PTHREAD_FLAGS) @CUDA_LDFLAGS@ ccminer_LDADD = @LIBCURL@ @JANSSON_LIBS@ @PTHREAD_LIBS@ @WS2_LIBS@ @CUDA_LIBS@ @OPENMP_CFLAGS@ @LIBS@ $(nvml_libs) -ccminer_CPPFLAGS = @LIBCURL_CPPFLAGS@ @OPENMP_CFLAGS@ $(CPPFLAGS) $(PTHREAD_FLAGS) -msse4.1 -maes -fno-strict-aliasing $(JANSSON_INCLUDES) $(DEF_INCLUDES) $(nvml_defs) +ccminer_CPPFLAGS = @LIBCURL_CPPFLAGS@ @OPENMP_CFLAGS@ $(CPPFLAGS) $(PTHREAD_FLAGS) -msse4.2 -maes -fno-strict-aliasing $(JANSSON_INCLUDES) $(DEF_INCLUDES) $(nvml_defs) if HAVE_OSX ccminer_CPPFLAGS += -I/usr/local/llvm/lib/clang/4.0.0/include @@ -125,80 +54,5 @@ nvcc_ARCH += -gencode=arch=compute_50,code=\"sm_50,compute_50\" nvcc_FLAGS = $(nvcc_ARCH) @CUDA_INCLUDES@ -I. @CUDA_CFLAGS@ nvcc_FLAGS += $(JANSSON_INCLUDES) --ptxas-options="-v" -# we're now targeting all major compute architectures within one binary. -.cu.o: - $(NVCC) $(nvcc_FLAGS) --maxrregcount=128 -o $@ -c $< - -Algo256/blake256.o: Algo256/blake256.cu - $(NVCC) $(nvcc_FLAGS) --maxrregcount=64 -o $@ -c $< - -Algo256/cuda_bmw.o: Algo256/cuda_bmw.cu - $(NVCC) $(nvcc_FLAGS) --maxrregcount=76 -o $@ -c $< - -crypto/cryptonight-core.o: crypto/cryptonight-core.cu - $(NVCC) $(nvcc_FLAGS) --maxrregcount=64 -o $@ -c $< - -crypto/cryptonight-extra.o: crypto/cryptonight-extra.cu - $(NVCC) $(nvcc_FLAGS) -o $@ -c $< - -heavy/cuda_hefty1.o: heavy/cuda_hefty1.cu - $(NVCC) $(nvcc_FLAGS) --maxrregcount=80 -o $@ -c $< - -qubit/qubit_luffa512.o: qubit/qubit_luffa512.cu - $(NVCC) $(nvcc_FLAGS) --maxrregcount=80 -o $@ -c $< - -# Luffa and Echo are faster with 80 registers than 128 -x11/cuda_x11_luffa512.o: x11/cuda_x11_luffa512.cu - $(NVCC) $(nvcc_FLAGS) --maxrregcount=80 -o $@ -c $< - -x11/cuda_x11_luffa512_Cubehash.o: x11/cuda_x11_luffa512_Cubehash.cu - $(NVCC) $(nvcc_FLAGS) --maxrregcount=76 -o $@ -c $< - -x11/cuda_x11_simd512.o: x11/cuda_x11_simd512.cu - $(NVCC) $(nvcc_FLAGS) -Xcompiler -Wno-unused-variable -o $@ -c $< - -x13/cuda_x13_hamsi512.o: x13/cuda_x13_hamsi512.cu - $(NVCC) $(nvcc_FLAGS) --maxrregcount=72 -o $@ -c $< - -x17/cuda_x17_sha512.o: x17/cuda_x17_sha512.cu - $(NVCC) $(nvcc_FLAGS) --maxrregcount=80 -o $@ -c $< - -quark/cuda_quark_blake512.o: quark/cuda_quark_blake512.cu - $(NVCC) $(nvcc_FLAGS) --maxrregcount=80 -o $@ -c $< - -quark/cuda_jh512.o: quark/cuda_jh512.cu - $(NVCC) $(nvcc_FLAGS) --maxrregcount=80 -o $@ -c $< - -quark/cuda_quark_keccak512.o: quark/cuda_quark_keccak512.cu - $(NVCC) $(nvcc_FLAGS) --maxrregcount=88 -o $@ -c $< - -quark/cuda_quark_compactionTest.o: quark/cuda_quark_compactionTest.cu - $(NVCC) $(nvcc_FLAGS) --maxrregcount=80 -o $@ -c $< - -JHA/cuda_jha_compactionTest.o: JHA/cuda_jha_compactionTest.cu - $(NVCC) $(nvcc_FLAGS) --maxrregcount=80 -o $@ -c $< - -# This object does not use cuda device code but call the different kernels (autotune) -scrypt/salsa_kernel.o: scrypt/salsa_kernel.cu - $(NVCC) $(JANSSON_INCLUDES) -I. @CUDA_INCLUDES@ @CUDA_CFLAGS@ -gencode=arch=compute_30,code=\"sm_30,compute_30\" -o $@ -c $< - -# These kernels are for older devices (SM) - -scrypt/test_kernel.o: scrypt/test_kernel.cu - $(NVCC) $(JANSSON_INCLUDES) -I. @CUDA_INCLUDES@ @CUDA_CFLAGS@ -gencode=arch=compute_30,code=\"sm_30,compute_30\" -o $@ -c $< - -scrypt/fermi_kernel.o: scrypt/fermi_kernel.cu - $(NVCC) $(JANSSON_INCLUDES) -I. @CUDA_INCLUDES@ @CUDA_CFLAGS@ -gencode=arch=compute_30,code=\"sm_30,compute_30\" -o $@ -c $< - -scrypt/kepler_kernel.o: scrypt/kepler_kernel.cu - $(NVCC) $(JANSSON_INCLUDES) -I. @CUDA_INCLUDES@ @CUDA_CFLAGS@ -gencode=arch=compute_30,code=\"sm_30,compute_30\" -o $@ -c $< - -scrypt/nv_kernel.o: scrypt/nv_kernel.cu - $(NVCC) $(JANSSON_INCLUDES) -I. @CUDA_INCLUDES@ @CUDA_CFLAGS@ -gencode=arch=compute_30,code=\"sm_30,compute_30\" -o $@ -c $< - -scrypt/titan_kernel.o: scrypt/titan_kernel.cu - $(NVCC) $(nvcc_FLAGS) -gencode=arch=compute_35,code=\"sm_35,compute_35\" -o $@ -c $< -skein.o: skein.cu - $(NVCC) $(nvcc_FLAGS) --maxrregcount=64 -o $@ -c $< diff --git a/bignum.cpp b/bignum.cpp index fe4cc3452f..19496eadc2 100644 --- a/bignum.cpp +++ b/bignum.cpp @@ -15,47 +15,6 @@ #include "miner.h" // hex2bin -extern "C" double bn_convert_nbits(const uint32_t nBits) -{ - uint256 bn = CBigNum().SetCompact(nBits).getuint256(); - return bn.getdouble(); -} - -// copy the big number to 32-bytes uchar -extern "C" void bn_nbits_to_uchar(const uint32_t nBits, unsigned char *target) -{ - char buff[65]; - uint256 bn = CBigNum().SetCompact(nBits).getuint256(); - - snprintf(buff, 65, "%s\n", bn.ToString().c_str()); buff[64] = '\0'; - hex2bin(target, buff, 32); -} - -// unused, but should allow more than 256bits targets -#if 0 -extern "C" double bn_hash_target_ratio(uint32_t* hash, uint32_t* target) -{ - double dhash; - - if (!opt_showdiff) - return 0.0; - - CBigNum h(0), t(0); - std::vector vch(32); - - memcpy(&vch[0], (void*) target, 32); - t.setvch(vch); - memcpy(&vch[0], (void*) hash, 32); - h.setvch(vch); - - dhash = h.getuint256().getdouble(); - if (dhash > 0.) - return t.getuint256().getdouble() / dhash; - else - return dhash; -} -#endif - // compute the diff ratio between a found hash and the target extern "C" double bn_hash_target_ratio(uint32_t* hash, uint32_t* target) { diff --git a/bignum.hpp b/bignum.hpp index 414b6cb54c..c60bc7c4fa 100644 --- a/bignum.hpp +++ b/bignum.hpp @@ -2,6 +2,7 @@ // Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. + #ifndef BITCOIN_BIGNUM_H #define BITCOIN_BIGNUM_H @@ -102,14 +103,14 @@ class CBigNum CBigNum(signed char n) { init(); if (n >= 0) setulong(n); else setint64(n); } CBigNum(short n) { init(); if (n >= 0) setulong(n); else setint64(n); } CBigNum(int n) { init(); if (n >= 0) setulong(n); else setint64(n); } - CBigNum(long n) { init(); if (n >= 0) setulong(n); else setint64(n); } - CBigNum(int64 n) { init(); setint64(n); } +// CBigNum(long n) { init(); if (n >= 0) setulong(n); else setint64(n); } +// CBigNum(int64_t n) { init(); setint64(n); } CBigNum(unsigned char n) { init(); setulong(n); } CBigNum(unsigned short n) { init(); setulong(n); } CBigNum(unsigned int n) { init(); setulong(n); } - CBigNum(unsigned long n) { init(); setulong(n); } - CBigNum(uint64 n) { init(); setuint64(n); } - explicit CBigNum(uint256 n) { init(); setuint256(n); } +// CBigNum(unsigned long n) { init(); setulong(n); } +// CBigNum(uint64_t n) { init(); setuint64(n); } + //explicit CBigNum(uint256_t n) { init(); setuint256(n); } explicit CBigNum(const std::vector& vch) { @@ -142,14 +143,14 @@ class CBigNum return (n > (unsigned long)std::numeric_limits::max() ? std::numeric_limits::min() : -(int)n); } - void setint64(int64 sn) + void setint64(int64_t sn) { unsigned char pch[sizeof(sn) + 6]; unsigned char* p = pch + 4; bool fNegative; - uint64 n; + uint64_t n; - if (sn < (int64)0) + if (sn < (int64_t)0) { // Since the minimum signed integer cannot be represented as positive so long as its type is signed, and it's not well-defined what happens if you make it unsigned before negating it, we instead increment the negative integer by 1, convert it, then increment the (now positive) unsigned integer by 1 to compensate n = -(sn + 1); @@ -185,7 +186,7 @@ class CBigNum BN_mpi2bn(pch, p - pch, self); } - uint64 getuint64() + uint64_t getuint64() { unsigned int nSize = BN_bn2mpi(self, NULL); if (nSize < 4) @@ -194,13 +195,13 @@ class CBigNum BN_bn2mpi(self, &vch[0]); if (vch.size() > 4) vch[4] &= 0x7f; - uint64 n = 0; + uint64_t n = 0; for (unsigned int i = 0, j = vch.size()-1; i < sizeof(n) && j >= 4; i++, j--) ((unsigned char*)&n)[i] = vch[j]; return n; } - void setuint64(uint64 n) + void setuint64(uint64_t n) { unsigned char pch[sizeof(n) + 6]; unsigned char* p = pch + 4; @@ -227,7 +228,7 @@ class CBigNum BN_mpi2bn(pch, p - pch, self); } - void setuint256(uint256 n) + /* void setuint256(uint256 n) { unsigned char pch[sizeof(n) + 6]; unsigned char* p = pch + 4; @@ -268,7 +269,7 @@ class CBigNum for (unsigned int i = 0, j = vch.size()-1; i < sizeof(n) && j >= 4; i++, j--) ((unsigned char*)&n)[i] = vch[j]; return n; - } + }*/ void setvch(const std::vector& vch) diff --git a/ccminer.cpp b/ccminer.cpp index fe47c92a69..4a845a6774 100644 --- a/ccminer.cpp +++ b/ccminer.cpp @@ -42,11 +42,11 @@ #include "miner.h" #include "algos.h" -#include "sia/sia-rpc.h" -#include "crypto/xmr-rpc.h" +//#include "sia/sia-rpc.h" +//#include "crypto/xmr-rpc.h" #include "equi/equihash.h" -#include +//#include #ifdef WIN32 #include @@ -251,7 +251,7 @@ Options:\n\ c11/flax X11 variant\n\ decred Decred Blake256\n\ deep Deepcoin\n\ - equihash Zcash Equihash\n\ + verus Veruscoin\n\ dmd-gr Diamond-Groestl\n\ fresh Freshcoin (shavite 80)\n\ fugue256 Fuguecoin\n\ @@ -604,7 +604,7 @@ void proper_exit(int reason) abort_flag = true; usleep(200 * 1000); - cuda_shutdown(); + if (reason == EXIT_CODE_OK && app_exit_code != EXIT_CODE_OK) { reason = app_exit_code; @@ -719,8 +719,7 @@ static bool work_decode(const json_t *val, struct work *work) break; case ALGO_CRYPTOLIGHT: case ALGO_CRYPTONIGHT: - case ALGO_WILDKECCAK: - return rpc2_job_decode(val, work); + default: data_size = 128; adata_sz = data_size / 4; @@ -901,16 +900,7 @@ static bool submit_upstream_work(CURL *curl, struct work *work) bool stale_work = false; int idnonce = work->submit_nonce_id; - if (pool->type & POOL_STRATUM && stratum.rpc2) { - struct work submit_work; - memcpy(&submit_work, work, sizeof(struct work)); - if (!hashlog_already_submittted(submit_work.job_id, submit_work.nonces[idnonce])) { - if (rpc2_stratum_submit(pool, &submit_work)) - hashlog_remember_submit(&submit_work, submit_work.nonces[idnonce]); - stratum.job.shares_count++; - } - return true; - } + if (pool->type & POOL_STRATUM && stratum.is_equihash) { struct work submit_work; @@ -1089,9 +1079,7 @@ static bool submit_upstream_work(CURL *curl, struct work *work) else if (opt_algo == ALGO_PHI2 && use_roots) { data_size = 144; adata_sz = 36; } - else if (opt_algo == ALGO_SIA) { - return sia_submit(curl, pool, work); - } + if (opt_algo != ALGO_HEAVY && opt_algo != ALGO_MJOLLNIR) { for (int i = 0; i < adata_sz; i++) @@ -1267,18 +1255,7 @@ static bool get_upstream_work(CURL *curl, struct work *work) gettimeofday(&tv_start, NULL); - if (opt_algo == ALGO_SIA) { - char *sia_header = sia_getheader(curl, pool); - if (sia_header) { - rc = sia_work_decode(sia_header, work); - free(sia_header); - } - gettimeofday(&tv_end, NULL); - if (have_stratum || unlikely(work->pooln != cur_pooln)) { - return rc; - } - return rc; - } + if (opt_debug_threads) applog(LOG_DEBUG, "%s: want_longpoll=%d have_longpoll=%d", @@ -1444,11 +1421,9 @@ static void *workio_thread(void *userdata) ok = workio_get_work(wc, curl); break; case WC_SUBMIT_WORK: - if (opt_led_mode == LED_MODE_SHARES) - gpu_led_on(device_map[wc->thr->id]); + ok = workio_submit_work(wc, curl); - if (opt_led_mode == LED_MODE_SHARES) - gpu_led_off(device_map[wc->thr->id]); + break; case WC_ABORT: default: /* should never happen */ @@ -1554,8 +1529,7 @@ static bool stratum_gen_work(struct stratum_ctx *sctx, struct work *work) uchar merkle_root[64] = { 0 }; int i; - if (sctx->rpc2) - return rpc2_stratum_gen_work(sctx, work); + if (!sctx->job.job_id) { // applog(LOG_WARNING, "stratum_gen_work: job not yet retrieved"); @@ -1597,7 +1571,7 @@ static bool stratum_gen_work(struct stratum_ctx *sctx, struct work *work) break; case ALGO_WHIRLPOOL: default: - sha256d(merkle_root, sctx->job.coinbase, (int)sctx->job.coinbase_size); + SHA256((uchar*)sctx->job.coinbase, sctx->job.coinbase_size, (uchar*)merkle_root); } for (i = 0; i < sctx->job.merkle_count; i++) { @@ -1607,7 +1581,7 @@ static bool stratum_gen_work(struct stratum_ctx *sctx, struct work *work) heavycoin_hash(merkle_root, merkle_root, 64); else #endif - sha256d(merkle_root, merkle_root, 64); + } /* Increment extranonce2 */ @@ -1897,7 +1871,7 @@ static void *miner_thread(void *userdata) } } - gpu_led_off(dev_id); + while (!abort_flag) { struct timeval tv_start, tv_end, diff; @@ -2112,25 +2086,17 @@ static void *miner_thread(void *userdata) gpulog(LOG_DEBUG, thr_id, "no data"); continue; } - if (opt_algo == ALGO_WILDKECCAK && !scratchpad_size) { - sleep(1); - if (!thr_id) pools[cur_pooln].wait_time += 1; - continue; - } + /* conditional mining */ if (!wanna_mine(thr_id)) { // reset default mem offset before idle.. -#if defined(WIN32) && defined(USE_WRAPNVML) - if (need_memclockrst) nvapi_toggle_clocks(thr_id, false); -#else - if (need_nvsettings) nvs_reset_clocks(dev_id); -#endif + // free gpu resources algo_free_all(thr_id); // clear any free error (algo switch) - cuda_clear_lasterror(); + //cuda_clear_lasterror(); // conditional pool switch if (num_pools > 1 && conditional_pool_rotate) { @@ -2153,11 +2119,7 @@ static void *miner_thread(void *userdata) continue; } else { // reapply mem offset if needed -#if defined(WIN32) && defined(USE_WRAPNVML) - if (need_memclockrst) nvapi_toggle_clocks(thr_id, true); -#else - if (need_nvsettings) nvs_set_clocks(dev_id); -#endif + } pool_on_hold = false; @@ -2339,8 +2301,6 @@ static void *miner_thread(void *userdata) gpulog(LOG_DEBUG, thr_id, "start=%08x end=%08x range=%08x", start_nonce, max_nonce, (max_nonce-start_nonce)); - if (opt_led_mode == LED_MODE_MINING) - gpu_led_on(dev_id); if (cgpu && loopcnt > 1) { cgpu->monitor.sampling_flag = true; @@ -2351,234 +2311,27 @@ static void *miner_thread(void *userdata) gettimeofday(&tv_start, NULL); // check (and reset) previous errors - cudaError_t err = cudaGetLastError(); - if (err != cudaSuccess && !opt_quiet) - gpulog(LOG_WARNING, thr_id, "%s", cudaGetErrorString(err)); + // cudaError_t err = cudaGetLastError(); + //if (err != cudaSuccess && !opt_quiet) + // gpulog(LOG_WARNING, thr_id, "%s", cudaGetErrorString(err)); work.valid_nonces = 0; /* scan nonces for a proof-of-work hash */ switch (opt_algo) { - case ALGO_ALLIUM: - rc = scanhash_allium(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_BASTION: - rc = scanhash_bastion(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_BLAKECOIN: - rc = scanhash_blake256(thr_id, &work, max_nonce, &hashes_done, 8); - break; - case ALGO_BLAKE: - rc = scanhash_blake256(thr_id, &work, max_nonce, &hashes_done, 14); - break; - case ALGO_BLAKE2S: - rc = scanhash_blake2s(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_BMW: - rc = scanhash_bmw(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_C11: - rc = scanhash_c11(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_CRYPTOLIGHT: - rc = scanhash_cryptolight(thr_id, &work, max_nonce, &hashes_done, 1); - break; - case ALGO_CRYPTONIGHT: - { - int cn_variant = 0; - if (cryptonight_fork > 1 && ((unsigned char*)work.data)[0] >= cryptonight_fork) - cn_variant = ((unsigned char*)work.data)[0] - cryptonight_fork + 1; - rc = scanhash_cryptonight(thr_id, &work, max_nonce, &hashes_done, cn_variant); - break; - } - case ALGO_DECRED: - rc = scanhash_decred(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_DEEP: - rc = scanhash_deep(thr_id, &work, max_nonce, &hashes_done); - break; + case ALGO_EQUIHASH: rc = scanhash_verus(thr_id, &work, max_nonce, &hashes_done); break; - case ALGO_FRESH: - rc = scanhash_fresh(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_FUGUE256: - rc = scanhash_fugue256(thr_id, &work, max_nonce, &hashes_done); - break; - - case ALGO_GROESTL: - case ALGO_DMD_GR: - rc = scanhash_groestlcoin(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_MYR_GR: - rc = scanhash_myriad(thr_id, &work, max_nonce, &hashes_done); - break; - - case ALGO_HMQ1725: - rc = scanhash_hmq17(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_HSR: - rc = scanhash_hsr(thr_id, &work, max_nonce, &hashes_done); - break; -#ifdef WITH_HEAVY_ALGO - case ALGO_HEAVY: - rc = scanhash_heavy(thr_id, &work, max_nonce, &hashes_done, work.maxvote, HEAVYCOIN_BLKHDR_SZ); - break; - case ALGO_MJOLLNIR: - rc = scanhash_heavy(thr_id, &work, max_nonce, &hashes_done, 0, MNR_BLKHDR_SZ); - break; -#endif - case ALGO_KECCAK: - case ALGO_KECCAKC: - rc = scanhash_keccak256(thr_id, &work, max_nonce, &hashes_done); - break; - - case ALGO_JACKPOT: - rc = scanhash_jackpot(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_JHA: - rc = scanhash_jha(thr_id, &work, max_nonce, &hashes_done); - break; - - case ALGO_LBRY: - rc = scanhash_lbry(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_LUFFA: - rc = scanhash_luffa(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_QUARK: - rc = scanhash_quark(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_QUBIT: - rc = scanhash_qubit(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_LYRA2: - rc = scanhash_lyra2(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_LYRA2v2: - rc = scanhash_lyra2v2(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_LYRA2Z: - rc = scanhash_lyra2Z(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_NEOSCRYPT: - rc = scanhash_neoscrypt(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_NIST5: - rc = scanhash_nist5(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_PENTABLAKE: - rc = scanhash_pentablake(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_PHI: - rc = scanhash_phi(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_PHI2: - rc = scanhash_phi2(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_POLYTIMOS: - rc = scanhash_polytimos(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_SCRYPT: - rc = scanhash_scrypt(thr_id, &work, max_nonce, &hashes_done, - NULL, &tv_start, &tv_end); - break; - case ALGO_SCRYPT_JANE: - rc = scanhash_scrypt_jane(thr_id, &work, max_nonce, &hashes_done, - NULL, &tv_start, &tv_end); - break; - case ALGO_SKEIN: - rc = scanhash_skeincoin(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_SKEIN2: - rc = scanhash_skein2(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_SKUNK: - rc = scanhash_skunk(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; - case ALGO_SIA: - rc = scanhash_sia(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_SIB: - rc = scanhash_sib(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_SONOA: - rc = scanhash_sonoa(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_S3: - rc = scanhash_s3(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_VANILLA: - rc = scanhash_vanilla(thr_id, &work, max_nonce, &hashes_done, 8); - break; - case ALGO_VELTOR: - rc = scanhash_veltor(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_WHIRLCOIN: - case ALGO_WHIRLPOOL: - rc = scanhash_whirl(thr_id, &work, max_nonce, &hashes_done); - break; - //case ALGO_WHIRLPOOLX: - // rc = scanhash_whirlx(thr_id, &work, max_nonce, &hashes_done); - // break; - case ALGO_WILDKECCAK: - rc = scanhash_wildkeccak(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_TIMETRAVEL: - rc = scanhash_timetravel(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_TRIBUS: - rc = scanhash_tribus(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_BITCORE: - rc = scanhash_bitcore(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_X11EVO: - rc = scanhash_x11evo(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_X11: - rc = scanhash_x11(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_X12: - rc = scanhash_x12(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_X13: - rc = scanhash_x13(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_X14: - rc = scanhash_x14(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_X15: - rc = scanhash_x15(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_X16R: - rc = scanhash_x16r(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_X16S: - rc = scanhash_x16s(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_X17: - rc = scanhash_x17(thr_id, &work, max_nonce, &hashes_done); - break; - case ALGO_ZR5: - rc = scanhash_zr5(thr_id, &work, max_nonce, &hashes_done); - break; + default: /* should never happen */ goto out; } - if (opt_led_mode == LED_MODE_MINING) - gpu_led_off(dev_id); + if (abort_flag) break; // time to leave the mining loop... @@ -2599,12 +2352,6 @@ static void *miner_thread(void *userdata) work.nonces[1] = nonceptr[2]; } - if (stratum.rpc2 && (rc == -EBUSY || work_restart[thr_id].restart)) { - // bbr scratchpad download or stale result - sleep(1); - if (!thr_id) pools[cur_pooln].wait_time += 1; - continue; - } if (rc > 0 && opt_debug) applog(LOG_NOTICE, CL_CYN "found => %08x" CL_GRN " %08x", work.nonces[0], swab32(work.nonces[0])); @@ -2663,6 +2410,7 @@ static void *miner_thread(void *userdata) /* output */ if (!opt_quiet && loopcnt > 1 && (time(NULL) - tm_rate_log) > opt_maxlograte) { format_hashrate(thr_hashrates[thr_id], s); + if(thr_hashrates[thr_id]>0) gpulog(LOG_INFO, thr_id, "%s, %s", device_name[dev_id], s); tm_rate_log = time(NULL); } @@ -2695,8 +2443,7 @@ static void *miner_thread(void *userdata) if (rc > 0 && !opt_benchmark) { uint32_t curnonce = nonceptr[0]; // current scan position - if (opt_led_mode == LED_MODE_SHARES) - gpu_led_percent(dev_id, 50); + work.submit_nonce_id = 0; nonceptr[0] = work.nonces[0]; @@ -2731,8 +2478,7 @@ static void *miner_thread(void *userdata) } out: - if (opt_led_mode) - gpu_led_off(dev_id); + if (opt_debug_threads) applog(LOG_DEBUG, "%s() died", __func__); tq_freeze(mythr->q); @@ -2814,18 +2560,7 @@ static void *longpoll_thread(void *userdata) if (switchn != pool_switch_count) goto need_reinit; - if (opt_algo == ALGO_SIA) { - char *sia_header = sia_getheader(curl, pool); - if (sia_header) { - pthread_mutex_lock(&g_work_lock); - if (sia_work_decode(sia_header, &g_work)) { - g_work_time = time(NULL); - } - free(sia_header); - pthread_mutex_unlock(&g_work_lock); - } - continue; - } + val = json_rpc_longpoll(curl, lp_url, pool, rpc_req, &err); if (have_stratum || switchn != pool_switch_count) { @@ -2928,20 +2663,12 @@ static bool stratum_handle_response(char *buf) // store time required to the pool to answer to a submit stratum.answer_msec = (1000 * diff.tv_sec) + (uint32_t) (0.001 * diff.tv_usec); - if (stratum.rpc2) { - const char* reject_reason = err_val ? json_string_value(json_object_get(err_val, "message")) : NULL; - // {"id":10,"jsonrpc":"2.0","error":null,"result":{"status":"OK"}} - share_result(json_is_null(err_val), stratum.pooln, sharediff, reject_reason); - if (reject_reason) { - g_work_time = 0; - restart_threads(); - } - } else { + if (!res_val) goto out; share_result(json_is_true(res_val), stratum.pooln, sharediff, err_val ? json_string_value(json_array_get(err_val, 1)) : NULL); - } + ret = true; out: @@ -3017,10 +2744,7 @@ static void *stratum_thread(void *userdata) } } - if (stratum.rpc2) { - rpc2_stratum_thread_stuff(pool); - } - + if (switchn != pool_switch_count) goto pool_switched; if (stratum.job.job_id && @@ -3254,7 +2978,7 @@ void parse_arg(int key, char *arg) break; } case 'k': - opt_scratchpad_url = strdup(arg); + //jim break; case 'i': d = atof(arg); @@ -3263,7 +2987,7 @@ void parse_arg(int key, char *arg) show_usage_and_exit(1); { int n = 0; - int ngpus = cuda_num_devices(); + int ngpus = 1; uint32_t last = 0; char * pch = strtok(arg,","); while (pch != NULL) { @@ -3299,15 +3023,7 @@ void parse_arg(int key, char *arg) break; case 'n': /* --ndevs */ // to get gpu vendors... - #ifdef USE_WRAPNVML - hnvml = nvml_create(); - #ifdef WIN32 - nvapi_init(); - cuda_devicenames(); // req for leds - nvapi_init_settings(); - #endif - #endif - cuda_print_devices(); + proper_exit(EXIT_CODE_OK); break; case 'q': @@ -3579,8 +3295,7 @@ void parse_arg(int key, char *arg) break; case 1080: /* --led */ { - if (!opt_led_mode) - opt_led_mode = LED_MODE_SHARES; + char *pch = strtok(arg,","); int n = 0, lastval, val; while (pch != NULL && n < MAX_GPUS) { @@ -3588,7 +3303,7 @@ void parse_arg(int key, char *arg) char * p = strstr(pch, "0x"); val = p ? (int32_t) strtoul(p, NULL, 16) : atoi(pch); if (!val && !strcmp(pch, "mining")) - opt_led_mode = LED_MODE_MINING; + opt_led_mode = 1; else if (device_led[dev_id] == -1) device_led[dev_id] = lastval = val; pch = strtok(NULL, ","); @@ -3605,7 +3320,7 @@ void parse_arg(int key, char *arg) have_stratum = false; break; case 1006: - print_hash_tests(); + proper_exit(EXIT_CODE_OK); break; case 1003: @@ -3703,7 +3418,7 @@ void parse_arg(int key, char *arg) case 'd': // --device { int device_thr[MAX_GPUS] = { 0 }; - int ngpus = cuda_num_devices(); + int ngpus = 1; char* pch = strtok(arg,","); opt_n_threads = 0; while (pch != NULL && opt_n_threads < MAX_GPUS) { @@ -3716,7 +3431,7 @@ void parse_arg(int key, char *arg) proper_exit(EXIT_CODE_CUDA_NODEVICE); } } else { - int device = cuda_finddevice(pch); + int device = 1; if (device >= 0 && device < ngpus) device_map[opt_n_threads++] = device; else { @@ -3948,18 +3663,14 @@ int main(int argc, char *argv[]) // get opt_quiet early parse_single_opt('q', argc, argv); - printf("*** ccminer " PACKAGE_VERSION " for nVidia GPUs by tpruvot@github ***\n"); + printf("*** ccminer " PACKAGE_VERSION " for CPU's by Monkins1010 based on ccminer***\n"); if (!opt_quiet) { const char* arch = is_x64() ? "64-bits" : "32-bits"; -#ifdef _MSC_VER - printf(" Built with VC++ %d and nVidia CUDA SDK %d.%d %s\n\n", msver(), -#else - printf(" Built with the nVidia CUDA Toolkit %d.%d %s\n\n", -#endif - CUDART_VERSION/1000, (CUDART_VERSION % 1000)/10, arch); + + printf(" Built with Sweat and tears :-)" ); printf(" Originally based on Christian Buchner and Christian H. project\n"); - printf(" Include some kernels from alexis78, djm34, djEzo, tsiv and krnlx.\n\n"); printf("BTC donation address: 1AJdfCpLWPNoAMDfHF1wD5y8VgKSSTHxPo (tpruvot)\n\n"); + printf("Verus donation address: REoPcdGXthL5yeTCrJtrQv5xhYTknbFbec (monkins)\n"); } rpc_user = strdup(""); @@ -3991,7 +3702,7 @@ int main(int argc, char *argv[]) num_cpus = 1; // number of gpus - active_gpus = cuda_num_devices(); + active_gpus = 1; for (i = 0; i < MAX_GPUS; i++) { device_map[i] = i % active_gpus; @@ -4008,7 +3719,7 @@ int main(int argc, char *argv[]) device_led[i] = -1; } - cuda_devicenames(); + /* parse command line */ parse_cmdline(argc, argv); @@ -4054,16 +3765,7 @@ int main(int argc, char *argv[]) opt_extranonce = false; // disable subscribe } - if (opt_algo == ALGO_CRYPTONIGHT || opt_algo == ALGO_CRYPTOLIGHT) { - rpc2_init(); - if (!opt_quiet) applog(LOG_INFO, "Using JSON-RPC 2.0"); - } - if (opt_algo == ALGO_WILDKECCAK) { - rpc2_init(); - if (!opt_quiet) applog(LOG_INFO, "Using JSON-RPC 2.0"); - GetScratchpad(); - } flags = !opt_benchmark && strncmp(rpc_url, "https:", 6) ? (CURL_GLOBAL_ALL & ~CURL_GLOBAL_SSL) @@ -4213,55 +3915,7 @@ int main(int argc, char *argv[]) tq_push(thr_info[stratum_thr_id].q, strdup(rpc_url)); } -#ifdef __linux__ - if (need_nvsettings) { - if (nvs_init() < 0) - need_nvsettings = false; - } -#endif - -#ifdef USE_WRAPNVML -#if defined(__linux__) || defined(_WIN64) - /* nvml is currently not the best choice on Windows (only in x64) */ - hnvml = nvml_create(); - if (hnvml) { - bool gpu_reinit = (opt_cudaschedule >= 0); //false - cuda_devicenames(); // refresh gpu vendor name - if (!opt_quiet) - applog(LOG_INFO, "NVML GPU monitoring enabled."); - for (int n=0; n < active_gpus; n++) { - if (nvml_set_pstate(hnvml, device_map[n]) == 1) - gpu_reinit = true; - if (nvml_set_plimit(hnvml, device_map[n]) == 1) - gpu_reinit = true; - if (!is_windows() && nvml_set_clocks(hnvml, device_map[n]) == 1) - gpu_reinit = true; - if (gpu_reinit) { - cuda_reset_device(n, NULL); - } - } - } -#endif -#ifdef WIN32 - if (nvapi_init() == 0) { - if (!opt_quiet) - applog(LOG_INFO, "NVAPI GPU monitoring enabled."); - if (!hnvml) { - cuda_devicenames(); // refresh gpu vendor name - } - nvapi_init_settings(); - } -#endif - else if (!hnvml && !opt_quiet) - applog(LOG_INFO, "GPU monitoring is not available."); - // force reinit to set default device flags - if (opt_cudaschedule >= 0 && !hnvml) { - for (int n=0; n < active_gpus; n++) { - cuda_reset_device(n, NULL); - } - } -#endif if (opt_api_port) { /* api thread */ diff --git a/util.cpp b/util.cpp index 94c0548538..6fc3c399b1 100644 --- a/util.cpp +++ b/util.cpp @@ -36,7 +36,7 @@ #include "miner.h" #include "elist.h" -#include "crypto/xmr-rpc.h" +//#include "crypto/xmr-rpc.h" extern pthread_mutex_t stratum_sock_lock; extern pthread_mutex_t stratum_work_lock; @@ -167,7 +167,7 @@ void gpulog(int prio, int thr_id, const char *fmt, ...) return; if (gpu_threads > 1) - len = snprintf(pfmt, 128, "GPU T%d: %s", thr_id, fmt); + len = snprintf(pfmt, 128, "CPU T%d: Verus Hashing", thr_id, fmt); else len = snprintf(pfmt, 128, "GPU #%d: %s", dev_id, fmt); pfmt[sizeof(pfmt)-1]='\0'; @@ -1320,8 +1320,7 @@ bool stratum_authorize(struct stratum_ctx *sctx, const char *user, const char *p json_error_t err; bool ret = false; - if (sctx->rpc2) - return rpc2_stratum_authorize(sctx, user, pass); + s = (char*)malloc(80 + strlen(user) + strlen(pass)); sprintf(s, "{\"id\": 2, \"method\": \"mining.authorize\", \"params\": [\"%s\", \"%s\"]}", @@ -1676,7 +1675,7 @@ static bool stratum_benchdata(json_t *result, json_t *params, int thr_id) char os[8]; uint32_t watts = 0, plimit = 0; int dev_id = device_map[thr_id]; - int cuda_ver = cuda_version(); + int cuda_ver = 100; struct cgpu_info *cgpu = &thr_info[thr_id].gpu; json_t *val; @@ -1688,28 +1687,14 @@ static bool stratum_benchdata(json_t *result, json_t *params, int thr_id) strcpy(os, is_windows() ? "win32" : "linux"); #endif - cuda_gpu_info(cgpu); -#ifdef USE_WRAPNVML - cgpu->has_monitoring = true; - if (cgpu->monitor.gpu_power) - cgpu->gpu_power = cgpu->monitor.gpu_power; - else - cgpu->gpu_power = gpu_power(cgpu); // mWatts - watts = (cgpu->gpu_power >= 1000) ? cgpu->gpu_power / 1000 : 0; // ignore nvapi % - plimit = device_plimit[dev_id] > 0 ? device_plimit[dev_id] : 0; - gpu_info(cgpu); // vid/pid -#endif + get_currentalgo(algo, sizeof(algo)); - card = device_name[dev_id]; + card = "CPU"; cgpu->khashes = stats_get_speed(thr_id, 0.0) / 1000.0; sprintf(vid, "%04hx:%04hx", cgpu->gpu_vid, cgpu->gpu_pid); sprintf(arch, "%d", (int) cgpu->gpu_arch); - if (cuda_arch[dev_id] > 0 && cuda_arch[dev_id] != cgpu->gpu_arch) { - // if binary was not compiled for the highest cuda arch, add it - snprintf(arch, 8, "%d@%d", (int) cgpu->gpu_arch, cuda_arch[dev_id]); - } snprintf(driver, 32, "CUDA %d.%d %s", cuda_ver/1000, (cuda_ver%1000) / 10, driver_version); driver[31] = '\0'; @@ -1902,10 +1887,7 @@ bool stratum_handle_method(struct stratum_ctx *sctx, const char *s) ret = stratum_show_message(sctx, id, params); goto out; } - if (sctx->rpc2 && !strcasecmp(method, "job")) { // xmr/bbr - ret = rpc2_stratum_job(sctx, id, params); - goto out; - } + if (!ret) { // don't fail = disconnect stratum on unknown (and optional?) methods @@ -2157,211 +2139,3 @@ void do_gpu_tests(void) #endif } -void print_hash_tests(void) -{ - uchar *scratchbuf = NULL; - char s[128] = {'\0'}; - uchar hash[128]; - uchar buf[192]; - - // work space for scratchpad based algos - scratchbuf = (uchar*)calloc(128, 1024); - memset(buf, 0, sizeof buf); - - // buf[0] = 1; buf[64] = 2; // for endian tests - - printf(CL_WHT "CPU HASH ON EMPTY BUFFER RESULTS:" CL_N "\n"); - - allium_hash(&hash[0], &buf[0]); - printpfx("allium", hash); - - bastionhash(&hash[0], &buf[0]); - printpfx("bastion", hash); - - blake256hash(&hash[0], &buf[0], 8); - printpfx("blakecoin", hash); - - blake256hash(&hash[0], &buf[0], 14); - printpfx("blake", hash); - - blake2s_hash(&hash[0], &buf[0]); - printpfx("blake2s", hash); - - bmw_hash(&hash[0], &buf[0]); - printpfx("bmw", hash); - - c11hash(&hash[0], &buf[0]); - printpfx("c11", hash); - - cryptolight_hash(&hash[0], &buf[0]); - printpfx("cryptolight", hash); - - cryptonight_hash(&hash[0], &buf[0]); - printpfx("cryptonight", hash); - - memset(buf, 0, 180); - decred_hash(&hash[0], &buf[0]); - printpfx("decred", hash); - - deephash(&hash[0], &buf[0]); - printpfx("deep", hash); - - fresh_hash(&hash[0], &buf[0]); - printpfx("fresh", hash); - - fugue256_hash(&hash[0], &buf[0], 32); - printpfx("fugue256", hash); - - groestlhash(&hash[0], &buf[0]); - printpfx("groestl", hash); - - heavycoin_hash(&hash[0], &buf[0], 32); - printpfx("heavy", hash); - - hmq17hash(&hash[0], &buf[0]); - printpfx("hmq1725", hash); - - hsr_hash(&hash[0], &buf[0]); - printpfx("hsr", hash); - - jha_hash(&hash[0], &buf[0]); - printpfx("jha", hash); - - keccak256_hash(&hash[0], &buf[0]); - printpfx("keccak", hash); - - memset(buf, 0, 128); - lbry_hash(&hash[0], &buf[0]); - printpfx("lbry", hash); - - luffa_hash(&hash[0], &buf[0]); - printpfx("luffa", hash); - - lyra2re_hash(&hash[0], &buf[0]); - printpfx("lyra2", hash); - - lyra2v2_hash(&hash[0], &buf[0]); - printpfx("lyra2v2", hash); - - lyra2Z_hash(&hash[0], &buf[0]); - printpfx("lyra2z", hash); - - monero_hash(&hash[0], &buf[0]); - printpfx("monero", hash); - - myriadhash(&hash[0], &buf[0]); - printpfx("myriad", hash); - - neoscrypt(&hash[0], &buf[0], 80000620); - printpfx("neoscrypt", hash); - - nist5hash(&hash[0], &buf[0]); - printpfx("nist5", hash); - - pentablakehash(&hash[0], &buf[0]); - printpfx("pentablake", hash); - - phi2_hash(&hash[0], &buf[0]); - printpfx("phi", hash); - - polytimos_hash(&hash[0], &buf[0]); - printpfx("polytimos", hash); - - quarkhash(&hash[0], &buf[0]); - printpfx("quark", hash); - - qubithash(&hash[0], &buf[0]); - printpfx("qubit", hash); - - scrypthash(&hash[0], &buf[0]); - printpfx("scrypt", hash); - - scryptjane_hash(&hash[0], &buf[0]); - printpfx("scrypt-jane", hash); - - sha256d_hash(&hash[0], &buf[0]); - printpfx("sha256d", hash); - - sha256t_hash(&hash[0], &buf[0]); - printpfx("sha256t", hash); - - blake2b_hash(&hash[0], &buf[0]); - printpfx("sia", hash); - - sibhash(&hash[0], &buf[0]); - printpfx("sib", hash); - - skeincoinhash(&hash[0], &buf[0]); - printpfx("skein", hash); - - skein2hash(&hash[0], &buf[0]); - printpfx("skein2", hash); - - skunk_hash(&hash[0], &buf[0]); - printpfx("skunk", hash); - - stellite_hash(&hash[0], &buf[0]); - printpfx("stelitte", hash); - - s3hash(&hash[0], &buf[0]); - printpfx("S3", hash); - - timetravel_hash(&hash[0], &buf[0]); - printpfx("timetravel", hash); - - bitcore_hash(&hash[0], &buf[0]); - printpfx("bitcore", hash); - - blake256hash(&hash[0], &buf[0], 8); - printpfx("vanilla", hash); - - tribus_hash(&hash[0], &buf[0]); - printpfx("tribus", hash); - - veltorhash(&hash[0], &buf[0]); - printpfx("veltor", hash); - - wcoinhash(&hash[0], &buf[0]); - printpfx("whirlpool", hash); - - //whirlxHash(&hash[0], &buf[0]); - //printpfx("whirlpoolx", hash); - - x11evo_hash(&hash[0], &buf[0]); - printpfx("x11evo", hash); - - x11hash(&hash[0], &buf[0]); - printpfx("x11", hash); - - x12hash(&hash[0], &buf[0]); - printpfx("x12", hash); - - x13hash(&hash[0], &buf[0]); - printpfx("x13", hash); - - x14hash(&hash[0], &buf[0]); - printpfx("x14", hash); - - x15hash(&hash[0], &buf[0]); - printpfx("x15", hash); - - x16r_hash(&hash[0], &buf[0]); - printpfx("x16r", hash); - - x16s_hash(&hash[0], &buf[0]); - printpfx("x16s", hash); - - x17hash(&hash[0], &buf[0]); - printpfx("x17", hash); - - //memcpy(buf, zrtest, 80); - zr5hash(&hash[0], &buf[0]); - //zr5hash_pok(&hash[0], (uint32_t*) &buf[0]); - printpfx("ZR5", hash); - - printf("\n"); - - do_gpu_tests(); - - free(scratchbuf); -}