From a51f59086b914e17c29d6bc732154eb933a9ef6f Mon Sep 17 00:00:00 2001 From: Jay D Dee Date: Thu, 18 Jul 2019 19:46:57 -0400 Subject: [PATCH] v3.9.6.1 --- Makefile.am | 3 + README.md | 2 + RELEASE_NOTES | 4 + algo-gate-api.c | 3 + algo/lyra2/lyra2rev3.c | 32 +-- algo/x16/hex.c | 247 +++++++++++++++++++++++ algo/x16/x16r-4way.c | 4 +- algo/x16/x16r-gate.c | 41 ++++ algo/x16/x16r-gate.h | 17 ++ algo/x16/x16r.c | 4 +- algo/x16/x21s-4way.c | 431 +++++++++++++++++++++++++++++++++++++++++ algo/x16/x21s.c | 263 +++++++++++++++++++++++++ configure | 20 +- configure.ac | 2 +- miner.h | 6 + 15 files changed, 1048 insertions(+), 31 deletions(-) create mode 100644 algo/x16/hex.c create mode 100644 algo/x16/x21s-4way.c create mode 100644 algo/x16/x21s.c diff --git a/Makefile.am b/Makefile.am index 036541f..c84bddb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -261,6 +261,9 @@ cpuminer_SOURCES = \ algo/x16/x16r-4way.c \ algo/x16/x16rt.c \ algo/x16/x16rt-4way.c \ + algo/x16/hex.c \ + algo/x16/x21s-4way.c \ + algo/x16/x21s.c \ algo/x17/x17-gate.c \ algo/x17/x17.c \ algo/x17/x17-4way.c \ diff --git a/README.md b/README.md index 0052c4c..eba3b86 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,7 @@ Supported Algorithms fresh Fresh groestl Groestl coin heavy Heavy + hex x16r-hex hmq1725 Espers hodl Hodlcoin jha Jackpotcoin @@ -123,6 +124,7 @@ Supported Algorithms x16rt_veil Veil (VEIL) x16s Pigeoncoin (PGN) x17 + x21s xevan Bitsend (BSD) yescrypt Globalboost-Y (BSTY) yescryptr8 BitZeny (ZNY) diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 6d461ef..e63debf 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -38,6 +38,10 @@ supported. Change Log ---------- +v3.9.6.1 + +New algos: x21s, hex (alias x16r-hex). + v3.9.6 New algos: bmw512, x16rt, x16rt-veil (alias veil), x13bcd (alias bcd). diff --git a/algo-gate-api.c b/algo-gate-api.c index 5ba5c09..e1ce066 100644 --- a/algo-gate-api.c +++ b/algo-gate-api.c @@ -182,6 +182,7 @@ bool register_algo_gate( int algo, algo_gate_t *gate ) case ALGO_FRESH: register_fresh_algo ( gate ); break; case ALGO_GROESTL: register_groestl_algo ( gate ); break; case ALGO_HEAVY: register_heavy_algo ( gate ); break; + case ALGO_HEX: register_hex_algo ( gate ); break; case ALGO_HMQ1725: register_hmq1725_algo ( gate ); break; case ALGO_HODL: register_hodl_algo ( gate ); break; case ALGO_JHA: register_jha_algo ( gate ); break; @@ -237,6 +238,7 @@ bool register_algo_gate( int algo, algo_gate_t *gate ) case ALGO_X16RT_VEIL: register_x16rt_veil_algo ( gate ); break; case ALGO_X16S: register_x16s_algo ( gate ); break; case ALGO_X17: register_x17_algo ( gate ); break; + case ALGO_X21S: register_x21s_algo ( gate ); break; case ALGO_XEVAN: register_xevan_algo ( gate ); break; /* case ALGO_YESCRYPT: register_yescrypt_05_algo ( gate ); break; case ALGO_YESCRYPTR8: register_yescryptr8_05_algo ( gate ); break; @@ -339,6 +341,7 @@ const char* const algo_alias_map[][2] = { "sib", "x11gost" }, { "timetravel8", "timetravel" }, { "veil", "x16rt-veil" }, + { "x16r-hex", "hex" }, { "yenten", "yescryptr16" }, { "ziftr", "zr5" }, { NULL, NULL } diff --git a/algo/lyra2/lyra2rev3.c b/algo/lyra2/lyra2rev3.c index ad3ced6..83380d9 100644 --- a/algo/lyra2/lyra2rev3.c +++ b/algo/lyra2/lyra2rev3.c @@ -32,27 +32,27 @@ void l2v3_blake256_midstate( const void* input ) void lyra2rev3_hash( void *state, const void *input ) { - lyra2v3_ctx_holder ctx __attribute__ ((aligned (64))); - memcpy( &ctx, &lyra2v3_ctx, sizeof(lyra2v3_ctx) ); - uint8_t hash[128] __attribute__ ((aligned (64))); - #define hashA hash - #define hashB hash+64 - const int midlen = 64; // bytes - const int tail = 80 - midlen; // 16 + lyra2v3_ctx_holder ctx __attribute__ ((aligned (64))); + memcpy( &ctx, &lyra2v3_ctx, sizeof(lyra2v3_ctx) ); + uint8_t hash[128] __attribute__ ((aligned (64))); + #define hashA hash + #define hashB hash+64 + const int midlen = 64; // bytes + const int tail = 80 - midlen; // 16 - memcpy( &ctx.blake, &l2v3_blake_mid, sizeof l2v3_blake_mid ); - sph_blake256( &ctx.blake, (uint8_t*)input + midlen, tail ); - sph_blake256_close( &ctx.blake, hash ); + memcpy( &ctx.blake, &l2v3_blake_mid, sizeof l2v3_blake_mid ); + sph_blake256( &ctx.blake, (uint8_t*)input + midlen, tail ); + sph_blake256_close( &ctx.blake, hash ); - LYRA2REV3( l2v3_wholeMatrix, hash, 32, hash, 32, hash, 32, 1, 4, 4 ); + LYRA2REV3( l2v3_wholeMatrix, hash, 32, hash, 32, hash, 32, 1, 4, 4 ); - cubehashUpdateDigest( &ctx.cube, (byte*) hashA, - (const byte*) hash, 32 ); + cubehashUpdateDigest( &ctx.cube, (byte*) hashA, + (const byte*) hash, 32 ); - LYRA2REV3( l2v3_wholeMatrix, hash, 32, hash, 32, hash, 32, 1, 4, 4 ); + LYRA2REV3( l2v3_wholeMatrix, hash, 32, hash, 32, hash, 32, 1, 4, 4 ); - sph_bmw256( &ctx.bmw, hash, 32 ); - sph_bmw256_close( &ctx.bmw, hash ); + sph_bmw256( &ctx.bmw, hash, 32 ); + sph_bmw256_close( &ctx.bmw, hash ); memcpy( state, hash, 32 ); } diff --git a/algo/x16/hex.c b/algo/x16/hex.c new file mode 100644 index 0000000..631e428 --- /dev/null +++ b/algo/x16/hex.c @@ -0,0 +1,247 @@ +/** + * x16r algo implementation + * + * Implementation by tpruvot@github Jan 2018 + * Optimized by JayDDee@github Jan 2018 + */ +#include "x16r-gate.h" + +#include +#include +#include +#include "algo/blake/sph_blake.h" +#include "algo/bmw/sph_bmw.h" +#include "algo/groestl/sph_groestl.h" +#include "algo/jh/sph_jh.h" +#include "algo/keccak/sph_keccak.h" +#include "algo/skein/sph_skein.h" +#include "algo/shavite/sph_shavite.h" +#include "algo/luffa/luffa_for_sse2.h" +#include "algo/cubehash/cubehash_sse2.h" +#include "algo/simd/nist.h" +#include "algo/echo/sph_echo.h" +#include "algo/hamsi/sph_hamsi.h" +#include "algo/fugue/sph_fugue.h" +#include "algo/shabal/sph_shabal.h" +#include "algo/whirlpool/sph_whirlpool.h" +#include +#if defined(__AES__) + #include "algo/echo/aes_ni/hash_api.h" + #include "algo/groestl/aes_ni/hash-groestl.h" +#endif + +static __thread uint32_t s_ntime = UINT32_MAX; +static __thread char hashOrder[X16R_HASH_FUNC_COUNT + 1] = { 0 }; + +static void hex_getAlgoString(const uint32_t* prevblock, char *output) +{ + char *sptr = output; + uint8_t* data = (uint8_t*)prevblock; + + for (uint8_t j = 0; j < X16R_HASH_FUNC_COUNT; j++) { + uint8_t b = (15 - j) >> 1; // 16 ascii hex chars, reversed + uint8_t algoDigit = (j & 1) ? data[b] & 0xF : data[b] >> 4; + if (algoDigit >= 10) + sprintf(sptr, "%c", 'A' + (algoDigit - 10)); + else + sprintf(sptr, "%u", (uint32_t) algoDigit); + sptr++; + } + *sptr = '\0'; +} + +union _hex_context_overlay +{ +#if defined(__AES__) + hashState_echo echo; + hashState_groestl groestl; +#else + sph_groestl512_context groestl; + sph_echo512_context echo; +#endif + sph_blake512_context blake; + sph_bmw512_context bmw; + sph_skein512_context skein; + sph_jh512_context jh; + sph_keccak512_context keccak; + hashState_luffa luffa; + cubehashParam cube; + sph_shavite512_context shavite; + hashState_sd simd; + sph_hamsi512_context hamsi; + sph_fugue512_context fugue; + sph_shabal512_context shabal; + sph_whirlpool_context whirlpool; + SHA512_CTX sha512; +}; +typedef union _hex_context_overlay hex_context_overlay; + +void hex_hash( void* output, const void* input ) +{ + uint32_t _ALIGN(128) hash[16]; + hex_context_overlay ctx; + void *in = (void*) input; + int size = 80; +/* + if ( s_ntime == UINT32_MAX ) + { + const uint8_t* in8 = (uint8_t*) input; + x16_r_s_getAlgoString( &in8[4], hashOrder ); + } +*/ + + char elem = hashOrder[0]; + uint8_t algo = elem >= 'A' ? elem - 'A' + 10 : elem - '0'; + + for ( int i = 0; i < 16; i++ ) + { + switch ( algo ) + { + case BLAKE: + sph_blake512_init( &ctx.blake ); + sph_blake512( &ctx.blake, in, size ); + sph_blake512_close( &ctx.blake, hash ); + break; + case BMW: + sph_bmw512_init( &ctx.bmw ); + sph_bmw512(&ctx.bmw, in, size); + sph_bmw512_close(&ctx.bmw, hash); + break; + case GROESTL: +#if defined(__AES__) + init_groestl( &ctx.groestl, 64 ); + update_and_final_groestl( &ctx.groestl, (char*)hash, + (const char*)in, size<<3 ); +#else + sph_groestl512_init( &ctx.groestl ); + sph_groestl512( &ctx.groestl, in, size ); + sph_groestl512_close(&ctx.groestl, hash); +#endif + break; + case SKEIN: + sph_skein512_init( &ctx.skein ); + sph_skein512( &ctx.skein, in, size ); + sph_skein512_close( &ctx.skein, hash ); + break; + case JH: + sph_jh512_init( &ctx.jh ); + sph_jh512(&ctx.jh, in, size ); + sph_jh512_close(&ctx.jh, hash ); + break; + case KECCAK: + sph_keccak512_init( &ctx.keccak ); + sph_keccak512( &ctx.keccak, in, size ); + sph_keccak512_close( &ctx.keccak, hash ); + break; + case LUFFA: + init_luffa( &ctx.luffa, 512 ); + update_and_final_luffa( &ctx.luffa, (BitSequence*)hash, + (const BitSequence*)in, size ); + break; + case CUBEHASH: + cubehashInit( &ctx.cube, 512, 16, 32 ); + cubehashUpdateDigest( &ctx.cube, (byte*) hash, + (const byte*)in, size ); + break; + case SHAVITE: + sph_shavite512_init( &ctx.shavite ); + sph_shavite512( &ctx.shavite, in, size ); + sph_shavite512_close( &ctx.shavite, hash ); + break; + case SIMD: + init_sd( &ctx.simd, 512 ); + update_final_sd( &ctx.simd, (BitSequence *)hash, + (const BitSequence*)in, size<<3 ); + break; + case ECHO: +#if defined(__AES__) + init_echo( &ctx.echo, 512 ); + update_final_echo ( &ctx.echo, (BitSequence *)hash, + (const BitSequence*)in, size<<3 ); +#else + sph_echo512_init( &ctx.echo ); + sph_echo512( &ctx.echo, in, size ); + sph_echo512_close( &ctx.echo, hash ); +#endif + break; + case HAMSI: + sph_hamsi512_init( &ctx.hamsi ); + sph_hamsi512( &ctx.hamsi, in, size ); + sph_hamsi512_close( &ctx.hamsi, hash ); + break; + case FUGUE: + sph_fugue512_init( &ctx.fugue ); + sph_fugue512( &ctx.fugue, in, size ); + sph_fugue512_close( &ctx.fugue, hash ); + break; + case SHABAL: + sph_shabal512_init( &ctx.shabal ); + sph_shabal512( &ctx.shabal, in, size ); + sph_shabal512_close( &ctx.shabal, hash ); + break; + case WHIRLPOOL: + sph_whirlpool_init( &ctx.whirlpool ); + sph_whirlpool( &ctx.whirlpool, in, size ); + sph_whirlpool_close( &ctx.whirlpool, hash ); + break; + case SHA_512: + SHA512_Init( &ctx.sha512 ); + SHA512_Update( &ctx.sha512, in, size ); + SHA512_Final( (unsigned char*) hash, &ctx.sha512 ); + break; + } + algo = (uint8_t)hash[0] % X16R_HASH_FUNC_COUNT; + in = (void*) hash; + size = 64; + } + memcpy(output, hash, 32); +} + +int scanhash_hex( struct work *work, uint32_t max_nonce, + uint64_t *hashes_done, struct thr_info *mythr ) +{ + uint32_t _ALIGN(128) hash32[8]; + uint32_t _ALIGN(128) endiandata[20]; + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t Htarg = ptarget[7]; + const uint32_t first_nonce = pdata[19]; + int thr_id = mythr->id; // thr_id arg is deprecated + uint32_t nonce = first_nonce; + volatile uint8_t *restart = &(work_restart[thr_id].restart); + + casti_m128i( endiandata, 0 ) = mm128_bswap_32( casti_m128i( pdata, 0 ) ); + casti_m128i( endiandata, 1 ) = mm128_bswap_32( casti_m128i( pdata, 1 ) ); + casti_m128i( endiandata, 2 ) = mm128_bswap_32( casti_m128i( pdata, 2 ) ); + casti_m128i( endiandata, 3 ) = mm128_bswap_32( casti_m128i( pdata, 3 ) ); + casti_m128i( endiandata, 4 ) = mm128_bswap_32( casti_m128i( pdata, 4 ) ); + + uint32_t ntime = swab32(pdata[17]); + if ( s_ntime != ntime ) + { + hex_getAlgoString( (const uint32_t*) (&endiandata[1]), hashOrder ); + s_ntime = ntime; + if ( opt_debug && !thr_id ) + applog( LOG_DEBUG, "hash order %s (%08x)", hashOrder, ntime ); + } + + if ( opt_benchmark ) + ptarget[7] = 0x0cff; + + do + { + be32enc( &endiandata[19], nonce ); + hex_hash( hash32, endiandata ); + + if ( hash32[7] <= Htarg ) + if (fulltest( hash32, ptarget ) && !opt_benchmark ) + { + pdata[19] = nonce; + submit_solution( work, hash32, mythr ); + } + nonce++; + } while ( nonce < max_nonce && !(*restart) ); + pdata[19] = nonce; + *hashes_done = pdata[19] - first_nonce + 1; + return 0; +} diff --git a/algo/x16/x16r-4way.c b/algo/x16/x16r-4way.c index 56cce06..1338f8b 100644 --- a/algo/x16/x16r-4way.c +++ b/algo/x16/x16r-4way.c @@ -68,13 +68,13 @@ void x16r_4way_hash( void* output, const void* input ) int size = 80; dintrlv_4x64( hash0, hash1, hash2, hash3, input, 640 ); - +/* if ( s_ntime == UINT32_MAX ) { const uint8_t* tmp = (uint8_t*) in0; x16_r_s_getAlgoString( &tmp[4], hashOrder ); } - +*/ // Input data is both 64 bit interleaved (input) // and deinterleaved in inp0-3. // If First function uses 64 bit data it is not required to interleave inp diff --git a/algo/x16/x16r-gate.c b/algo/x16/x16r-gate.c index 4a4bc7d..db2b20c 100644 --- a/algo/x16/x16r-gate.c +++ b/algo/x16/x16r-gate.c @@ -208,3 +208,44 @@ bool register_x16rt_veil_algo( algo_gate_t* gate ) return true; }; +//////////////////// +// +// HEX + + +void hex_set_target( struct work* work, double job_diff ) +{ + work_set_target( work, job_diff / (128.0 * opt_diff_factor) ); +} + +bool register_hex_algo( algo_gate_t* gate ) +{ + gate->scanhash = (void*)&scanhash_hex; + gate->hash = (void*)&hex_hash; + gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT; + gate->gen_merkle_root = (void*)&SHA256_gen_merkle_root; + gate->set_target = (void*)&hex_set_target; + return true; +}; + +/////////////////////////////// +// +// X21S + +bool register_x21s_algo( algo_gate_t* gate ) +{ +#if defined (X16R_4WAY) + gate->scanhash = (void*)&scanhash_x21s_4way; + gate->hash = (void*)&x21s_4way_hash; + gate->miner_thread_init = (void*)&x21s_4way_thread_init; +#else + gate->scanhash = (void*)&scanhash_x21s; + gate->hash = (void*)&x21s_hash; + gate->miner_thread_init = (void*)&x21s_thread_init; +#endif + gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT | SHA_OPT; + gate->set_target = (void*)&alt_set_target; + x16_r_s_getAlgoString = (void*)&x16s_getAlgoString; + return true; +}; + diff --git a/algo/x16/x16r-gate.h b/algo/x16/x16r-gate.h index 3629f02..23d975e 100644 --- a/algo/x16/x16r-gate.h +++ b/algo/x16/x16r-gate.h @@ -40,6 +40,8 @@ void x16rt_getTimeHash( const uint32_t timeStamp, void* timeHash ); bool register_x16r_algo( algo_gate_t* gate ); bool register_x16s_algo( algo_gate_t* gate ); bool register_x16rt_algo( algo_gate_t* gate ); +bool register_hex__algo( algo_gate_t* gate ); +bool register_x21s__algo( algo_gate_t* gate ); #if defined(X16R_4WAY) @@ -51,6 +53,11 @@ void x16rt_4way_hash( void *state, const void *input ); int scanhash_x16rt_4way( struct work *work, uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr ); +void x21s_4way_hash( void *state, const void *input ); +int scanhash_x21s_4way( struct work *work, uint32_t max_nonce, + uint64_t *hashes_done, struct thr_info *mythr ); +bool x21s_4way_thread_init(); + #endif void x16r_hash( void *state, const void *input ); @@ -60,5 +67,15 @@ int scanhash_x16r( struct work *work, uint32_t max_nonce, void x16rt_hash( void *state, const void *input ); int scanhash_x16rt( struct work *work, uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr ); + +void hex_hash( void *state, const void *input ); +int scanhash_hex( struct work *work, uint32_t max_nonce, + uint64_t *hashes_done, struct thr_info *mythr ); + +void x21s_hash( void *state, const void *input ); +int scanhash_x21s( struct work *work, uint32_t max_nonce, + uint64_t *hashes_done, struct thr_info *mythr ); +bool x21s_thread_init(); + #endif diff --git a/algo/x16/x16r.c b/algo/x16/x16r.c index 2ed393d..6de195a 100644 --- a/algo/x16/x16r.c +++ b/algo/x16/x16r.c @@ -65,13 +65,13 @@ void x16r_hash( void* output, const void* input ) x16r_context_overlay ctx; void *in = (void*) input; int size = 80; - +/* if ( s_ntime == UINT32_MAX ) { const uint8_t* in8 = (uint8_t*) input; x16_r_s_getAlgoString( &in8[4], hashOrder ); } - +*/ for ( int i = 0; i < 16; i++ ) { const char elem = hashOrder[i]; diff --git a/algo/x16/x21s-4way.c b/algo/x16/x21s-4way.c new file mode 100644 index 0000000..31e3f27 --- /dev/null +++ b/algo/x16/x21s-4way.c @@ -0,0 +1,431 @@ +/** + * x16r algo implementation + * + * Implementation by tpruvot@github Jan 2018 + * Optimized by JayDDee@github Jan 2018 + */ +#include "x16r-gate.h" + +#if defined (X16R_4WAY) + +#include +#include +#include +#include "algo/blake/blake-hash-4way.h" +#include "algo/bmw/bmw-hash-4way.h" +#include "algo/groestl/aes_ni/hash-groestl.h" +#include "algo/groestl/aes_ni/hash-groestl.h" +#include "algo/skein/skein-hash-4way.h" +#include "algo/jh/jh-hash-4way.h" +#include "algo/keccak/keccak-hash-4way.h" +#include "algo/shavite/sph_shavite.h" +#include "algo/luffa/luffa-hash-2way.h" +#include "algo/cubehash/cubehash_sse2.h" +#include "algo/simd/simd-hash-2way.h" +#include "algo/echo/aes_ni/hash_api.h" +#include "algo/hamsi/hamsi-hash-4way.h" +#include "algo/fugue/sph_fugue.h" +#include "algo/shabal/shabal-hash-4way.h" +#include "algo/whirlpool/sph_whirlpool.h" +#include "algo/sha/sha2-hash-4way.h" +#include "algo/haval/haval-hash-4way.h" +#include "algo/tiger/sph_tiger.h" +#include "algo/gost/sph_gost.h" +#include "algo/lyra2/lyra2.h" +#if defined(__SHA__) + #include +#endif + +static __thread uint32_t s_ntime = UINT32_MAX; +static __thread char hashOrder[X16R_HASH_FUNC_COUNT + 1] = { 0 }; +static __thread uint64_t* x21s_4way_matrix; + +union _x21s_4way_context_overlay +{ + blake512_4way_context blake; + bmw512_4way_context bmw; + hashState_echo echo; + hashState_groestl groestl; + skein512_4way_context skein; + jh512_4way_context jh; + keccak512_4way_context keccak; + luffa_2way_context luffa; + cubehashParam cube; + sph_shavite512_context shavite; + simd_2way_context simd; + hamsi512_4way_context hamsi; + sph_fugue512_context fugue; + shabal512_4way_context shabal; + sph_whirlpool_context whirlpool; + sha512_4way_context sha512; + haval256_5_4way_context haval; + sph_tiger_context tiger; + sph_gost512_context gost; +#if defined(__SHA__) + SHA256_CTX sha256; +#else + sha256_4way_context sha256; +#endif +}; +typedef union _x21s_4way_context_overlay x21s_4way_context_overlay; + +void x21s_4way_hash( void* output, const void* input ) +{ + uint32_t hash0[24] __attribute__ ((aligned (64))); + uint32_t hash1[24] __attribute__ ((aligned (64))); + uint32_t hash2[24] __attribute__ ((aligned (64))); + uint32_t hash3[24] __attribute__ ((aligned (64))); + uint32_t vhash[24*4] __attribute__ ((aligned (64))); + x21s_4way_context_overlay ctx; + void *in0 = (void*) hash0; + void *in1 = (void*) hash1; + void *in2 = (void*) hash2; + void *in3 = (void*) hash3; + int size = 80; + + dintrlv_4x64( hash0, hash1, hash2, hash3, input, 640 ); + + // Input data is both 64 bit interleaved (input) + // and deinterleaved in inp0-3. + // If First function uses 64 bit data it is not required to interleave inp + // first. It may use the inerleaved data dmost convenient, ie 4way 64 bit. + // All other functions assume data is deinterleaved in hash0-3 + // All functions must exit with data deinterleaved in hash0-3. + // Alias in0-3 points to either inp0-3 or hash0-3 according to + // its hashOrder position. Size is also set accordingly. + for ( int i = 0; i < 16; i++ ) + { + const char elem = hashOrder[i]; + const uint8_t algo = elem >= 'A' ? elem - 'A' + 10 : elem - '0'; + + switch ( algo ) + { + case BLAKE: + blake512_4way_init( &ctx.blake ); + if ( i == 0 ) + blake512_4way( &ctx.blake, input, size ); + else + { + intrlv_4x64( vhash, in0, in1, in2, in3, size<<3 ); + blake512_4way( &ctx.blake, vhash, size ); + } + blake512_4way_close( &ctx.blake, vhash ); + dintrlv_4x64( hash0, hash1, hash2, hash3, vhash, 512 ); + break; + case BMW: + bmw512_4way_init( &ctx.bmw ); + if ( i == 0 ) + bmw512_4way( &ctx.bmw, input, size ); + else + { + intrlv_4x64( vhash, in0, in1, in2, in3, size<<3 ); + bmw512_4way( &ctx.bmw, vhash, size ); + } + bmw512_4way_close( &ctx.bmw, vhash ); + dintrlv_4x64( hash0, hash1, hash2, hash3, vhash, 512 ); + break; + case GROESTL: + init_groestl( &ctx.groestl, 64 ); + update_and_final_groestl( &ctx.groestl, (char*)hash0, + (const char*)in0, size<<3 ); + init_groestl( &ctx.groestl, 64 ); + update_and_final_groestl( &ctx.groestl, (char*)hash1, + (const char*)in1, size<<3 ); + init_groestl( &ctx.groestl, 64 ); + update_and_final_groestl( &ctx.groestl, (char*)hash2, + (const char*)in2, size<<3 ); + init_groestl( &ctx.groestl, 64 ); + update_and_final_groestl( &ctx.groestl, (char*)hash3, + (const char*)in3, size<<3 ); + break; + case SKEIN: + skein512_4way_init( &ctx.skein ); + if ( i == 0 ) + skein512_4way( &ctx.skein, input, size ); + else + { + intrlv_4x64( vhash, in0, in1, in2, in3, size<<3 ); + skein512_4way( &ctx.skein, vhash, size ); + } + skein512_4way_close( &ctx.skein, vhash ); + dintrlv_4x64( hash0, hash1, hash2, hash3, vhash, 512 ); + break; + case JH: + jh512_4way_init( &ctx.jh ); + if ( i == 0 ) + jh512_4way( &ctx.jh, input, size ); + else + { + intrlv_4x64( vhash, in0, in1, in2, in3, size<<3 ); + jh512_4way( &ctx.jh, vhash, size ); + } + jh512_4way_close( &ctx.jh, vhash ); + dintrlv_4x64( hash0, hash1, hash2, hash3, vhash, 512 ); + break; + case KECCAK: + keccak512_4way_init( &ctx.keccak ); + if ( i == 0 ) + keccak512_4way( &ctx.keccak, input, size ); + else + { + intrlv_4x64( vhash, in0, in1, in2, in3, size<<3 ); + keccak512_4way( &ctx.keccak, vhash, size ); + } + keccak512_4way_close( &ctx.keccak, vhash ); + dintrlv_4x64( hash0, hash1, hash2, hash3, vhash, 512 ); + break; + case LUFFA: + intrlv_2x128( vhash, in0, in1, size<<3 ); + luffa_2way_init( &ctx.luffa, 512 ); + luffa_2way_update_close( &ctx.luffa, vhash, vhash, size ); + dintrlv_2x128( hash0, hash1, vhash, 512 ); + intrlv_2x128( vhash, in2, in3, size<<3 ); + luffa_2way_init( &ctx.luffa, 512 ); + luffa_2way_update_close( &ctx.luffa, vhash, vhash, size); + dintrlv_2x128( hash2, hash3, vhash, 512 ); + break; + case CUBEHASH: + cubehashInit( &ctx.cube, 512, 16, 32 ); + cubehashUpdateDigest( &ctx.cube, (byte*) hash0, + (const byte*)in0, size ); + cubehashInit( &ctx.cube, 512, 16, 32 ); + cubehashUpdateDigest( &ctx.cube, (byte*) hash1, + (const byte*)in1, size ); + cubehashInit( &ctx.cube, 512, 16, 32 ); + cubehashUpdateDigest( &ctx.cube, (byte*) hash2, + (const byte*)in2, size ); + cubehashInit( &ctx.cube, 512, 16, 32 ); + cubehashUpdateDigest( &ctx.cube, (byte*) hash3, + (const byte*)in3, size ); + break; + case SHAVITE: + sph_shavite512_init( &ctx.shavite ); + sph_shavite512( &ctx.shavite, in0, size ); + sph_shavite512_close( &ctx.shavite, hash0 ); + sph_shavite512_init( &ctx.shavite ); + sph_shavite512( &ctx.shavite, in1, size ); + sph_shavite512_close( &ctx.shavite, hash1 ); + sph_shavite512_init( &ctx.shavite ); + sph_shavite512( &ctx.shavite, in2, size ); + sph_shavite512_close( &ctx.shavite, hash2 ); + sph_shavite512_init( &ctx.shavite ); + sph_shavite512( &ctx.shavite, in3, size ); + sph_shavite512_close( &ctx.shavite, hash3 ); + break; + case SIMD: + intrlv_2x128( vhash, in0, in1, size<<3 ); + simd_2way_init( &ctx.simd, 512 ); + simd_2way_update_close( &ctx.simd, vhash, vhash, size<<3 ); + dintrlv_2x128( hash0, hash1, vhash, 512 ); + intrlv_2x128( vhash, in2, in3, size<<3 ); + simd_2way_init( &ctx.simd, 512 ); + simd_2way_update_close( &ctx.simd, vhash, vhash, size<<3 ); + dintrlv_2x128( hash2, hash3, vhash, 512 ); + break; + case ECHO: + init_echo( &ctx.echo, 512 ); + update_final_echo ( &ctx.echo, (BitSequence *)hash0, + (const BitSequence*)in0, size<<3 ); + init_echo( &ctx.echo, 512 ); + update_final_echo ( &ctx.echo, (BitSequence *)hash1, + (const BitSequence*)in1, size<<3 ); + init_echo( &ctx.echo, 512 ); + update_final_echo ( &ctx.echo, (BitSequence *)hash2, + (const BitSequence*)in2, size<<3 ); + init_echo( &ctx.echo, 512 ); + update_final_echo ( &ctx.echo, (BitSequence *)hash3, + (const BitSequence*)in3, size<<3 ); + break; + case HAMSI: + intrlv_4x64( vhash, in0, in1, in2, in3, size<<3 ); + hamsi512_4way_init( &ctx.hamsi ); + hamsi512_4way( &ctx.hamsi, vhash, size ); + hamsi512_4way_close( &ctx.hamsi, vhash ); + dintrlv_4x64( hash0, hash1, hash2, hash3, vhash, 512 ); + break; + case FUGUE: + sph_fugue512_init( &ctx.fugue ); + sph_fugue512( &ctx.fugue, in0, size ); + sph_fugue512_close( &ctx.fugue, hash0 ); + sph_fugue512_init( &ctx.fugue ); + sph_fugue512( &ctx.fugue, in1, size ); + sph_fugue512_close( &ctx.fugue, hash1 ); + sph_fugue512_init( &ctx.fugue ); + sph_fugue512( &ctx.fugue, in2, size ); + sph_fugue512_close( &ctx.fugue, hash2 ); + sph_fugue512_init( &ctx.fugue ); + sph_fugue512( &ctx.fugue, in3, size ); + sph_fugue512_close( &ctx.fugue, hash3 ); + break; + case SHABAL: + intrlv_4x32( vhash, in0, in1, in2, in3, size<<3 ); + shabal512_4way_init( &ctx.shabal ); + shabal512_4way( &ctx.shabal, vhash, size ); + shabal512_4way_close( &ctx.shabal, vhash ); + dintrlv_4x32( hash0, hash1, hash2, hash3, vhash, 512 ); + break; + case WHIRLPOOL: + sph_whirlpool_init( &ctx.whirlpool ); + sph_whirlpool( &ctx.whirlpool, in0, size ); + sph_whirlpool_close( &ctx.whirlpool, hash0 ); + sph_whirlpool_init( &ctx.whirlpool ); + sph_whirlpool( &ctx.whirlpool, in1, size ); + sph_whirlpool_close( &ctx.whirlpool, hash1 ); + sph_whirlpool_init( &ctx.whirlpool ); + sph_whirlpool( &ctx.whirlpool, in2, size ); + sph_whirlpool_close( &ctx.whirlpool, hash2 ); + sph_whirlpool_init( &ctx.whirlpool ); + sph_whirlpool( &ctx.whirlpool, in3, size ); + sph_whirlpool_close( &ctx.whirlpool, hash3 ); + break; + case SHA_512: + intrlv_4x64( vhash, in0, in1, in2, in3, size<<3 ); + sha512_4way_init( &ctx.sha512 ); + sha512_4way( &ctx.sha512, vhash, size ); + sha512_4way_close( &ctx.sha512, vhash ); + dintrlv_4x64( hash0, hash1, hash2, hash3, vhash, 512 ); + break; + } + size = 64; + } + + intrlv_4x32( vhash, hash0, hash1, hash2, hash3, 512 ); + + haval256_5_4way_init( &ctx.haval ); + haval256_5_4way( &ctx.haval, vhash, 64 ); + haval256_5_4way_close( &ctx.haval, vhash ); + + dintrlv_4x32( hash0, hash1, hash2, hash3, vhash, 512 ); + + sph_tiger_init( &ctx.tiger ); + sph_tiger ( &ctx.tiger, (const void*) hash0, 64 ); + sph_tiger_close( &ctx.tiger, (void*) hash0 ); + sph_tiger_init( &ctx.tiger ); + sph_tiger ( &ctx.tiger, (const void*) hash1, 64 ); + sph_tiger_close( &ctx.tiger, (void*) hash1 ); + sph_tiger_init( &ctx.tiger ); + sph_tiger ( &ctx.tiger, (const void*) hash2, 64 ); + sph_tiger_close( &ctx.tiger, (void*) hash2 ); + sph_tiger_init( &ctx.tiger ); + sph_tiger ( &ctx.tiger, (const void*) hash3, 64 ); + sph_tiger_close( &ctx.tiger, (void*) hash3 ); + + LYRA2REV2( x21s_4way_matrix, (void*) hash0, 32, (const void*) hash0, 32, + (const void*) hash0, 32, 1, 4, 4 ); + LYRA2REV2( x21s_4way_matrix, (void*) hash1, 32, (const void*) hash1, 32, + (const void*) hash1, 32, 1, 4, 4 ); + LYRA2REV2( x21s_4way_matrix, (void*) hash2, 32, (const void*) hash2, 32, + (const void*) hash2, 32, 1, 4, 4 ); + LYRA2REV2( x21s_4way_matrix, (void*) hash3, 32, (const void*) hash3, 32, + (const void*) hash3, 32, 1, 4, 4 ); + + sph_gost512_init( &ctx.gost ); + sph_gost512 ( &ctx.gost, (const void*) hash0, 64 ); + sph_gost512_close( &ctx.gost, (void*) hash0 ); + sph_gost512_init( &ctx.gost ); + sph_gost512 ( &ctx.gost, (const void*) hash1, 64 ); + sph_gost512_close( &ctx.gost, (void*) hash1 ); + sph_gost512_init( &ctx.gost ); + sph_gost512 ( &ctx.gost, (const void*) hash2, 64 ); + sph_gost512_close( &ctx.gost, (void*) hash2 ); + sph_gost512_init( &ctx.gost ); + sph_gost512 ( &ctx.gost, (const void*) hash3, 64 ); + sph_gost512_close( &ctx.gost, (void*) hash3 ); + +#if defined(__SHA__) + + SHA256_Init( &ctx.sha256 ); + SHA256_Update( &ctx.sha256, hash0, 64 ); + SHA256_Final( (unsigned char*)hash0, &ctx.sha256 ); + SHA256_Init( &ctx.sha256 ); + SHA256_Update( &ctx.sha256, hash1, 64 ); + SHA256_Final( (unsigned char*)hash1, &ctx.sha256 ); + SHA256_Init( &ctx.sha256 ); + SHA256_Update( &ctx.sha256, hash2, 64 ); + SHA256_Final( (unsigned char*)hash2, &ctx.sha256 ); + SHA256_Init( &ctx.sha256 ); + SHA256_Update( &ctx.sha256, hash3, 64 ); + SHA256_Final( (unsigned char*)hash3, &ctx.sha256 ); + + memcpy( output, hash0, 32 ); + memcpy( output+32, hash1, 32 ); + memcpy( output+64, hash2, 32 ); + memcpy( output+96, hash3, 32 ); + +#else + + intrlv_4x32( vhash, hash0, hash1, hash2, hash3, 512 ); + sha256_4way_init( &ctx.sha256 ); + sha256_4way( &ctx.sha256, vhash, 64 ); + sha256_4way_close( &ctx.sha256, vhash ); + dintrlv_4x32( output, output+32, output+64,output+96, vhash, 256 ); + +#endif +} + +int scanhash_x21s_4way( struct work *work, uint32_t max_nonce, + uint64_t *hashes_done, struct thr_info *mythr) +{ + uint32_t hash[4*16] __attribute__ ((aligned (64))); + uint32_t vdata[24*4] __attribute__ ((aligned (64))); + uint32_t endiandata[20] __attribute__((aligned(64))); + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t Htarg = ptarget[7]; + const uint32_t first_nonce = pdata[19]; + uint32_t n = first_nonce; + int thr_id = mythr->id; + __m256i *noncev = (__m256i*)vdata + 9; // aligned + volatile uint8_t *restart = &(work_restart[thr_id].restart); + + casti_m256i( endiandata, 0 ) = mm256_bswap_32( casti_m256i( pdata, 0 ) ); + casti_m256i( endiandata, 1 ) = mm256_bswap_32( casti_m256i( pdata, 1 ) ); + casti_m128i( endiandata, 4 ) = mm128_bswap_32( casti_m128i( pdata, 4 ) ); + + if ( s_ntime != endiandata[17] ) + { + uint32_t ntime = swab32(pdata[17]); + x16_r_s_getAlgoString( (const uint8_t*) (&endiandata[1]), hashOrder ); + s_ntime = ntime; + if ( opt_debug && !thr_id ) + applog( LOG_DEBUG, "hash order %s (%08x)", hashOrder, ntime ); + } + + if ( opt_benchmark ) + ptarget[7] = 0x0cff; + + uint64_t *edata = (uint64_t*)endiandata; + intrlv_4x64( (uint64_t*)vdata, edata, edata, edata, edata, 640 ); + + do + { + *noncev = mm256_intrlv_blend_32( mm256_bswap_32( + _mm256_set_epi32( n+3, 0, n+2, 0, n+1, 0, n, 0 ) ), *noncev ); + + x21s_4way_hash( hash, vdata ); + pdata[19] = n; + + for ( int i = 0; i < 4; i++ ) if ( (hash+(i<<3))[7] <= Htarg ) + if( fulltest( hash+(i<<3), ptarget ) && !opt_benchmark ) + { + pdata[19] = n+i; + submit_lane_solution( work, hash+(i<<3), mythr, i ); + } + n += 4; + } while ( ( n < max_nonce ) && !(*restart) ); + + *hashes_done = n - first_nonce + 1; + return 0; +} + +bool x21s_4way_thread_init() +{ + const int64_t ROW_LEN_INT64 = BLOCK_LEN_INT64 * 4; // nCols + const int64_t ROW_LEN_BYTES = ROW_LEN_INT64 * 8; + + const int size = (int64_t)ROW_LEN_BYTES * 4; // nRows; + x21s_4way_matrix = _mm_malloc( size, 64 ); + return x21s_4way_matrix; +} + +#endif diff --git a/algo/x16/x21s.c b/algo/x16/x21s.c new file mode 100644 index 0000000..8f290af --- /dev/null +++ b/algo/x16/x21s.c @@ -0,0 +1,263 @@ +/** + * x16r algo implementation + * + * Implementation by tpruvot@github Jan 2018 + * Optimized by JayDDee@github Jan 2018 + */ +#include "x16r-gate.h" + +#include +#include +#include +#include "algo/blake/sph_blake.h" +#include "algo/bmw/sph_bmw.h" +#include "algo/groestl/sph_groestl.h" +#include "algo/jh/sph_jh.h" +#include "algo/keccak/sph_keccak.h" +#include "algo/skein/sph_skein.h" +#include "algo/shavite/sph_shavite.h" +#include "algo/luffa/luffa_for_sse2.h" +#include "algo/cubehash/cubehash_sse2.h" +#include "algo/simd/nist.h" +#include "algo/echo/sph_echo.h" +#include "algo/hamsi/sph_hamsi.h" +#include "algo/fugue/sph_fugue.h" +#include "algo/shabal/sph_shabal.h" +#include "algo/whirlpool/sph_whirlpool.h" +#include +#if defined(__AES__) + #include "algo/echo/aes_ni/hash_api.h" + #include "algo/groestl/aes_ni/hash-groestl.h" +#endif +#include "algo/haval/sph-haval.h" +#include "algo/tiger/sph_tiger.h" +#include "algo/gost/sph_gost.h" +#include "algo/lyra2/lyra2.h" + +static __thread uint32_t s_ntime = UINT32_MAX; +static __thread char hashOrder[X16R_HASH_FUNC_COUNT + 1] = { 0 }; + +static __thread uint64_t* x21s_matrix; + +union _x21s_context_overlay +{ +#if defined(__AES__) + hashState_echo echo; + hashState_groestl groestl; +#else + sph_groestl512_context groestl; + sph_echo512_context echo; +#endif + sph_blake512_context blake; + sph_bmw512_context bmw; + sph_skein512_context skein; + sph_jh512_context jh; + sph_keccak512_context keccak; + hashState_luffa luffa; + cubehashParam cube; + sph_shavite512_context shavite; + hashState_sd simd; + sph_hamsi512_context hamsi; + sph_fugue512_context fugue; + sph_shabal512_context shabal; + sph_whirlpool_context whirlpool; + SHA512_CTX sha512; + sph_haval256_5_context haval; + sph_tiger_context tiger; + sph_gost512_context gost; + SHA256_CTX sha256; +}; +typedef union _x21s_context_overlay x21s_context_overlay; + +void x21s_hash( void* output, const void* input ) +{ + uint32_t _ALIGN(128) hash[16]; + x21s_context_overlay ctx; + void *in = (void*) input; + int size = 80; + + for ( int i = 0; i < 16; i++ ) + { + const char elem = hashOrder[i]; + const uint8_t algo = elem >= 'A' ? elem - 'A' + 10 : elem - '0'; + + switch ( algo ) + { + case BLAKE: + sph_blake512_init( &ctx.blake ); + sph_blake512( &ctx.blake, in, size ); + sph_blake512_close( &ctx.blake, hash ); + break; + case BMW: + sph_bmw512_init( &ctx.bmw ); + sph_bmw512(&ctx.bmw, in, size); + sph_bmw512_close(&ctx.bmw, hash); + break; + case GROESTL: +#if defined(__AES__) + init_groestl( &ctx.groestl, 64 ); + update_and_final_groestl( &ctx.groestl, (char*)hash, + (const char*)in, size<<3 ); +#else + sph_groestl512_init( &ctx.groestl ); + sph_groestl512( &ctx.groestl, in, size ); + sph_groestl512_close(&ctx.groestl, hash); +#endif + break; + case SKEIN: + sph_skein512_init( &ctx.skein ); + sph_skein512( &ctx.skein, in, size ); + sph_skein512_close( &ctx.skein, hash ); + break; + case JH: + sph_jh512_init( &ctx.jh ); + sph_jh512(&ctx.jh, in, size ); + sph_jh512_close(&ctx.jh, hash ); + break; + case KECCAK: + sph_keccak512_init( &ctx.keccak ); + sph_keccak512( &ctx.keccak, in, size ); + sph_keccak512_close( &ctx.keccak, hash ); + break; + case LUFFA: + init_luffa( &ctx.luffa, 512 ); + update_and_final_luffa( &ctx.luffa, (BitSequence*)hash, + (const BitSequence*)in, size ); + break; + case CUBEHASH: + cubehashInit( &ctx.cube, 512, 16, 32 ); + cubehashUpdateDigest( &ctx.cube, (byte*) hash, + (const byte*)in, size ); + break; + case SHAVITE: + sph_shavite512_init( &ctx.shavite ); + sph_shavite512( &ctx.shavite, in, size ); + sph_shavite512_close( &ctx.shavite, hash ); + break; + case SIMD: + init_sd( &ctx.simd, 512 ); + update_final_sd( &ctx.simd, (BitSequence *)hash, + (const BitSequence*)in, size<<3 ); + break; + case ECHO: +#if defined(__AES__) + init_echo( &ctx.echo, 512 ); + update_final_echo ( &ctx.echo, (BitSequence *)hash, + (const BitSequence*)in, size<<3 ); +#else + sph_echo512_init( &ctx.echo ); + sph_echo512( &ctx.echo, in, size ); + sph_echo512_close( &ctx.echo, hash ); +#endif + break; + case HAMSI: + sph_hamsi512_init( &ctx.hamsi ); + sph_hamsi512( &ctx.hamsi, in, size ); + sph_hamsi512_close( &ctx.hamsi, hash ); + break; + case FUGUE: + sph_fugue512_init( &ctx.fugue ); + sph_fugue512( &ctx.fugue, in, size ); + sph_fugue512_close( &ctx.fugue, hash ); + break; + case SHABAL: + sph_shabal512_init( &ctx.shabal ); + sph_shabal512( &ctx.shabal, in, size ); + sph_shabal512_close( &ctx.shabal, hash ); + break; + case WHIRLPOOL: + sph_whirlpool_init( &ctx.whirlpool ); + sph_whirlpool( &ctx.whirlpool, in, size ); + sph_whirlpool_close( &ctx.whirlpool, hash ); + break; + case SHA_512: + SHA512_Init( &ctx.sha512 ); + SHA512_Update( &ctx.sha512, in, size ); + SHA512_Final( (unsigned char*) hash, &ctx.sha512 ); + break; + } + in = (void*) hash; + size = 64; + } + + sph_haval256_5_init( &ctx.haval ); + sph_haval256_5( &ctx.haval, (const void*) hash, 64) ; + sph_haval256_5_close( &ctx.haval, hash ); + + sph_tiger_init( &ctx.tiger ); + sph_tiger ( &ctx.tiger, (const void*) hash, 64 ); + sph_tiger_close( &ctx.tiger, (void*) hash ); + + LYRA2REV2( x21s_matrix, (void*) hash, 32, (const void*) hash, 32, + (const void*) hash, 32, 1, 4, 4); + + sph_gost512_init( &ctx.gost ); + sph_gost512 ( &ctx.gost, (const void*) hash, 64 ); + sph_gost512_close( &ctx.gost, (void*) hash ); + + SHA256_Init( &ctx.sha256 ); + SHA256_Update( &ctx.sha256, hash, 64 ); + SHA256_Final( (unsigned char*)hash, &ctx.sha256 ); + + memcpy( output, hash, 32 ); +} + +int scanhash_x21s( struct work *work, uint32_t max_nonce, + uint64_t *hashes_done, struct thr_info *mythr ) +{ + uint32_t _ALIGN(128) hash32[8]; + uint32_t _ALIGN(128) endiandata[20]; + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint32_t Htarg = ptarget[7]; + const uint32_t first_nonce = pdata[19]; + int thr_id = mythr->id; // thr_id arg is deprecated + uint32_t nonce = first_nonce; + volatile uint8_t *restart = &(work_restart[thr_id].restart); + + casti_m128i( endiandata, 0 ) = mm128_bswap_32( casti_m128i( pdata, 0 ) ); + casti_m128i( endiandata, 1 ) = mm128_bswap_32( casti_m128i( pdata, 1 ) ); + casti_m128i( endiandata, 2 ) = mm128_bswap_32( casti_m128i( pdata, 2 ) ); + casti_m128i( endiandata, 3 ) = mm128_bswap_32( casti_m128i( pdata, 3 ) ); + casti_m128i( endiandata, 4 ) = mm128_bswap_32( casti_m128i( pdata, 4 ) ); + + if ( s_ntime != pdata[17] ) + { + uint32_t ntime = swab32(pdata[17]); + x16_r_s_getAlgoString( (const uint8_t*) (&endiandata[1]), hashOrder ); + s_ntime = ntime; + if ( opt_debug && !thr_id ) + applog( LOG_DEBUG, "hash order %s (%08x)", hashOrder, ntime ); + } + + if ( opt_benchmark ) + ptarget[7] = 0x0cff; + + do + { + be32enc( &endiandata[19], nonce ); + x21s_hash( hash32, endiandata ); + + if ( hash32[7] <= Htarg ) + if (fulltest( hash32, ptarget ) && !opt_benchmark ) + { + pdata[19] = nonce; + submit_solution( work, hash32, mythr ); + } + nonce++; + } while ( nonce < max_nonce && !(*restart) ); + pdata[19] = nonce; + *hashes_done = pdata[19] - first_nonce + 1; + return 0; +} + +bool x21s_thread_init() +{ + const int64_t ROW_LEN_INT64 = BLOCK_LEN_INT64 * 4; // nCols + const int64_t ROW_LEN_BYTES = ROW_LEN_INT64 * 8; + + const int size = (int64_t)ROW_LEN_BYTES * 4; // nRows; + x21s_matrix = _mm_malloc( size, 64 ); + return x21s_matrix; +} + diff --git a/configure b/configure index 6a3bc82..62cc85e 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for cpuminer-opt 3.9.6. +# Generated by GNU Autoconf 2.69 for cpuminer-opt 3.9.6.1. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -577,8 +577,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='cpuminer-opt' PACKAGE_TARNAME='cpuminer-opt' -PACKAGE_VERSION='3.9.6' -PACKAGE_STRING='cpuminer-opt 3.9.6' +PACKAGE_VERSION='3.9.6.1' +PACKAGE_STRING='cpuminer-opt 3.9.6.1' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1332,7 +1332,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures cpuminer-opt 3.9.6 to adapt to many kinds of systems. +\`configure' configures cpuminer-opt 3.9.6.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1404,7 +1404,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of cpuminer-opt 3.9.6:";; + short | recursive ) echo "Configuration of cpuminer-opt 3.9.6.1:";; esac cat <<\_ACEOF @@ -1509,7 +1509,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -cpuminer-opt configure 3.9.6 +cpuminer-opt configure 3.9.6.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2012,7 +2012,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by cpuminer-opt $as_me 3.9.6, which was +It was created by cpuminer-opt $as_me 3.9.6.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2993,7 +2993,7 @@ fi # Define the identity of the package. PACKAGE='cpuminer-opt' - VERSION='3.9.6' + VERSION='3.9.6.1' cat >>confdefs.h <<_ACEOF @@ -6690,7 +6690,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by cpuminer-opt $as_me 3.9.6, which was +This file was extended by cpuminer-opt $as_me 3.9.6.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -6756,7 +6756,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -cpuminer-opt config.status 3.9.6 +cpuminer-opt config.status 3.9.6.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 7ef601d..c80f89e 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([cpuminer-opt], [3.9.6]) +AC_INIT([cpuminer-opt], [3.9.6.1]) AC_PREREQ([2.59c]) AC_CANONICAL_SYSTEM diff --git a/miner.h b/miner.h index ea90a91..150bac8 100644 --- a/miner.h +++ b/miner.h @@ -526,6 +526,7 @@ enum algos { ALGO_FRESH, ALGO_GROESTL, ALGO_HEAVY, + ALGO_HEX, ALGO_HMQ1725, ALGO_HODL, ALGO_JHA, @@ -581,6 +582,7 @@ enum algos { ALGO_X16RT_VEIL, ALGO_X16S, ALGO_X17, + ALGO_X21S, ALGO_XEVAN, ALGO_YESCRYPT, ALGO_YESCRYPTR8, @@ -618,6 +620,7 @@ static const char* const algo_names[] = { "fresh", "groestl", "heavy", + "hex", "hmq1725", "hodl", "jha", @@ -673,6 +676,7 @@ static const char* const algo_names[] = { "x16rt-veil", "x16s", "x17", + "x21s", "xevan", "yescrypt", "yescryptr8", @@ -772,6 +776,7 @@ Options:\n\ fresh Fresh\n\ groestl Groestl coin\n\ heavy Heavy\n\ + hex x16r-hex\n\ hmq1725 Espers\n\ hodl Hodlcoin\n\ jha jackppot (Jackpotcoin)\n\ @@ -828,6 +833,7 @@ Options:\n\ x16rt-veil Veil (VEIL)\n\ x16s Pigeoncoin (PGN)\n\ x17\n\ + x21s\n\ xevan Bitsend (BSD)\n\ yescrypt Globalboost-Y (BSTY)\n\ yescryptr8 BitZeny (ZNY)\n\