From 8e32e5ea09617cef106a15b1e8beab3bdfa0038f Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Thu, 14 Aug 2014 19:49:31 +0200 Subject: [PATCH] cputest: add other hashes to cpu tests --- JHA/jackpotcoin.cu | 2 +- groestlcoin.cpp | 2 +- miner.h | 10 ++++++---- myriadgroestl.cpp | 2 +- quark/quarkcoin.cu | 2 +- util.c | 40 +++++++++++++++++++++++++++++++++------- 6 files changed, 43 insertions(+), 15 deletions(-) diff --git a/JHA/jackpotcoin.cu b/JHA/jackpotcoin.cu index 7d6d4cf..bcca41f 100644 --- a/JHA/jackpotcoin.cu +++ b/JHA/jackpotcoin.cu @@ -50,7 +50,7 @@ static uint32_t *d_branch2Nonces[8]; static uint32_t *d_branch3Nonces[8]; // Original jackpothash Funktion aus einem miner Quelltext -inline unsigned int jackpothash(void *state, const void *input) +extern "C" unsigned int jackpothash(void *state, const void *input) { sph_blake512_context ctx_blake; sph_groestl512_context ctx_groestl; diff --git a/groestlcoin.cpp b/groestlcoin.cpp index dc3b0fe..63b6401 100644 --- a/groestlcoin.cpp +++ b/groestlcoin.cpp @@ -40,7 +40,7 @@ void sha256func(unsigned char *hash, const unsigned char *data, int len) be32enc((uint32_t *)hash + i, T[i]); } -static void groestlhash(void *state, const void *input) +extern "C" void groestlhash(void *state, const void *input) { // Tryout GPU-groestl diff --git a/miner.h b/miner.h index c8d1b9f..5fb53a6 100644 --- a/miner.h +++ b/miner.h @@ -251,10 +251,6 @@ extern int scanhash_x15(int thr_id, uint32_t *pdata, const uint32_t *ptarget, uint32_t max_nonce, unsigned long *hashes_done); -extern void fugue256_hash(unsigned char* output, const unsigned char* input, int len); -extern void heavycoin_hash(unsigned char* output, const unsigned char* input, int len); -extern void groestlcoin_hash(unsigned char* output, const unsigned char* input, int len); - struct thr_info { int id; pthread_t pth; @@ -351,6 +347,12 @@ extern void tq_freeze(struct thread_q *tq); extern void tq_thaw(struct thread_q *tq); void print_hash_tests(void); +unsigned int jackpothash(void *state, const void *input); +void fugue256_hash(unsigned char* output, const unsigned char* input, int len); +void heavycoin_hash(unsigned char* output, const unsigned char* input, int len); +void groestlhash(void *state, const void *input); +void myriadhash(void *state, const void *input); +void quarkhash(void *state, const void *input); void x11hash(void *output, const void *input); void x13hash(void *output, const void *input); void x14hash(void *output, const void *input); diff --git a/myriadgroestl.cpp b/myriadgroestl.cpp index 45d9745..c689513 100644 --- a/myriadgroestl.cpp +++ b/myriadgroestl.cpp @@ -18,7 +18,7 @@ void myriadgroestl_cpu_hash(int thr_id, int threads, uint32_t startNounce, void ((((x) << 24) & 0xff000000u) | (((x) << 8) & 0x00ff0000u) | \ (((x) >> 8) & 0x0000ff00u) | (((x) >> 24) & 0x000000ffu)) -static void myriadhash(void *state, const void *input) +extern "C" void myriadhash(void *state, const void *input) { sph_groestl512_context ctx_groestl; diff --git a/quark/quarkcoin.cu b/quark/quarkcoin.cu index 0bc46d9..34ba0bc 100644 --- a/quark/quarkcoin.cu +++ b/quark/quarkcoin.cu @@ -59,7 +59,7 @@ extern void quark_compactTest_single_false_cpu_hash_64(int thr_id, int threads, int order); // Original Quarkhash Funktion aus einem miner Quelltext -inline void quarkhash(void *state, const void *input) +extern "C" void quarkhash(void *state, const void *input) { sph_blake512_context ctx_blake; sph_bmw512_context ctx_bmw; diff --git a/util.c b/util.c index 42b8e34..55b8f86 100644 --- a/util.c +++ b/util.c @@ -1321,8 +1321,8 @@ out: static void print_hash(unsigned char *hash) { - for (int i=0; i < 32; i++) { - printf("%02x", hash[i]); + for (int i=0; i < 32; i += 4) { + printf("%02x%02x%02x%02x ", hash[i], hash[i+1], hash[i+2], hash[i+3]); } } @@ -1332,19 +1332,45 @@ void print_hash_tests(void) memset(buf, 0, sizeof buf); printf("CPU HASH ON EMPTY BUFFER RESULTS:\n"); + memset(hash, 0, sizeof hash); + fugue256_hash(&hash[0], &buf[0], 32); + printf("\nfugue256:"); print_hash(hash); + + memset(hash, 0, sizeof hash); + groestlhash(&hash[0], &buf[0]); + printf("\ngroestl: "); print_hash(hash); + + memset(hash, 0, sizeof hash); + heavycoin_hash(&hash[0], &buf[0], 32); + printf("\nheavy: "); print_hash(hash); + + memset(hash, 0, sizeof hash); + jackpothash(&hash[0], &buf[0]); + printf("\njackpot: "); print_hash(hash); + + memset(hash, 0, sizeof hash); + myriadhash(&hash[0], &buf[0]); + printf("\nmyriad: "); print_hash(hash); + + memset(hash, 0, sizeof hash); + quarkhash(&hash[0], &buf[0]); + printf("\nquark: "); print_hash(hash); + memset(hash, 0, sizeof hash); x11hash(&hash[0], &buf[0]); - printf("\nX11: "); print_hash(hash); + printf("\nX11: "); print_hash(hash); memset(hash, 0, sizeof hash); x13hash(&hash[0], &buf[0]); - printf("\nX13: "); print_hash(hash); + printf("\nX13: "); print_hash(hash); memset(hash, 0, sizeof hash); x14hash(&hash[0], &buf[0]); - printf("\nX14: "); print_hash(hash); + printf("\nX14: "); print_hash(hash); memset(hash, 0, sizeof hash); x15hash(&hash[0], &buf[0]); - printf("\nX15: "); print_hash(hash); -} \ No newline at end of file + printf("\nX15: "); print_hash(hash); + + printf("\n"); +}