mirror of
https://github.com/JayDDee/cpuminer-opt.git
synced 2025-09-17 23:44:27 +00:00
v3.15.0
This commit is contained in:
@@ -6,30 +6,6 @@
|
||||
*/
|
||||
#include "x16r-gate.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#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 <openssl/sha.h>
|
||||
#if defined(__AES__)
|
||||
#include "algo/echo/aes_ni/hash_api.h"
|
||||
#include "algo/groestl/aes_ni/hash-groestl.h"
|
||||
#endif
|
||||
|
||||
static void hex_getAlgoString(const uint32_t* prevblock, char *output)
|
||||
{
|
||||
char *sptr = output;
|
||||
@@ -47,34 +23,6 @@ static void hex_getAlgoString(const uint32_t* prevblock, char *output)
|
||||
*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;
|
||||
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;
|
||||
*/
|
||||
|
||||
static __thread x16r_context_overlay hex_ctx;
|
||||
|
||||
int hex_hash( void* output, const void* input, int thrid )
|
||||
@@ -187,8 +135,12 @@ int hex_hash( void* output, const void* input, int thrid )
|
||||
sph_hamsi512_close( &ctx.hamsi, hash );
|
||||
break;
|
||||
case FUGUE:
|
||||
#if defined(__AES__)
|
||||
fugue512_full( &ctx.fugue, hash, in, size );
|
||||
#else
|
||||
sph_fugue512_full( &ctx.fugue, hash, in, size );
|
||||
break;
|
||||
#endif
|
||||
break;
|
||||
case SHABAL:
|
||||
if ( i == 0 )
|
||||
sph_shabal512( &ctx.shabal, in+64, 16 );
|
||||
|
||||
@@ -15,16 +15,17 @@
|
||||
#include "algo/cubehash/cubehash_sse2.h"
|
||||
#include "algo/simd/nist.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 <openssl/sha.h>
|
||||
#if defined(__AES__)
|
||||
#include "algo/echo/aes_ni/hash_api.h"
|
||||
#include "algo/groestl/aes_ni/hash-groestl.h"
|
||||
#include "algo/fugue/fugue-aesni.h"
|
||||
#else
|
||||
#include "algo/echo/sph_echo.h"
|
||||
#include "algo/groestl/sph_groestl.h"
|
||||
#include "algo/fugue/sph_fugue.h"
|
||||
#endif
|
||||
|
||||
// Config
|
||||
@@ -34,13 +35,16 @@ typedef struct TortureNode TortureNode;
|
||||
typedef struct TortureGarden TortureGarden;
|
||||
|
||||
// Graph of hash algos plus SPH contexts
|
||||
struct TortureGarden {
|
||||
struct TortureGarden
|
||||
{
|
||||
#if defined(__AES__)
|
||||
hashState_echo echo;
|
||||
hashState_groestl groestl;
|
||||
hashState_fugue fugue;
|
||||
#else
|
||||
sph_echo512_context echo;
|
||||
sph_groestl512_context groestl;
|
||||
sph_echo512_context echo;
|
||||
sph_groestl512_context groestl;
|
||||
sph_fugue512_context fugue;
|
||||
#endif
|
||||
sph_blake512_context blake;
|
||||
sph_bmw512_context bmw;
|
||||
@@ -52,15 +56,13 @@ struct TortureGarden {
|
||||
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;
|
||||
|
||||
struct TortureNode {
|
||||
unsigned int algo;
|
||||
TortureNode *childLeft;
|
||||
TortureNode *childRight;
|
||||
TortureNode *child[2];
|
||||
} nodes[22];
|
||||
} __attribute__ ((aligned (64)));
|
||||
|
||||
@@ -97,10 +99,12 @@ static void get_hash( void *output, const void *input, TortureGarden *garden,
|
||||
#endif
|
||||
break;
|
||||
case 4:
|
||||
sph_fugue512_init(&garden->fugue);
|
||||
sph_fugue512(&garden->fugue, input, 64);
|
||||
sph_fugue512_close(&garden->fugue, hash);
|
||||
break;
|
||||
#if defined(__AES__)
|
||||
fugue512_full( &garden->fugue, hash, input, 64 );
|
||||
#else
|
||||
sph_fugue512_full( &garden->fugue, hash, input, 64 );
|
||||
#endif
|
||||
break;
|
||||
case 5:
|
||||
#if defined(__AES__)
|
||||
groestl512_full( &garden->groestl, (char*)hash, (char*)input, 512 );
|
||||
@@ -162,68 +166,61 @@ static void get_hash( void *output, const void *input, TortureGarden *garden,
|
||||
break;
|
||||
}
|
||||
|
||||
// Output the hash
|
||||
memcpy(output, hash, 64);
|
||||
}
|
||||
|
||||
// Recursively traverse a given torture garden starting with a given hash and given node within the garden. The hash is overwritten with the final hash.
|
||||
static void traverse_garden( TortureGarden *garden, void *hash,
|
||||
TortureNode *node )
|
||||
{
|
||||
unsigned char partialHash[64] __attribute__ ((aligned (64)));
|
||||
get_hash(partialHash, hash, garden, node->algo);
|
||||
|
||||
if ( partialHash[63] % 2 == 0 )
|
||||
{ // Last byte of output hash is even
|
||||
if ( node->childLeft != NULL )
|
||||
traverse_garden( garden, partialHash, node->childLeft );
|
||||
}
|
||||
else
|
||||
{ // Last byte of output hash is odd
|
||||
if ( node->childRight != NULL )
|
||||
traverse_garden( garden, partialHash, node->childRight );
|
||||
}
|
||||
|
||||
memcpy( hash, partialHash, 64 );
|
||||
}
|
||||
|
||||
// Associate child nodes with a parent node
|
||||
static inline void link_nodes( TortureNode *parent, TortureNode *childLeft,
|
||||
TortureNode *childRight )
|
||||
{
|
||||
parent->childLeft = childLeft;
|
||||
parent->childRight = childRight;
|
||||
}
|
||||
|
||||
static __thread TortureGarden garden;
|
||||
|
||||
bool initialize_torture_garden()
|
||||
{
|
||||
// Create torture garden nodes. Note that both sides of 19 and 20 lead to 21, and 21 has no children (to make traversal complete).
|
||||
link_nodes(&garden.nodes[0], &garden.nodes[1], &garden.nodes[2]);
|
||||
link_nodes(&garden.nodes[1], &garden.nodes[3], &garden.nodes[4]);
|
||||
link_nodes(&garden.nodes[2], &garden.nodes[5], &garden.nodes[6]);
|
||||
link_nodes(&garden.nodes[3], &garden.nodes[7], &garden.nodes[8]);
|
||||
link_nodes(&garden.nodes[4], &garden.nodes[9], &garden.nodes[10]);
|
||||
link_nodes(&garden.nodes[5], &garden.nodes[11], &garden.nodes[12]);
|
||||
link_nodes(&garden.nodes[6], &garden.nodes[13], &garden.nodes[14]);
|
||||
link_nodes(&garden.nodes[7], &garden.nodes[15], &garden.nodes[16]);
|
||||
link_nodes(&garden.nodes[8], &garden.nodes[15], &garden.nodes[16]);
|
||||
link_nodes(&garden.nodes[9], &garden.nodes[15], &garden.nodes[16]);
|
||||
link_nodes(&garden.nodes[10], &garden.nodes[15], &garden.nodes[16]);
|
||||
link_nodes(&garden.nodes[11], &garden.nodes[17], &garden.nodes[18]);
|
||||
link_nodes(&garden.nodes[12], &garden.nodes[17], &garden.nodes[18]);
|
||||
link_nodes(&garden.nodes[13], &garden.nodes[17], &garden.nodes[18]);
|
||||
link_nodes(&garden.nodes[14], &garden.nodes[17], &garden.nodes[18]);
|
||||
link_nodes(&garden.nodes[15], &garden.nodes[19], &garden.nodes[20]);
|
||||
link_nodes(&garden.nodes[16], &garden.nodes[19], &garden.nodes[20]);
|
||||
link_nodes(&garden.nodes[17], &garden.nodes[19], &garden.nodes[20]);
|
||||
link_nodes(&garden.nodes[18], &garden.nodes[19], &garden.nodes[20]);
|
||||
link_nodes(&garden.nodes[19], &garden.nodes[21], &garden.nodes[21]);
|
||||
link_nodes(&garden.nodes[20], &garden.nodes[21], &garden.nodes[21]);
|
||||
garden.nodes[21].childLeft = NULL;
|
||||
garden.nodes[21].childRight = NULL;
|
||||
return true;
|
||||
|
||||
garden.nodes[ 0].child[0] = &garden.nodes[ 1];
|
||||
garden.nodes[ 0].child[1] = &garden.nodes[ 2];
|
||||
garden.nodes[ 1].child[0] = &garden.nodes[ 3];
|
||||
garden.nodes[ 1].child[1] = &garden.nodes[ 4];
|
||||
garden.nodes[ 2].child[0] = &garden.nodes[ 5];
|
||||
garden.nodes[ 2].child[1] = &garden.nodes[ 6];
|
||||
garden.nodes[ 3].child[0] = &garden.nodes[ 7];
|
||||
garden.nodes[ 3].child[1] = &garden.nodes[ 8];
|
||||
garden.nodes[ 4].child[0] = &garden.nodes[ 9];
|
||||
garden.nodes[ 4].child[1] = &garden.nodes[10];
|
||||
garden.nodes[ 5].child[0] = &garden.nodes[11];
|
||||
garden.nodes[ 5].child[1] = &garden.nodes[12];
|
||||
garden.nodes[ 6].child[0] = &garden.nodes[13];
|
||||
garden.nodes[ 6].child[1] = &garden.nodes[14];
|
||||
garden.nodes[ 7].child[0] = &garden.nodes[15];
|
||||
garden.nodes[ 7].child[1] = &garden.nodes[16];
|
||||
garden.nodes[ 8].child[0] = &garden.nodes[15];
|
||||
garden.nodes[ 8].child[1] = &garden.nodes[16];
|
||||
garden.nodes[ 9].child[0] = &garden.nodes[15];
|
||||
garden.nodes[ 9].child[1] = &garden.nodes[16];
|
||||
garden.nodes[10].child[0] = &garden.nodes[15];
|
||||
garden.nodes[10].child[1] = &garden.nodes[16];
|
||||
garden.nodes[11].child[0] = &garden.nodes[17];
|
||||
garden.nodes[11].child[1] = &garden.nodes[18];
|
||||
garden.nodes[12].child[0] = &garden.nodes[17];
|
||||
garden.nodes[12].child[1] = &garden.nodes[18];
|
||||
garden.nodes[13].child[0] = &garden.nodes[17];
|
||||
garden.nodes[13].child[1] = &garden.nodes[18];
|
||||
garden.nodes[14].child[0] = &garden.nodes[17];
|
||||
garden.nodes[14].child[1] = &garden.nodes[18];
|
||||
garden.nodes[15].child[0] = &garden.nodes[19];
|
||||
garden.nodes[15].child[1] = &garden.nodes[20];
|
||||
garden.nodes[16].child[0] = &garden.nodes[19];
|
||||
garden.nodes[16].child[1] = &garden.nodes[20];
|
||||
garden.nodes[17].child[0] = &garden.nodes[19];
|
||||
garden.nodes[17].child[1] = &garden.nodes[20];
|
||||
garden.nodes[18].child[0] = &garden.nodes[19];
|
||||
garden.nodes[18].child[1] = &garden.nodes[20];
|
||||
garden.nodes[19].child[0] = &garden.nodes[21];
|
||||
garden.nodes[19].child[1] = &garden.nodes[21];
|
||||
garden.nodes[20].child[0] = &garden.nodes[21];
|
||||
garden.nodes[20].child[1] = &garden.nodes[21];
|
||||
garden.nodes[21].child[0] = NULL;
|
||||
garden.nodes[21].child[1] = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Produce a 32-byte hash from 80-byte input data
|
||||
@@ -236,20 +233,67 @@ int minotaur_hash( void *output, const void *input, int thr_id )
|
||||
SHA512_Update( &garden.sha512, input, 80 );
|
||||
SHA512_Final( (unsigned char*) hash, &garden.sha512 );
|
||||
|
||||
// algo 6 (Hamsi) is very slow. It's faster to skip hashing this nonce
|
||||
// if Hamsi is needed but only the first and last functions are
|
||||
// currently known. Abort if either is Hamsi.
|
||||
if ( ( ( hash[ 0] % MINOTAUR_ALGO_COUNT ) == 6 )
|
||||
|| ( ( hash[21] % MINOTAUR_ALGO_COUNT ) == 6 ) )
|
||||
return 0;
|
||||
|
||||
// Assign algos to torture garden nodes based on initial hash
|
||||
for ( int i = 0; i < 22; i++ )
|
||||
garden.nodes[i].algo = hash[i] % MINOTAUR_ALGO_COUNT;
|
||||
|
||||
// Send the initial hash through the torture garden
|
||||
traverse_garden( &garden, hash, &garden.nodes[0] );
|
||||
TortureNode *node = &garden.nodes[0];
|
||||
|
||||
while ( node )
|
||||
{
|
||||
get_hash( hash, hash, &garden, node->algo );
|
||||
node = node->child[ hash[63] & 1 ];
|
||||
}
|
||||
|
||||
memcpy( output, hash, 32 );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int scanhash_minotaur( struct work *work, uint32_t max_nonce,
|
||||
uint64_t *hashes_done, struct thr_info *mythr )
|
||||
{
|
||||
uint32_t edata[20] __attribute__((aligned(64)));
|
||||
uint32_t hash[8] __attribute__((aligned(64)));
|
||||
uint32_t *pdata = work->data;
|
||||
uint32_t *ptarget = work->target;
|
||||
const uint32_t first_nonce = pdata[19];
|
||||
const uint32_t last_nonce = max_nonce - 1;
|
||||
uint32_t n = first_nonce;
|
||||
const int thr_id = mythr->id;
|
||||
const bool bench = opt_benchmark;
|
||||
uint64_t skipped = 0;
|
||||
|
||||
mm128_bswap32_80( edata, pdata );
|
||||
do
|
||||
{
|
||||
edata[19] = n;
|
||||
if ( likely( algo_gate.hash( hash, edata, thr_id ) ) )
|
||||
{
|
||||
if ( unlikely( valid_hash( hash, ptarget ) && !bench ) )
|
||||
{
|
||||
pdata[19] = bswap_32( n );
|
||||
submit_solution( work, hash, mythr );
|
||||
}
|
||||
}
|
||||
else skipped++;
|
||||
n++;
|
||||
} while ( n < last_nonce && !work_restart[thr_id].restart );
|
||||
*hashes_done = n - first_nonce - skipped;
|
||||
pdata[19] = n;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool register_minotaur_algo( algo_gate_t* gate )
|
||||
{
|
||||
gate->scanhash = (void*)&scanhash_minotaur;
|
||||
gate->hash = (void*)&minotaur_hash;
|
||||
gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT | AVX512_OPT;
|
||||
gate->miner_thread_init = (void*)&initialize_torture_garden;
|
||||
|
||||
@@ -347,14 +347,14 @@ int x16r_8way_hash_generic( void* output, const void* input, int thrid )
|
||||
hash7, vhash );
|
||||
break;
|
||||
case FUGUE:
|
||||
sph_fugue512_full( &ctx.fugue, hash0, in0, size );
|
||||
sph_fugue512_full( &ctx.fugue, hash1, in1, size );
|
||||
sph_fugue512_full( &ctx.fugue, hash2, in2, size );
|
||||
sph_fugue512_full( &ctx.fugue, hash3, in3, size );
|
||||
sph_fugue512_full( &ctx.fugue, hash4, in4, size );
|
||||
sph_fugue512_full( &ctx.fugue, hash5, in5, size );
|
||||
sph_fugue512_full( &ctx.fugue, hash6, in6, size );
|
||||
sph_fugue512_full( &ctx.fugue, hash7, in7, size );
|
||||
fugue512_full( &ctx.fugue, hash0, in0, size );
|
||||
fugue512_full( &ctx.fugue, hash1, in1, size );
|
||||
fugue512_full( &ctx.fugue, hash2, in2, size );
|
||||
fugue512_full( &ctx.fugue, hash3, in3, size );
|
||||
fugue512_full( &ctx.fugue, hash4, in4, size );
|
||||
fugue512_full( &ctx.fugue, hash5, in5, size );
|
||||
fugue512_full( &ctx.fugue, hash6, in6, size );
|
||||
fugue512_full( &ctx.fugue, hash7, in7, size );
|
||||
break;
|
||||
case SHABAL:
|
||||
intrlv_8x32( vhash, in0, in1, in2, in3, in4, in5, in6, in7,
|
||||
@@ -747,10 +747,10 @@ int x16r_4way_hash_generic( void* output, const void* input, int thrid )
|
||||
dintrlv_4x64_512( hash0, hash1, hash2, hash3, vhash );
|
||||
break;
|
||||
case FUGUE:
|
||||
sph_fugue512_full( &ctx.fugue, hash0, in0, size );
|
||||
sph_fugue512_full( &ctx.fugue, hash1, in1, size );
|
||||
sph_fugue512_full( &ctx.fugue, hash2, in2, size );
|
||||
sph_fugue512_full( &ctx.fugue, hash3, in3, size );
|
||||
fugue512_full( &ctx.fugue, hash0, in0, size );
|
||||
fugue512_full( &ctx.fugue, hash1, in1, size );
|
||||
fugue512_full( &ctx.fugue, hash2, in2, size );
|
||||
fugue512_full( &ctx.fugue, hash3, in3, size );
|
||||
break;
|
||||
case SHABAL:
|
||||
intrlv_4x32( vhash, in0, in1, in2, in3, size<<3 );
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#if defined(__AES__)
|
||||
#include "algo/echo/aes_ni/hash_api.h"
|
||||
#include "algo/groestl/aes_ni/hash-groestl.h"
|
||||
#include "algo/fugue/fugue-aesni.h"
|
||||
#endif
|
||||
#if defined (__AVX2__)
|
||||
#include "algo/blake/blake-hash-4way.h"
|
||||
@@ -111,7 +112,7 @@ union _x16r_8way_context_overlay
|
||||
cubehashParam cube;
|
||||
simd_4way_context simd;
|
||||
hamsi512_8way_context hamsi;
|
||||
sph_fugue512_context fugue;
|
||||
hashState_fugue fugue;
|
||||
shabal512_8way_context shabal;
|
||||
sph_whirlpool_context whirlpool;
|
||||
sha512_8way_context sha512;
|
||||
@@ -155,7 +156,7 @@ union _x16r_4way_context_overlay
|
||||
shavite512_context shavite;
|
||||
simd_2way_context simd;
|
||||
hamsi512_4way_context hamsi;
|
||||
sph_fugue512_context fugue;
|
||||
hashState_fugue fugue;
|
||||
shabal512_4way_context shabal;
|
||||
sph_whirlpool_context whirlpool;
|
||||
sha512_4way_context sha512;
|
||||
@@ -180,9 +181,11 @@ union _x16r_context_overlay
|
||||
#if defined(__AES__)
|
||||
hashState_echo echo;
|
||||
hashState_groestl groestl;
|
||||
hashState_fugue fugue;
|
||||
#else
|
||||
sph_groestl512_context groestl;
|
||||
sph_echo512_context echo;
|
||||
sph_fugue512_context fugue;
|
||||
#endif
|
||||
sph_blake512_context blake;
|
||||
sph_bmw512_context bmw;
|
||||
@@ -194,7 +197,6 @@ union _x16r_context_overlay
|
||||
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;
|
||||
|
||||
@@ -151,8 +151,12 @@ int x16r_hash_generic( void* output, const void* input, int thrid )
|
||||
sph_hamsi512_close( &ctx.hamsi, hash );
|
||||
break;
|
||||
case FUGUE:
|
||||
sph_fugue512_full( &ctx.fugue, hash, in, size );
|
||||
break;
|
||||
#if defined(__AES__)
|
||||
fugue512_full( &ctx.fugue, hash, in, size );
|
||||
#else
|
||||
sph_fugue512_full( &ctx.fugue, hash, in, size );
|
||||
#endif
|
||||
break;
|
||||
case SHABAL:
|
||||
if ( i == 0 )
|
||||
sph_shabal512( &ctx.shabal, in+64, 16 );
|
||||
|
||||
@@ -8,30 +8,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#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/cubehash/cube-hash-2way.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/sha-hash-4way.h"
|
||||
#include "algo/tiger/sph_tiger.h"
|
||||
#if defined(__VAES__)
|
||||
#include "algo/groestl/groestl512-hash-4way.h"
|
||||
#include "algo/shavite/shavite-hash-4way.h"
|
||||
#include "algo/echo/echo-hash-4way.h"
|
||||
#endif
|
||||
|
||||
#if defined (X16RV2_8WAY)
|
||||
|
||||
@@ -46,7 +23,7 @@ union _x16rv2_8way_context_overlay
|
||||
cubehashParam cube;
|
||||
simd_4way_context simd;
|
||||
hamsi512_8way_context hamsi;
|
||||
sph_fugue512_context fugue;
|
||||
hashState_fugue fugue;
|
||||
shabal512_8way_context shabal;
|
||||
sph_whirlpool_context whirlpool;
|
||||
sha512_8way_context sha512;
|
||||
@@ -432,14 +409,14 @@ int x16rv2_8way_hash( void* output, const void* input, int thrid )
|
||||
hash7, vhash );
|
||||
break;
|
||||
case FUGUE:
|
||||
sph_fugue512_full( &ctx.fugue, hash0, in0, size );
|
||||
sph_fugue512_full( &ctx.fugue, hash1, in1, size );
|
||||
sph_fugue512_full( &ctx.fugue, hash2, in2, size );
|
||||
sph_fugue512_full( &ctx.fugue, hash3, in3, size );
|
||||
sph_fugue512_full( &ctx.fugue, hash4, in4, size );
|
||||
sph_fugue512_full( &ctx.fugue, hash5, in5, size );
|
||||
sph_fugue512_full( &ctx.fugue, hash6, in6, size );
|
||||
sph_fugue512_full( &ctx.fugue, hash7, in7, size );
|
||||
fugue512_full( &ctx.fugue, hash0, in0, size );
|
||||
fugue512_full( &ctx.fugue, hash1, in1, size );
|
||||
fugue512_full( &ctx.fugue, hash2, in2, size );
|
||||
fugue512_full( &ctx.fugue, hash3, in3, size );
|
||||
fugue512_full( &ctx.fugue, hash4, in4, size );
|
||||
fugue512_full( &ctx.fugue, hash5, in5, size );
|
||||
fugue512_full( &ctx.fugue, hash6, in6, size );
|
||||
fugue512_full( &ctx.fugue, hash7, in7, size );
|
||||
break;
|
||||
case SHABAL:
|
||||
intrlv_8x32( vhash, in0, in1, in2, in3, in4, in5, in6, in7,
|
||||
@@ -705,7 +682,7 @@ union _x16rv2_4way_context_overlay
|
||||
shavite512_context shavite;
|
||||
simd_2way_context simd;
|
||||
hamsi512_4way_context hamsi;
|
||||
sph_fugue512_context fugue;
|
||||
hashState_fugue fugue;
|
||||
shabal512_4way_context shabal;
|
||||
sph_whirlpool_context whirlpool;
|
||||
sha512_4way_context sha512;
|
||||
@@ -946,10 +923,10 @@ int x16rv2_4way_hash( void* output, const void* input, int thrid )
|
||||
dintrlv_4x64_512( hash0, hash1, hash2, hash3, vhash );
|
||||
break;
|
||||
case FUGUE:
|
||||
sph_fugue512_full( &ctx.fugue, hash0, in0, size );
|
||||
sph_fugue512_full( &ctx.fugue, hash1, in1, size );
|
||||
sph_fugue512_full( &ctx.fugue, hash2, in2, size );
|
||||
sph_fugue512_full( &ctx.fugue, hash3, in3, size );
|
||||
fugue512_full( &ctx.fugue, hash0, in0, size );
|
||||
fugue512_full( &ctx.fugue, hash1, in1, size );
|
||||
fugue512_full( &ctx.fugue, hash2, in2, size );
|
||||
fugue512_full( &ctx.fugue, hash3, in3, size );
|
||||
break;
|
||||
case SHABAL:
|
||||
intrlv_4x32( vhash, in0, in1, in2, in3, size<<3 );
|
||||
|
||||
@@ -8,41 +8,18 @@
|
||||
|
||||
#if !defined(X16R_8WAY) && !defined(X16R_4WAY)
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#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 <openssl/sha.h>
|
||||
#include "algo/tiger/sph_tiger.h"
|
||||
#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;
|
||||
|
||||
union _x16rv2_context_overlay
|
||||
{
|
||||
#if defined(__AES__)
|
||||
hashState_echo echo;
|
||||
hashState_groestl groestl;
|
||||
hashState_fugue fugue;
|
||||
#else
|
||||
sph_groestl512_context groestl;
|
||||
sph_echo512_context echo;
|
||||
sph_fugue512_context fugue;
|
||||
#endif
|
||||
sph_blake512_context blake;
|
||||
sph_bmw512_context bmw;
|
||||
@@ -54,7 +31,6 @@ union _x16rv2_context_overlay
|
||||
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;
|
||||
@@ -160,8 +136,12 @@ int x16rv2_hash( void* output, const void* input, int thrid )
|
||||
sph_hamsi512_close( &ctx.hamsi, hash );
|
||||
break;
|
||||
case FUGUE:
|
||||
#if defined(__AES__)
|
||||
fugue512_full( &ctx.fugue, hash, in, size );
|
||||
#else
|
||||
sph_fugue512_full( &ctx.fugue, hash, in, size );
|
||||
break;
|
||||
#endif
|
||||
break;
|
||||
case SHABAL:
|
||||
sph_shabal512_init( &ctx.shabal );
|
||||
sph_shabal512( &ctx.shabal, in, size );
|
||||
|
||||
Reference in New Issue
Block a user