This commit is contained in:
Jay D Dee
2023-10-06 22:18:09 -04:00
parent bc5a5c6df8
commit 31c4dedf59
144 changed files with 5931 additions and 3746 deletions

View File

@@ -86,13 +86,26 @@ int hex_hash( void* output, const void* input, int thrid )
break;
case LUFFA:
if ( i == 0 )
update_and_final_luffa( &ctx.luffa, (BitSequence*)hash,
{
#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
}
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
}
break;
case CUBEHASH:
@@ -192,7 +205,7 @@ int scanhash_hex( struct work *work, uint32_t max_nonce,
const bool bench = opt_benchmark;
if ( bench ) ptarget[7] = 0x0cff;
mm128_bswap32_80( edata, pdata );
v128_bswap32_80( edata, pdata );
static __thread uint32_t s_ntime = UINT32_MAX;
uint32_t ntime = swab32(pdata[17]);
@@ -218,8 +231,13 @@ 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
break;
case CUBEHASH:
cubehashInit( &hex_ctx.cube, 512, 16, 32 );

View File

@@ -11,7 +11,6 @@
#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/hamsi/sph_hamsi.h"
@@ -28,6 +27,11 @@
#include "algo/groestl/sph_groestl.h"
#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
// Config
#define MINOTAUR_ALGO_COUNT 16
@@ -55,7 +59,11 @@ struct TortureGarden
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;
hashState_sd simd;
@@ -141,9 +149,15 @@ static int get_hash( void *output, const void *input, TortureGarden *garden,
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);
#else
init_luffa( &garden->luffa, 512 );
update_and_final_luffa( &garden->luffa, (BitSequence*)hash,
(const BitSequence*)input, 64 );
#endif
break;
case 11:
sph_shabal512_init(&garden->shabal);
@@ -287,7 +301,7 @@ int scanhash_minotaur( struct work *work, uint32_t max_nonce,
const bool bench = opt_benchmark;
uint64_t skipped = 0;
mm128_bswap32_80( edata, pdata );
v128_bswap32_80( edata, pdata );
do
{
edata[19] = n;

View File

@@ -47,7 +47,7 @@ void x16r_8way_prehash( void *vdata, void *pdata )
case LUFFA:
{
hashState_luffa ctx_luffa;
mm128_bswap32_80( edata, pdata );
v128_bswap32_80( edata, pdata );
intrlv_8x64( vdata, edata, edata, edata, edata,
edata, edata, edata, edata, 640 );
init_luffa( &ctx_luffa, 512 );
@@ -63,7 +63,7 @@ void x16r_8way_prehash( void *vdata, void *pdata )
case CUBEHASH:
{
cubehashParam ctx_cube;
mm128_bswap32_80( edata, pdata );
v128_bswap32_80( edata, pdata );
intrlv_8x64( vdata, edata, edata, edata, edata,
edata, edata, edata, edata, 640 );
cubehashInit( &ctx_cube, 512, 16, 32 );
@@ -82,7 +82,7 @@ void x16r_8way_prehash( void *vdata, void *pdata )
hamsi512_8way_update( &x16r_ctx.hamsi, vdata, 72 );
break;
case FUGUE:
mm128_bswap32_80( edata, pdata );
v128_bswap32_80( edata, pdata );
fugue512_init( &x16r_ctx.fugue );
fugue512_update( &x16r_ctx.fugue, edata, 76 );
intrlv_8x64( vdata, edata, edata, edata, edata,
@@ -95,7 +95,7 @@ void x16r_8way_prehash( void *vdata, void *pdata )
rintrlv_8x32_8x64( vdata, vdata2, 640 );
break;
case WHIRLPOOL:
mm128_bswap32_80( edata, pdata );
v128_bswap32_80( edata, pdata );
sph_whirlpool_init( &x16r_ctx.whirlpool );
sph_whirlpool( &x16r_ctx.whirlpool, edata, 64 );
intrlv_8x64( vdata, edata, edata, edata, edata,
@@ -573,7 +573,7 @@ void x16r_4way_prehash( void *vdata, void *pdata )
case LUFFA:
{
hashState_luffa ctx_luffa;
mm128_bswap32_80( edata, pdata );
v128_bswap32_80( edata, pdata );
intrlv_4x64( vdata, edata, edata, edata, edata, 640 );
init_luffa( &ctx_luffa, 512 );
update_luffa( &ctx_luffa, (const BitSequence*)edata, 64 );
@@ -588,7 +588,7 @@ void x16r_4way_prehash( void *vdata, void *pdata )
case CUBEHASH:
{
cubehashParam ctx_cube;
mm128_bswap32_80( edata, pdata );
v128_bswap32_80( edata, pdata );
intrlv_4x64( vdata, edata, edata, edata, edata, 640 );
cubehashInit( &ctx_cube, 512, 16, 32 );
cubehashUpdate( &ctx_cube, (const byte*)edata, 64 );
@@ -605,19 +605,19 @@ void x16r_4way_prehash( void *vdata, void *pdata )
hamsi512_4way_update( &x16r_ctx.hamsi, vdata, 72 );
break;
case FUGUE:
mm128_bswap32_80( edata, pdata );
v128_bswap32_80( edata, pdata );
fugue512_init( &x16r_ctx.fugue );
fugue512_update( &x16r_ctx.fugue, edata, 76 );
intrlv_4x64( vdata, edata, edata, edata, edata, 640 );
break;
case SHABAL:
mm128_bswap32_intrlv80_4x32( vdata2, pdata );
v128_bswap32_intrlv80_4x32( vdata2, pdata );
shabal512_4way_init( &x16r_ctx.shabal );
shabal512_4way_update( &x16r_ctx.shabal, vdata2, 64 );
rintrlv_4x32_4x64( vdata, vdata2, 640 );
break;
case WHIRLPOOL:
mm128_bswap32_80( edata, pdata );
v128_bswap32_80( edata, pdata );
sph_whirlpool_init( &x16r_ctx.whirlpool );
sph_whirlpool( &x16r_ctx.whirlpool, edata, 64 );
intrlv_4x64( vdata, edata, edata, edata, edata, 640 );

View File

@@ -12,7 +12,6 @@
#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"
@@ -23,33 +22,37 @@
#include "algo/sha/sha512-hash.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"
#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/bmw/bmw-hash-4way.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/luffa/luffa-hash-2way.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/shabal/shabal-hash-4way.h"
#if defined(__VAES__)
#include "algo/groestl/groestl512-hash-4way.h"
#include "algo/shavite/shavite-hash-2way.h"
#include "algo/shavite/shavite-hash-4way.h"
#include "algo/echo/echo-hash-4way.h"
#include "algo/bmw/bmw-hash-4way.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/luffa/luffa-hash-2way.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/shabal/shabal-hash-4way.h"
#endif
#endif // AVX2
#if defined(__VAES__)
#include "algo/groestl/groestl512-hash-4way.h"
#include "algo/shavite/shavite-hash-2way.h"
#include "algo/shavite/shavite-hash-4way.h"
#include "algo/echo/echo-hash-4way.h"
#endif
#if defined(__aarch64__)
#include "algo/luffa/sph_luffa.h"
#else
#include "algo/luffa/luffa_for_sse2.h"
#endif
#if defined(__AVX512F__) && defined(__AVX512VL__) && defined(__AVX512DQ__) && defined(__AVX512BW__)
@@ -203,7 +206,11 @@ 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;
hashState_sd simd;

View File

@@ -26,8 +26,14 @@ 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
break;
case CUBEHASH:
cubehashInit( &x16_ctx.cube, 512, 16, 32 );
@@ -108,13 +114,24 @@ 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 );
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 );
break;
#endif
break;
case CUBEHASH:
if ( i == 0 )
cubehashUpdateDigest( &ctx.cube, (byte*)hash,
@@ -216,7 +233,7 @@ int scanhash_x16r( struct work *work, uint32_t max_nonce,
const bool bench = opt_benchmark;
if ( bench ) ptarget[7] = 0x0cff;
mm128_bswap32_80( edata, pdata );
v128_bswap32_80( edata, pdata );
static __thread uint32_t s_ntime = UINT32_MAX;
uint32_t ntime = bswap_32( pdata[17] );

View File

@@ -17,7 +17,7 @@ int scanhash_x16rt( struct work *work, uint32_t max_nonce,
const bool bench = opt_benchmark;
if ( bench ) ptarget[7] = 0x0cff;
mm128_bswap32_80( edata, pdata );
v128_bswap32_80( edata, pdata );
static __thread uint32_t s_ntime = UINT32_MAX;
uint32_t masked_ntime = swab32( pdata[17] ) & 0xffffff80;

View File

@@ -605,7 +605,7 @@ int scanhash_x16rv2_8way( struct work *work, uint32_t max_nonce,
case KECCAK:
case LUFFA:
case SHA_512:
mm128_bswap32_80( edata, pdata );
v128_bswap32_80( edata, pdata );
sph_tiger_init( &x16rv2_ctx.tiger );
sph_tiger( &x16rv2_ctx.tiger, edata, 64 );
intrlv_8x64( vdata, edata, edata, edata, edata,
@@ -617,7 +617,7 @@ int scanhash_x16rv2_8way( struct work *work, uint32_t max_nonce,
skein512_8way_update( &x16rv2_ctx.skein, vdata, 64 );
break;
case CUBEHASH:
mm128_bswap32_80( edata, pdata );
v128_bswap32_80( edata, pdata );
cubehashInit( &x16rv2_ctx.cube, 512, 16, 32 );
cubehashUpdate( &x16rv2_ctx.cube, (const byte*)edata, 64 );
intrlv_8x64( vdata, edata, edata, edata, edata,
@@ -635,7 +635,7 @@ int scanhash_x16rv2_8way( struct work *work, uint32_t max_nonce,
rintrlv_8x32_8x64( vdata, vdata2, 640 );
break;
case WHIRLPOOL:
mm128_bswap32_80( edata, pdata );
v128_bswap32_80( edata, pdata );
sph_whirlpool_init( &x16rv2_ctx.whirlpool );
sph_whirlpool( &x16rv2_ctx.whirlpool, edata, 64 );
intrlv_8x64( vdata, edata, edata, edata, edata,
@@ -1094,7 +1094,7 @@ int scanhash_x16rv2_4way( struct work *work, uint32_t max_nonce,
case KECCAK:
case LUFFA:
case SHA_512:
mm128_bswap32_80( edata, pdata );
v128_bswap32_80( edata, pdata );
sph_tiger_init( &x16rv2_ctx.tiger );
sph_tiger( &x16rv2_ctx.tiger, edata, 64 );
intrlv_4x64( vdata, edata, edata, edata, edata, 640 );
@@ -1104,7 +1104,7 @@ int scanhash_x16rv2_4way( struct work *work, uint32_t max_nonce,
skein512_4way_prehash64( &x16r_ctx.skein, vdata );
break;
case CUBEHASH:
mm128_bswap32_80( edata, pdata );
v128_bswap32_80( edata, pdata );
cubehashInit( &x16rv2_ctx.cube, 512, 16, 32 );
cubehashUpdate( &x16rv2_ctx.cube, (const byte*)edata, 64 );
intrlv_4x64( vdata, edata, edata, edata, edata, 640 );
@@ -1115,13 +1115,13 @@ int scanhash_x16rv2_4way( struct work *work, uint32_t max_nonce,
hamsi512_4way_update( &x16rv2_ctx.hamsi, vdata, 64 );
break;
case SHABAL:
mm128_bswap32_intrlv80_4x32( vdata32, pdata );
v128_bswap32_intrlv80_4x32( vdata32, pdata );
shabal512_4way_init( &x16rv2_ctx.shabal );
shabal512_4way_update( &x16rv2_ctx.shabal, vdata32, 64 );
rintrlv_4x32_4x64( vdata, vdata32, 640 );
break;
case WHIRLPOOL:
mm128_bswap32_80( edata, pdata );
v128_bswap32_80( edata, pdata );
sph_whirlpool_init( &x16rv2_ctx.whirlpool );
sph_whirlpool( &x16rv2_ctx.whirlpool, edata, 64 );
intrlv_4x64( vdata, edata, edata, edata, edata, 640 );

View File

@@ -26,7 +26,11 @@ 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;
hashState_sd simd;
@@ -102,9 +106,15 @@ 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
break;
case CUBEHASH:
cubehashInit( &ctx.cube, 512, 16, 32 );
@@ -183,11 +193,11 @@ int scanhash_x16rv2( struct work *work, uint32_t max_nonce,
volatile uint8_t *restart = &(work_restart[thr_id].restart);
const bool bench = opt_benchmark;
casti_m128i( edata, 0 ) = mm128_bswap_32( casti_m128i( pdata, 0 ) );
casti_m128i( edata, 1 ) = mm128_bswap_32( casti_m128i( pdata, 1 ) );
casti_m128i( edata, 2 ) = mm128_bswap_32( casti_m128i( pdata, 2 ) );
casti_m128i( edata, 3 ) = mm128_bswap_32( casti_m128i( pdata, 3 ) );
casti_m128i( edata, 4 ) = mm128_bswap_32( casti_m128i( pdata, 4 ) );
casti_v128( edata, 0 ) = v128_bswap32( casti_v128( pdata, 0 ) );
casti_v128( edata, 1 ) = v128_bswap32( casti_v128( pdata, 1 ) );
casti_v128( edata, 2 ) = v128_bswap32( casti_v128( pdata, 2 ) );
casti_v128( edata, 3 ) = v128_bswap32( casti_v128( pdata, 3 ) );
casti_v128( edata, 4 ) = v128_bswap32( casti_v128( pdata, 4 ) );
static __thread uint32_t s_ntime = UINT32_MAX;
if ( s_ntime != pdata[17] )

View File

@@ -8,6 +8,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mm_malloc.h>
#include "algo/sha/sha256-hash.h"
#include "algo/haval/sph-haval.h"
#include "algo/tiger/sph_tiger.h"
@@ -71,7 +72,7 @@ int scanhash_x21s( struct work *work, uint32_t max_nonce,
const bool bench = opt_benchmark;
if ( bench ) ptarget[7] = 0x0cff;
mm128_bswap32_80( edata, pdata );
v128_bswap32_80( edata, pdata );
static __thread uint32_t s_ntime = UINT32_MAX;
if ( s_ntime != pdata[17] )