This commit is contained in:
Jay D Dee
2023-10-25 20:36:20 -04:00
parent 31c4dedf59
commit 160608cce5
180 changed files with 10318 additions and 13097 deletions

View File

@@ -87,45 +87,38 @@ int hex_hash( void* output, const void* input, int thrid )
case LUFFA:
if ( i == 0 )
{
#if defined(__aarch64__)
sph_luffa512(&ctx.luffa, (const void*) in+64, 16 );
sph_luffa512_close(&ctx.luffa, hash);
#else
update_and_final_luffa( &ctx.luffa, (BitSequence*)hash,
(const BitSequence*)in+64, 16 );
#endif
update_and_final_luffa( &ctx.luffa, hash, (const void*)in+64, 16 );
}
else
{
#if defined(__aarch64__)
sph_luffa512_init(&ctx.luffa );
sph_luffa512(&ctx.luffa, (const void*) in, size );
sph_luffa512_close(&ctx.luffa, hash);
#else
init_luffa( &ctx.luffa, 512 );
update_and_final_luffa( &ctx.luffa, (BitSequence*)hash,
(const BitSequence*)in, size );
#endif
update_and_final_luffa( &ctx.luffa, hash, in, size );
}
break;
case CUBEHASH:
if ( i == 0 )
cubehashUpdateDigest( &ctx.cube, (byte*)hash,
(const byte*)in+64, 16 );
cubehashUpdateDigest( &ctx.cube, hash, (const void*)in+64, 16 );
else
{
cubehashInit( &ctx.cube, 512, 16, 32 );
cubehashUpdateDigest( &ctx.cube, (byte*)hash,
(const byte*)in, size );
cubehashUpdateDigest( &ctx.cube, hash, in, size );
}
break;
case SHAVITE:
shavite512_full( &ctx.shavite, hash, in, size );
break;
case SIMD:
#if defined(__aarch64__)
sph_simd512_init( &ctx.simd );
sph_simd512(&ctx.simd, (const void*) hash, 64);
sph_simd512_close(&ctx.simd, hash);
#else
simd_full( &ctx.simd, (BitSequence *)hash,
(const BitSequence*)in, size<<3 );
init_sd( &ctx.simd, 512 );
update_final_sd( &ctx.simd, (BitSequence *)hash,
(const BitSequence*)in, size<<3 );
#endif
break;
case ECHO:
#if defined(__AES__)
@@ -231,17 +224,12 @@ int scanhash_hex( struct work *work, uint32_t max_nonce,
sph_skein512( &hex_ctx.skein, edata, 64 );
break;
case LUFFA:
#if defined(__aarch64__)
sph_luffa512_init(&hex_ctx.luffa );
sph_luffa512(&hex_ctx.luffa, (const void*) edata, 64);
#else
init_luffa( &hex_ctx.luffa, 512 );
update_luffa( &hex_ctx.luffa, (const BitSequence*)edata, 64 );
#endif
update_luffa( &hex_ctx.luffa, edata, 64 );
break;
case CUBEHASH:
cubehashInit( &hex_ctx.cube, 512, 16, 32 );
cubehashUpdate( &hex_ctx.cube, (const byte*)edata, 64 );
cubehashUpdate( &hex_ctx.cube, edata, 64 );
break;
case HAMSI:
sph_hamsi512_init( &hex_ctx.hamsi );

View File

@@ -12,26 +12,29 @@
#include "algo/skein/sph_skein.h"
#include "algo/shavite/sph_shavite.h"
#include "algo/cubehash/cubehash_sse2.h"
#include "algo/simd/nist.h"
#if defined(__aarch64__)
#include "algo/simd/sph_simd.h"
#include "algo/luffa/sph_luffa.h"
#endif
#include "algo/hamsi/sph_hamsi.h"
#include "algo/shabal/sph_shabal.h"
#include "algo/whirlpool/sph_whirlpool.h"
#include "algo/sha/sph_sha2.h"
#include "algo/yespower/yespower.h"
#if defined(__AES__)
#if defined(__AES__) || defined(__ARM_FEATURE_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"
#endif
#if defined(__AES__)
#include "algo/fugue/fugue-aesni.h"
#else
#include "algo/fugue/sph_fugue.h"
#endif
#if defined(__aarch64__)
#include "algo/luffa/sph_luffa.h"
#else
#include "algo/luffa/luffa_for_sse2.h"
#endif
#include "algo/luffa/luffa_for_sse2.h"
#include "algo/simd/nist.h"
// Config
#define MINOTAUR_ALGO_COUNT 16
@@ -45,32 +48,39 @@ typedef struct TortureGarden TortureGarden;
// Graph of hash algos plus SPH contexts
struct TortureGarden
{
#if defined(__AES__) || defined(__ARM_FEATURE_AES)
hashState_echo echo;
hashState_groestl groestl;
#else
sph_echo512_context echo;
sph_groestl512_context groestl;
#endif
#if defined(__AES__)
hashState_echo echo;
hashState_groestl groestl;
hashState_fugue fugue;
hashState_fugue fugue;
#else
sph_echo512_context echo;
sph_groestl512_context groestl;
sph_fugue512_context fugue;
sph_fugue512_context fugue;
#endif
blake512_context blake;
sph_bmw512_context bmw;
sph_skein512_context skein;
sph_jh512_context jh;
sph_keccak512_context keccak;
blake512_context blake;
sph_bmw512_context bmw;
sph_skein512_context skein;
sph_jh512_context jh;
sph_keccak512_context keccak;
cubehashParam cube;
shavite512_context shavite;
#if defined(__aarch64__)
sph_luffa512_context luffa;
sph_luffa512_context luffa;
#else
hashState_luffa luffa;
hashState_luffa luffa;
#endif
cubehashParam cube;
shavite512_context shavite;
hashState_sd simd;
sph_hamsi512_context hamsi;
sph_shabal512_context shabal;
sph_whirlpool_context whirlpool;
sph_sha512_context sha512;
#if defined(__aarch64__)
sph_simd512_context simd;
#else
hashState_sd simd;
#endif
sph_hamsi512_context hamsi;
sph_shabal512_context shabal;
sph_whirlpool_context whirlpool;
sph_sha512_context sha512;
struct TortureNode
{
unsigned int algo;
@@ -88,28 +98,26 @@ static int get_hash( void *output, const void *input, TortureGarden *garden,
switch ( algo )
{
case 0:
blake512_init(&garden->blake);
blake512_update(&garden->blake, input, 64);
blake512_close(&garden->blake, hash);
blake512_init( &garden->blake );
blake512_update( &garden->blake, input, 64 );
blake512_close( &garden->blake, hash );
break;
case 1:
sph_bmw512_init(&garden->bmw);
sph_bmw512(&garden->bmw, input, 64);
sph_bmw512_close(&garden->bmw, hash);
sph_bmw512_init( &garden->bmw );
sph_bmw512( &garden->bmw, input, 64 );
sph_bmw512_close( &garden->bmw, hash );
break;
case 2:
cubehashInit( &garden->cube, 512, 16, 32 );
cubehashUpdateDigest( &garden->cube, (byte*)hash,
(const byte*)input, 64 );
cubehashUpdateDigest( &garden->cube, hash, input, 64 );
break;
case 3:
#if defined(__AES__)
echo_full( &garden->echo, (BitSequence *)hash, 512,
(const BitSequence *)input, 64 );
#if defined(__AES__) || defined(__ARM_FEATURE_AES)
echo_full( &garden->echo, hash, 512, input, 64 );
#else
sph_echo512_init(&garden->echo);
sph_echo512(&garden->echo, input, 64);
sph_echo512_close(&garden->echo, hash);
sph_echo512_init( &garden->echo );
sph_echo512( &garden->echo, input, 64 );
sph_echo512_close( &garden->echo, hash );
#endif
break;
case 4:
@@ -120,18 +128,18 @@ static int get_hash( void *output, const void *input, TortureGarden *garden,
#endif
break;
case 5:
#if defined(__AES__)
groestl512_full( &garden->groestl, (char*)hash, (char*)input, 512 );
#if defined(__AES__) || defined(__ARM_FEATURE_AES)
groestl512_full( &garden->groestl, hash, input, 512 );
#else
sph_groestl512_init(&garden->groestl);
sph_groestl512(&garden->groestl, input, 64);
sph_groestl512_close(&garden->groestl, hash);
sph_groestl512_init( &garden->groestl) ;
sph_groestl512( &garden->groestl, input, 64 );
sph_groestl512_close( &garden->groestl, hash );
#endif
break;
case 6:
sph_hamsi512_init(&garden->hamsi);
sph_hamsi512(&garden->hamsi, input, 64);
sph_hamsi512_close(&garden->hamsi, hash);
sph_hamsi512_init( &garden->hamsi );
sph_hamsi512( &garden->hamsi, input, 64 );
sph_hamsi512_close( &garden->hamsi, hash );
break;
case 7:
sph_sha512_init( &garden->sha512 );
@@ -139,50 +147,52 @@ static int get_hash( void *output, const void *input, TortureGarden *garden,
sph_sha512_close( &garden->sha512, hash );
break;
case 8:
sph_jh512_init(&garden->jh);
sph_jh512(&garden->jh, input, 64);
sph_jh512_close(&garden->jh, hash);
sph_jh512_init( &garden->jh );
sph_jh512( &garden->jh, input, 64 );
sph_jh512_close( &garden->jh, hash );
break;
case 9:
sph_keccak512_init(&garden->keccak);
sph_keccak512(&garden->keccak, input, 64);
sph_keccak512_close(&garden->keccak, hash);
sph_keccak512_init( &garden->keccak );
sph_keccak512( &garden->keccak, input, 64 );
sph_keccak512_close( &garden->keccak, hash );
break;
case 10:
#if defined(__aarch64__)
sph_luffa512_init(&garden->luffa );
sph_luffa512(&garden->luffa, (const void*) input, 64);
sph_luffa512_close(&garden->luffa, hash);
sph_luffa512_init( &garden->luffa );
sph_luffa512( &garden->luffa, input, 64 );
sph_luffa512_close( &garden->luffa, hash );
#else
init_luffa( &garden->luffa, 512 );
update_and_final_luffa( &garden->luffa, (BitSequence*)hash,
(const BitSequence*)input, 64 );
luffa_full( &garden->luffa, hash, 512, input, 64 );
#endif
break;
case 11:
sph_shabal512_init(&garden->shabal);
sph_shabal512(&garden->shabal, input, 64);
sph_shabal512_close(&garden->shabal, hash);
sph_shabal512_init( &garden->shabal );
sph_shabal512( &garden->shabal, input, 64 );
sph_shabal512_close( &garden->shabal, hash );
break;
case 12:
sph_shavite512_init(&garden->shavite);
sph_shavite512(&garden->shavite, input, 64);
sph_shavite512_close(&garden->shavite, hash);
sph_shavite512_init( &garden->shavite );
sph_shavite512( &garden->shavite, input, 64 );
sph_shavite512_close( &garden->shavite, hash );
break;
case 13:
init_sd( &garden->simd, 512 );
update_final_sd( &garden->simd, (BitSequence *)hash,
(const BitSequence*)input, 512 );
#if defined(__aarch64__)
sph_simd512_init( &garden->simd );
sph_simd512( &garden->simd, input, 64);
sph_simd512_close( &garden->simd, hash );
#else
simd_full( &garden->simd, (BitSequence *)hash, input, 512 );
#endif
break;
case 14:
sph_skein512_init(&garden->skein);
sph_skein512(&garden->skein, input, 64);
sph_skein512_close(&garden->skein, hash);
sph_skein512_init( &garden->skein );
sph_skein512( &garden->skein, input, 64 );
sph_skein512_close( &garden->skein, hash );
break;
case 15:
sph_whirlpool_init(&garden->whirlpool);
sph_whirlpool(&garden->whirlpool, input, 64);
sph_whirlpool_close(&garden->whirlpool, hash);
sph_whirlpool_init( &garden->whirlpool );
sph_whirlpool( &garden->whirlpool, input, 64 );
sph_whirlpool_close( &garden->whirlpool, hash );
break;
case 16: // minotaurx only, yespower hardcoded for last node
rc = yespower_tls( input, 64, &minotaurx_yespower_params,
@@ -327,7 +337,7 @@ bool register_minotaur_algo( algo_gate_t* gate )
gate->scanhash = (void*)&scanhash_minotaur;
gate->hash = (void*)&minotaur_hash;
gate->miner_thread_init = (void*)&initialize_torture_garden;
gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT | AVX512_OPT;
gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT | AVX512_OPT | NEON_OPT;
if ( opt_algo == ALGO_MINOTAURX ) gate->optimizations |= SHA_OPT;
return true;
};

View File

@@ -12,8 +12,8 @@
#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"
@@ -49,9 +49,9 @@
#endif
#if defined(__aarch64__)
#include "algo/luffa/sph_luffa.h"
#include "algo/simd/sph_simd.h"
#else
#include "algo/luffa/luffa_for_sse2.h"
#include "algo/simd/nist.h"
#endif
#if defined(__AVX512F__) && defined(__AVX512VL__) && defined(__AVX512DQ__) && defined(__AVX512BW__)
@@ -206,14 +206,14 @@ union _x16r_context_overlay
sph_skein512_context skein;
sph_jh512_context jh;
sph_keccak512_context keccak;
#if defined(__aarch64__)
sph_luffa512_context luffa;
#else
hashState_luffa luffa;
#endif
cubehashParam cube;
shavite512_context shavite;
#if defined(__aarch64__)
sph_simd512_context simd;
#else
hashState_sd simd;
#endif
sph_hamsi512_context hamsi;
sph_shabal512_context shabal;
sph_whirlpool_context whirlpool;

View File

@@ -26,18 +26,12 @@ void x16r_prehash( void *edata, void *pdata )
sph_skein512( &x16_ctx.skein, edata, 64 );
break;
case LUFFA:
#if defined(__aarch64__)
sph_luffa512_init( &x16_ctx.luffa );
sph_luffa512( &x16_ctx.luffa, edata, 64 );
#else
init_luffa( &x16_ctx.luffa, 512 );
update_luffa( &x16_ctx.luffa, (const BitSequence*)edata, 64 );
#endif
update_luffa( &x16_ctx.luffa, edata, 64 );
break;
case CUBEHASH:
cubehashInit( &x16_ctx.cube, 512, 16, 32 );
cubehashUpdate( &x16_ctx.cube, (const byte*)edata, 64 );
cubehashUpdate( &x16_ctx.cube, edata, 64 );
break;
case HAMSI:
sph_hamsi512_init( &x16_ctx.hamsi );
@@ -114,38 +108,29 @@ int x16r_hash_generic( void* output, const void* input, int thrid )
sph_skein512_close( &ctx.skein, hash );
break;
case LUFFA:
#if defined(__aarch64__)
if ( i == 0 )
sph_luffa512(&ctx.luffa, in+64, 16 );
update_and_final_luffa( &ctx.luffa, hash, (const void*)in+64, 16 );
else
{
sph_luffa512_init( &ctx.luffa );
sph_luffa512( &ctx.luffa, in, size );
}
sph_luffa512_close( &ctx.luffa, hash );
#else
if ( i == 0 )
update_and_final_luffa( &ctx.luffa, (BitSequence*)hash,
(const BitSequence*)in+64, 16 );
else
luffa_full( &ctx.luffa, (BitSequence*)hash, 512,
(const BitSequence*)in, size );
#endif
luffa_full( &ctx.luffa, hash, 512, in, size );
break;
case CUBEHASH:
if ( i == 0 )
cubehashUpdateDigest( &ctx.cube, (byte*)hash,
(const byte*)in+64, 16 );
cubehashUpdateDigest( &ctx.cube, hash, (const void*)in+64, 16 );
else
cubehash_full( &ctx.cube, (byte*)hash, 512,
(byte*)in, size );
cubehash_full( &ctx.cube, hash, 512, in, size );
break;
case SHAVITE:
shavite512_full( &ctx.shavite, hash, in, size );
break;
case SIMD:
#if defined(__aarch64__)
sph_simd512_init( &ctx.simd );
sph_simd512(&ctx.simd, (const void*) hash, 64);
sph_simd512_close(&ctx.simd, hash);
#else
simd_full( &ctx.simd, (BitSequence *)hash,
(const BitSequence*)in, size<<3 );
#endif
break;
case ECHO:
#if defined(__AES__)

View File

@@ -26,14 +26,14 @@ union _x16rv2_context_overlay
sph_skein512_context skein;
sph_jh512_context jh;
sph_keccak512_context keccak;
#if defined(__aarch64__)
sph_luffa512_context luffa;
#else
hashState_luffa luffa;
#endif
cubehashParam cube;
shavite512_context shavite;
#if defined(__aarch64__)
sph_simd512_context simd;
#else
hashState_sd simd;
#endif
sph_hamsi512_context hamsi;
sph_shabal512_context shabal;
sph_whirlpool_context whirlpool;
@@ -106,28 +106,25 @@ int x16rv2_hash( void* output, const void* input, int thrid )
sph_tiger( &ctx.tiger, in, size );
sph_tiger_close( &ctx.tiger, hash );
padtiger512( hash );
#if defined(__aarch64__)
sph_luffa512_init(&ctx.luffa );
sph_luffa512(&ctx.luffa, (const void*) hash, 64);
sph_luffa512_close(&ctx.luffa, hash);
#else
init_luffa( &ctx.luffa, 512 );
update_and_final_luffa( &ctx.luffa, (BitSequence*)hash,
(const BitSequence*)hash, 64 );
#endif
update_and_final_luffa( &ctx.luffa, hash, hash, 64 );
break;
case CUBEHASH:
cubehashInit( &ctx.cube, 512, 16, 32 );
cubehashUpdateDigest( &ctx.cube, (byte*) hash,
(const byte*)in, size );
cubehashUpdateDigest( &ctx.cube, hash, in, size );
break;
case SHAVITE:
shavite512_full( &ctx.shavite, hash, in, size );
break;
case SIMD:
init_sd( &ctx.simd, 512 );
update_final_sd( &ctx.simd, (BitSequence *)hash,
(const BitSequence*)in, size<<3 );
#if defined(__aarch64__)
sph_simd512_init( &ctx.simd );
sph_simd512(&ctx.simd, (const void*) hash, 64);
sph_simd512_close(&ctx.simd, hash);
#else
simd_full( &ctx.simd, (BitSequence *)hash,
(const BitSequence*)in, size<<3 );
#endif
break;
case ECHO:
#if defined(__AES__)

View File

@@ -193,7 +193,7 @@ bool x21s_8way_thread_init()
const int64_t ROW_LEN_BYTES = ROW_LEN_INT64 * 8;
const int size = (int64_t)ROW_LEN_BYTES * 4; // nRows;
x21s_8way_matrix = _mm_malloc( 2 * size, 64 );
x21s_8way_matrix = mm_malloc( 2 * size, 64 );
return x21s_8way_matrix;
}
@@ -347,7 +347,7 @@ bool x21s_4way_thread_init()
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 );
x21s_4way_matrix = mm_malloc( size, 64 );
return x21s_4way_matrix;
}

View File

@@ -8,7 +8,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mm_malloc.h>
//#include <mm_malloc.h>
#include "algo/sha/sha256-hash.h"
#include "algo/haval/sph-haval.h"
#include "algo/tiger/sph_tiger.h"
@@ -108,7 +108,7 @@ bool x21s_thread_init()
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 );
x21s_matrix = mm_malloc( size, 64 );
return x21s_matrix;
}