This commit is contained in:
Jay D Dee
2018-03-31 12:50:52 -04:00
parent f449c6725f
commit dd5e552357
51 changed files with 241 additions and 265 deletions

View File

@@ -429,7 +429,7 @@ int scanhash_hmq1725( int thr_id, struct work *work, int32_t max_nonce,
bool register_hmq1725_algo( algo_gate_t* gate )
{
init_hmq1725_ctx();
gate->optimizations = SSE2_OPT | AES_OPT | AVX_OPT | AVX2_OPT | SHA_OPT;
gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT | SHA_OPT;
gate->set_target = (void*)&scrypt_set_target;
gate->scanhash = (void*)&scanhash_hmq1725;
gate->hash = (void*)&hmq1725hash;

View File

@@ -86,7 +86,7 @@ void x16r_4way_hash( void* output, const void* input )
if ( s_ntime == UINT32_MAX )
{
const uint8_t* tmp = (uint8_t*) in0;
x16r_getAlgoString( &tmp[4], hashOrder );
x16_r_s_getAlgoString( &tmp[4], hashOrder );
}
// Input data is both 64 bit interleaved (input)
@@ -321,10 +321,11 @@ int scanhash_x16r_4way( int thr_id, struct work *work, uint32_t max_nonce,
for ( int k=0; k < 19; k++ )
be32enc( &endiandata[k], pdata[k] );
if ( s_ntime != pdata[17] )
// if ( s_ntime != pdata[17] )
if ( s_ntime != endiandata[17] )
{
uint32_t ntime = swab32(pdata[17]);
x16r_getAlgoString( (const char*) (&endiandata[1]), hashOrder );
x16_r_s_getAlgoString( (const char*) (&endiandata[1]), hashOrder );
s_ntime = ntime;
if ( opt_debug && !thr_id )
applog( LOG_DEBUG, "hash order %s (%08x)", hashOrder, ntime );

View File

@@ -1,6 +1,6 @@
#include "x16r-gate.h"
void x16r_getAlgoString( const uint8_t* prevblock, char *output )
void x16r_getAlgoString( const char* prevblock, char *output )
{
char *sptr = output;
for ( int j = 0; j < X16R_HASH_FUNC_COUNT; j++ )
@@ -16,6 +16,22 @@ void x16r_getAlgoString( const uint8_t* prevblock, char *output )
*sptr = '\0';
}
void x16s_getAlgoString( const char* prevblock, char *output )
{
uint8_t* data = (uint8_t*)prevblock;
strcpy( output, "0123456789ABCDEF" );
for ( int i = 0; i < 16; i++ )
{
uint8_t b = (15 - i) >> 1; // 16 ascii hex chars, reversed
uint8_t algoDigit = (i & 1) ? data[b] & 0xF : data[b] >> 4;
int offset = algoDigit;
// insert the nth character at the front
char oldVal = output[offset];
for( int j = offset; j-- > 0; )
output[j+1] = output[j];
output[0] = oldVal;
}
}
bool register_x16r_algo( algo_gate_t* gate )
{
@@ -28,8 +44,26 @@ bool register_x16r_algo( algo_gate_t* gate )
gate->scanhash = (void*)&scanhash_x16r;
gate->hash = (void*)&x16r_hash;
#endif
gate->optimizations = SSE2_OPT | AES_OPT | AVX_OPT | AVX2_OPT;
gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT;
gate->set_target = (void*)&alt_set_target;
x16_r_s_getAlgoString = (void*)&x16r_getAlgoString;
return true;
};
bool register_x16s_algo( algo_gate_t* gate )
{
#if defined (X16R_4WAY)
init_x16r_4way_ctx();
gate->scanhash = (void*)&scanhash_x16r_4way;
gate->hash = (void*)&x16r_4way_hash;
#else
init_x16r_ctx();
gate->scanhash = (void*)&scanhash_x16r;
gate->hash = (void*)&x16r_hash;
#endif
gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT;
gate->set_target = (void*)&alt_set_target;
x16_r_s_getAlgoString = (void*)&x16s_getAlgoString;
return true;
};

View File

@@ -29,8 +29,12 @@ enum x16r_Algo {
X16R_HASH_FUNC_COUNT
};
bool (*x16_r_s_getAlgoString) ( const char*, char* );
void x16r_getAlgoString( const char* prevblock, char *output );
void x16s_getAlgoString( const char* prevblock, char *output );
bool register_x16r_algo( algo_gate_t* gate );
void x16r_getAlgoString( const uint8_t* prevblock, char *output );
bool register_x16s_algo( algo_gate_t* gate );
#if defined(X16R_4WAY)

View File

@@ -43,7 +43,7 @@ typedef struct {
#endif
sph_blake512_context blake;
sph_bmw512_context bmw;
sph_skein512_context skein;
sph_skein512_context skein;
sph_jh512_context jh;
sph_keccak512_context keccak;
hashState_luffa luffa;
@@ -61,27 +61,7 @@ x16r_ctx_holder x16r_ctx __attribute__ ((aligned (64)));
void init_x16r_ctx()
{
//#ifdef NO_AES_NI
// sph_groestl512_init(&x16r_ctx.groestl );
// sph_echo512_init(&x16r_ctx.echo);
//#else
// init_echo( &x16r_ctx.echo, 512 );
// init_groestl( &x16r_ctx.groestl, 64 );
//#endif
// sph_blake512_init( &x16r_ctx.blake );
// sph_bmw512_init( &x16r_ctx.bmw );
// sph_skein512_init( &x16r_ctx.bmw );
// sph_jh512_init( &x16r_ctx.jh );
// sph_keccak512_init( &x16r_ctx.keccak );
// init_luffa( &x16r_ctx.luffa, 512 );
cubehashInit( &x16r_ctx.cube, 512, 16, 32 );
// sph_shavite512_init( &x16r_ctx.shavite );
// init_sd( &x16r_ctx.simd, 512 );
// sph_hamsi512_init( &x16r_ctx.hamsi );
// sph_fugue512_init( &x16r_ctx.fugue );
// sph_shabal512_init( &x16r_ctx.shabal );
// sph_whirlpool_init( &x16r_ctx.whirlpool );
// SHA512_Init( &x16r_ctx.sha512 );
};
void x16r_hash( void* output, const void* input )
@@ -94,7 +74,7 @@ void x16r_hash( void* output, const void* input )
if ( s_ntime == UINT32_MAX )
{
const uint8_t* in8 = (uint8_t*) input;
x16r_getAlgoString( &in8[4], hashOrder );
x16_r_s_getAlgoString( &in8[4], hashOrder );
}
for ( int i = 0; i < 16; i++ )
@@ -218,10 +198,14 @@ int scanhash_x16r( int thr_id, struct work *work, uint32_t max_nonce,
for ( int k=0; k < 19; k++ )
be32enc( &endiandata[k], pdata[k] );
// This code is suspicious. s_ntime is saved after byteswapping pdata[17]
// but is tested vs unswapped pdata[17]. This should result in calling
// getAlgoString every pass, but that doesn't seem to be the case.
// It appears to be working correctly as is.
if ( s_ntime != pdata[17] )
{
uint32_t ntime = swab32(pdata[17]);
x16r_getAlgoString( (const char*) (&endiandata[1]), hashOrder );
x16_r_s_getAlgoString( (const char*) (&endiandata[1]), hashOrder );
s_ntime = ntime;
if ( opt_debug && !thr_id )
applog( LOG_DEBUG, "hash order %s (%08x)", hashOrder, ntime );

View File

@@ -11,7 +11,7 @@ bool register_x17_algo( algo_gate_t* gate )
gate->scanhash = (void*)&scanhash_x17;
gate->hash = (void*)&x17_hash;
#endif
gate->optimizations = SSE2_OPT | AES_OPT | AVX_OPT | AVX2_OPT;
gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT;
return true;
};

View File

@@ -16,7 +16,7 @@ bool register_xevan_algo( algo_gate_t* gate )
gate->scanhash = (void*)&scanhash_xevan;
gate->hash = (void*)&xevan_hash;
#endif
gate->optimizations = SSE2_OPT | AES_OPT | AVX_OPT | AVX2_OPT;
gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT;
gate->set_target = (void*)&xevan_set_target;
gate->get_max64 = (void*)&get_max64_0xffffLL;
return true;