|
|
@ -6,12 +6,12 @@ extern "C" |
|
|
|
#include "sph/sph_skein.h" |
|
|
|
#include "sph/sph_skein.h" |
|
|
|
#include "sph/sph_jh.h" |
|
|
|
#include "sph/sph_jh.h" |
|
|
|
#include "sph/sph_keccak.h" |
|
|
|
#include "sph/sph_keccak.h" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#include "miner.h" |
|
|
|
#include "miner.h" |
|
|
|
|
|
|
|
|
|
|
|
#include "cuda_helper.h" |
|
|
|
#include "cuda_helper.h" |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// aus cpu-miner.c |
|
|
|
|
|
|
|
extern int device_map[8]; |
|
|
|
extern int device_map[8]; |
|
|
|
|
|
|
|
|
|
|
|
// Speicher für Input/Output der verketteten Hashfunktionen |
|
|
|
// Speicher für Input/Output der verketteten Hashfunktionen |
|
|
@ -70,76 +70,64 @@ extern "C" void quarkhash(void *state, const void *input) |
|
|
|
unsigned char hash[64]; |
|
|
|
unsigned char hash[64]; |
|
|
|
|
|
|
|
|
|
|
|
sph_blake512_init(&ctx_blake); |
|
|
|
sph_blake512_init(&ctx_blake); |
|
|
|
// ZBLAKE; |
|
|
|
|
|
|
|
sph_blake512 (&ctx_blake, input, 80); |
|
|
|
sph_blake512 (&ctx_blake, input, 80); |
|
|
|
sph_blake512_close(&ctx_blake, (void*) hash); |
|
|
|
sph_blake512_close(&ctx_blake, (void*) hash); |
|
|
|
|
|
|
|
|
|
|
|
sph_bmw512_init(&ctx_bmw); |
|
|
|
sph_bmw512_init(&ctx_bmw); |
|
|
|
// ZBMW; |
|
|
|
|
|
|
|
sph_bmw512 (&ctx_bmw, (const void*) hash, 64); |
|
|
|
sph_bmw512 (&ctx_bmw, (const void*) hash, 64); |
|
|
|
sph_bmw512_close(&ctx_bmw, (void*) hash); |
|
|
|
sph_bmw512_close(&ctx_bmw, (void*) hash); |
|
|
|
|
|
|
|
|
|
|
|
if (hash[0] & 0x8) |
|
|
|
if (hash[0] & 0x8) |
|
|
|
{ |
|
|
|
{ |
|
|
|
sph_groestl512_init(&ctx_groestl); |
|
|
|
sph_groestl512_init(&ctx_groestl); |
|
|
|
// ZGROESTL; |
|
|
|
|
|
|
|
sph_groestl512 (&ctx_groestl, (const void*) hash, 64); |
|
|
|
sph_groestl512 (&ctx_groestl, (const void*) hash, 64); |
|
|
|
sph_groestl512_close(&ctx_groestl, (void*) hash); |
|
|
|
sph_groestl512_close(&ctx_groestl, (void*) hash); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
sph_skein512_init(&ctx_skein); |
|
|
|
sph_skein512_init(&ctx_skein); |
|
|
|
// ZSKEIN; |
|
|
|
|
|
|
|
sph_skein512 (&ctx_skein, (const void*) hash, 64); |
|
|
|
sph_skein512 (&ctx_skein, (const void*) hash, 64); |
|
|
|
sph_skein512_close(&ctx_skein, (void*) hash); |
|
|
|
sph_skein512_close(&ctx_skein, (void*) hash); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
sph_groestl512_init(&ctx_groestl); |
|
|
|
sph_groestl512_init(&ctx_groestl); |
|
|
|
// ZGROESTL; |
|
|
|
|
|
|
|
sph_groestl512 (&ctx_groestl, (const void*) hash, 64); |
|
|
|
sph_groestl512 (&ctx_groestl, (const void*) hash, 64); |
|
|
|
sph_groestl512_close(&ctx_groestl, (void*) hash); |
|
|
|
sph_groestl512_close(&ctx_groestl, (void*) hash); |
|
|
|
|
|
|
|
|
|
|
|
sph_jh512_init(&ctx_jh); |
|
|
|
sph_jh512_init(&ctx_jh); |
|
|
|
// ZJH; |
|
|
|
|
|
|
|
sph_jh512 (&ctx_jh, (const void*) hash, 64); |
|
|
|
sph_jh512 (&ctx_jh, (const void*) hash, 64); |
|
|
|
sph_jh512_close(&ctx_jh, (void*) hash); |
|
|
|
sph_jh512_close(&ctx_jh, (void*) hash); |
|
|
|
|
|
|
|
|
|
|
|
if (hash[0] & 0x8) |
|
|
|
if (hash[0] & 0x8) |
|
|
|
{ |
|
|
|
{ |
|
|
|
sph_blake512_init(&ctx_blake); |
|
|
|
sph_blake512_init(&ctx_blake); |
|
|
|
// ZBLAKE; |
|
|
|
|
|
|
|
sph_blake512 (&ctx_blake, (const void*) hash, 64); |
|
|
|
sph_blake512 (&ctx_blake, (const void*) hash, 64); |
|
|
|
sph_blake512_close(&ctx_blake, (void*) hash); |
|
|
|
sph_blake512_close(&ctx_blake, (void*) hash); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
sph_bmw512_init(&ctx_bmw); |
|
|
|
sph_bmw512_init(&ctx_bmw); |
|
|
|
// ZBMW; |
|
|
|
|
|
|
|
sph_bmw512 (&ctx_bmw, (const void*) hash, 64); |
|
|
|
sph_bmw512 (&ctx_bmw, (const void*) hash, 64); |
|
|
|
sph_bmw512_close(&ctx_bmw, (void*) hash); |
|
|
|
sph_bmw512_close(&ctx_bmw, (void*) hash); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
sph_keccak512_init(&ctx_keccak); |
|
|
|
sph_keccak512_init(&ctx_keccak); |
|
|
|
// ZKECCAK; |
|
|
|
|
|
|
|
sph_keccak512 (&ctx_keccak, (const void*) hash, 64); |
|
|
|
sph_keccak512 (&ctx_keccak, (const void*) hash, 64); |
|
|
|
sph_keccak512_close(&ctx_keccak, (void*) hash); |
|
|
|
sph_keccak512_close(&ctx_keccak, (void*) hash); |
|
|
|
|
|
|
|
|
|
|
|
sph_skein512_init(&ctx_skein); |
|
|
|
sph_skein512_init(&ctx_skein); |
|
|
|
// SKEIN; |
|
|
|
|
|
|
|
sph_skein512 (&ctx_skein, (const void*) hash, 64); |
|
|
|
sph_skein512 (&ctx_skein, (const void*) hash, 64); |
|
|
|
sph_skein512_close(&ctx_skein, (void*) hash); |
|
|
|
sph_skein512_close(&ctx_skein, (void*) hash); |
|
|
|
|
|
|
|
|
|
|
|
if (hash[0] & 0x8) |
|
|
|
if (hash[0] & 0x8) |
|
|
|
{ |
|
|
|
{ |
|
|
|
sph_keccak512_init(&ctx_keccak); |
|
|
|
sph_keccak512_init(&ctx_keccak); |
|
|
|
// ZKECCAK; |
|
|
|
|
|
|
|
sph_keccak512 (&ctx_keccak, (const void*) hash, 64); |
|
|
|
sph_keccak512 (&ctx_keccak, (const void*) hash, 64); |
|
|
|
sph_keccak512_close(&ctx_keccak, (void*) hash); |
|
|
|
sph_keccak512_close(&ctx_keccak, (void*) hash); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
sph_jh512_init(&ctx_jh); |
|
|
|
sph_jh512_init(&ctx_jh); |
|
|
|
// ZJH; |
|
|
|
|
|
|
|
sph_jh512 (&ctx_jh, (const void*) hash, 64); |
|
|
|
sph_jh512 (&ctx_jh, (const void*) hash, 64); |
|
|
|
sph_jh512_close(&ctx_jh, (void*) hash); |
|
|
|
sph_jh512_close(&ctx_jh, (void*) hash); |
|
|
|
} |
|
|
|
} |
|
|
@ -147,23 +135,17 @@ extern "C" void quarkhash(void *state, const void *input) |
|
|
|
memcpy(state, hash, 32); |
|
|
|
memcpy(state, hash, 32); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern bool opt_benchmark; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" int scanhash_quark(int thr_id, uint32_t *pdata, |
|
|
|
extern "C" int scanhash_quark(int thr_id, uint32_t *pdata, |
|
|
|
const uint32_t *ptarget, uint32_t max_nonce, |
|
|
|
const uint32_t *ptarget, uint32_t max_nonce, |
|
|
|
unsigned long *hashes_done) |
|
|
|
unsigned long *hashes_done) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const uint32_t first_nonce = pdata[19]; |
|
|
|
const uint32_t first_nonce = pdata[19]; |
|
|
|
|
|
|
|
const int throughput = 256*4096; // 100; |
|
|
|
|
|
|
|
static bool init[8] = {0,0,0,0,0,0,0,0}; |
|
|
|
|
|
|
|
|
|
|
|
if (opt_benchmark) |
|
|
|
if (opt_benchmark) |
|
|
|
((uint32_t*)ptarget)[7] = 0x0000ff; |
|
|
|
((uint32_t*)ptarget)[7] = 0x00FF; |
|
|
|
|
|
|
|
|
|
|
|
const uint32_t Htarg = ptarget[7]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const int throughput = 256*4096; // 100; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static bool init[8] = {0,0,0,0,0,0,0,0}; |
|
|
|
|
|
|
|
if (!init[thr_id]) |
|
|
|
if (!init[thr_id]) |
|
|
|
{ |
|
|
|
{ |
|
|
|
cudaSetDevice(device_map[thr_id]); |
|
|
|
cudaSetDevice(device_map[thr_id]); |
|
|
@ -252,11 +234,12 @@ extern "C" int scanhash_quark(int thr_id, uint32_t *pdata, |
|
|
|
uint32_t foundNonce = cuda_check_cpu_hash_64(thr_id, nrm3, pdata[19], d_branch3Nonces[thr_id], d_hash[thr_id], order++); |
|
|
|
uint32_t foundNonce = cuda_check_cpu_hash_64(thr_id, nrm3, pdata[19], d_branch3Nonces[thr_id], d_hash[thr_id], order++); |
|
|
|
if (foundNonce != 0xffffffff) |
|
|
|
if (foundNonce != 0xffffffff) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
const uint32_t Htarg = ptarget[7]; |
|
|
|
uint32_t vhash64[8]; |
|
|
|
uint32_t vhash64[8]; |
|
|
|
be32enc(&endiandata[19], foundNonce); |
|
|
|
be32enc(&endiandata[19], foundNonce); |
|
|
|
quarkhash(vhash64, endiandata); |
|
|
|
quarkhash(vhash64, endiandata); |
|
|
|
|
|
|
|
|
|
|
|
if ((vhash64[7]<=Htarg) && fulltest(vhash64, ptarget)) { |
|
|
|
if (vhash64[7] <= Htarg && fulltest(vhash64, ptarget)) { |
|
|
|
|
|
|
|
|
|
|
|
pdata[19] = foundNonce; |
|
|
|
pdata[19] = foundNonce; |
|
|
|
*hashes_done = (foundNonce - first_nonce + 1)/2; |
|
|
|
*hashes_done = (foundNonce - first_nonce + 1)/2; |
|
|
|