This commit is contained in:
Jay D Dee
2018-01-08 22:04:43 -05:00
parent 2d2e54f001
commit bee78eac76
58 changed files with 2817 additions and 499 deletions

View File

@@ -7,7 +7,7 @@
#include <string.h>
#include <stdio.h>
#include "algo/blake/blake-hash-4way.h"
#include "algo/bmw/sph_bmw.h"
#include "algo/bmw/bmw-hash-4way.h"
#include "algo/groestl/aes_ni/hash-groestl.h"
#include "algo/jh/jh-hash-4way.h"
#include "algo/keccak/keccak-hash-4way.h"
@@ -19,7 +19,7 @@
#include "algo/echo/aes_ni/hash_api.h"
#include "algo/hamsi/sph_hamsi.h"
#include "algo/fugue/sph_fugue.h"
#include "algo/shabal/sph_shabal.h"
#include "algo/shabal/shabal-hash-4way.h"
#include "algo/whirlpool/sph_whirlpool.h"
#include "algo/sha/sph_sha2.h"
#include "algo/haval/sph-haval.h"
@@ -27,7 +27,7 @@
typedef struct {
blake512_4way_context blake;
sph_bmw512_context bmw;
bmw512_4way_context bmw;
hashState_groestl groestl;
skein512_4way_context skein;
jh512_4way_context jh;
@@ -39,7 +39,7 @@ typedef struct {
hashState_echo echo;
sph_hamsi512_context hamsi;
sph_fugue512_context fugue;
sph_shabal512_context shabal;
shabal512_4way_context shabal;
sph_whirlpool_context whirlpool;
SHA512_CTX sha512;
sph_haval256_5_context haval;
@@ -52,7 +52,7 @@ static __thread blake512_4way_context xevan_blake_4way_mid
void init_xevan_4way_ctx()
{
blake512_4way_init(&xevan_4way_ctx.blake);
sph_bmw512_init(&xevan_4way_ctx.bmw);
bmw512_4way_init( &xevan_4way_ctx.bmw );
init_groestl( &xevan_4way_ctx.groestl, 64 );
skein512_4way_init(&xevan_4way_ctx.skein);
jh512_4way_init(&xevan_4way_ctx.jh);
@@ -64,7 +64,7 @@ void init_xevan_4way_ctx()
init_echo( &xevan_4way_ctx.echo, 512 );
sph_hamsi512_init( &xevan_4way_ctx.hamsi );
sph_fugue512_init( &xevan_4way_ctx.fugue );
sph_shabal512_init( &xevan_4way_ctx.shabal );
shabal512_4way_init( &xevan_4way_ctx.shabal );
sph_whirlpool_init( &xevan_4way_ctx.whirlpool );
SHA512_Init( &xevan_4way_ctx.sha512 );
sph_haval256_5_init( &xevan_4way_ctx.haval );
@@ -90,25 +90,18 @@ void xevan_4way_hash( void *output, const void *input )
xevan_4way_ctx_holder ctx __attribute__ ((aligned (64)));
memcpy( &ctx, &xevan_4way_ctx, sizeof(xevan_4way_ctx) );
// parallel way
memcpy( &ctx.blake, &xevan_blake_4way_mid,
sizeof(xevan_blake_4way_mid) );
blake512_4way( &ctx.blake, input + (midlen<<2), tail );
blake512_4way_close(&ctx.blake, vhash);
memset( &vhash[8<<2], 0, 64<<2 );
mm256_deinterleave_4x64( hash0, hash1, hash2, hash3, vhash, dataLen<<3 );
sph_bmw512( &ctx.bmw, hash0, dataLen );
sph_bmw512_close( &ctx.bmw, hash0 );
memcpy( &ctx.bmw, &xevan_4way_ctx.bmw, sizeof(sph_bmw512_context) );
sph_bmw512( &ctx.bmw, hash1, dataLen );
sph_bmw512_close( &ctx.bmw, hash1 );
memcpy( &ctx.bmw, &xevan_4way_ctx.bmw, sizeof(sph_bmw512_context) );
sph_bmw512( &ctx.bmw, hash2, dataLen );
sph_bmw512_close( &ctx.bmw, hash2 );
memcpy( &ctx.bmw, &xevan_4way_ctx.bmw, sizeof(sph_bmw512_context) );
sph_bmw512( &ctx.bmw, hash3, dataLen );
sph_bmw512_close( &ctx.bmw, hash3 );
bmw512_4way( &ctx.bmw, vhash, dataLen );
bmw512_4way_close( &ctx.bmw, vhash );
// Serial
mm256_deinterleave_4x64( hash0, hash1, hash2, hash3, vhash, dataLen<<3 );
update_and_final_groestl( &ctx.groestl, (char*)hash0, (char*)hash0,
dataLen<<3 );
@@ -122,6 +115,7 @@ void xevan_4way_hash( void *output, const void *input )
update_and_final_groestl( &ctx.groestl, (char*)hash3, (char*)hash3,
dataLen<<3 );
// Parallel 4way
mm256_interleave_4x64( vhash, hash0, hash1, hash2, hash3, dataLen<<3 );
skein512_4way( &ctx.skein, vhash, dataLen );
@@ -133,6 +127,7 @@ void xevan_4way_hash( void *output, const void *input )
keccak512_4way( &ctx.keccak, vhash, dataLen );
keccak512_4way_close( &ctx.keccak, vhash );
// Serial
mm256_deinterleave_4x64( hash0, hash1, hash2, hash3, vhash, dataLen<<3 );
update_and_final_luffa( &ctx.luffa, (BitSequence*)hash0,
@@ -222,21 +217,13 @@ void xevan_4way_hash( void *output, const void *input )
sph_fugue512( &ctx.fugue, hash3, dataLen );
sph_fugue512_close( &ctx.fugue, hash3 );
sph_shabal512( &ctx.shabal, hash0, dataLen );
sph_shabal512_close( &ctx.shabal, hash0 );
memcpy( &ctx.shabal, &xevan_4way_ctx.shabal,
sizeof(sph_shabal512_context) );
sph_shabal512( &ctx.shabal, hash1, dataLen );
sph_shabal512_close( &ctx.shabal, hash1 );
memcpy( &ctx.shabal, &xevan_4way_ctx.shabal,
sizeof(sph_shabal512_context) );
sph_shabal512( &ctx.shabal, hash2, dataLen );
sph_shabal512_close( &ctx.shabal, hash2 );
memcpy( &ctx.shabal, &xevan_4way_ctx.shabal,
sizeof(sph_shabal512_context) );
sph_shabal512( &ctx.shabal, hash3, dataLen );
sph_shabal512_close( &ctx.shabal, hash3 );
// Parallel 4way
mm_interleave_4x32( vhash, hash0, hash1, hash2, hash3, dataLen<<3 );
shabal512_4way( &ctx.shabal, vhash, dataLen );
shabal512_4way_close( &ctx.shabal, vhash );
mm_deinterleave_4x32( hash0, hash1, hash2, hash3, vhash, dataLen<<3 );
// Serial
sph_whirlpool( &ctx.whirlpool, hash0, dataLen );
sph_whirlpool_close( &ctx.whirlpool, hash0 );
memcpy( &ctx.whirlpool, &xevan_4way_ctx.whirlpool,
@@ -286,19 +273,10 @@ void xevan_4way_hash( void *output, const void *input )
blake512_4way( &ctx.blake, vhash, dataLen );
blake512_4way_close(&ctx.blake, vhash);
mm256_deinterleave_4x64( hash0, hash1, hash2, hash3, vhash, dataLen<<3 );
bmw512_4way( &ctx.bmw, vhash, dataLen );
bmw512_4way_close( &ctx.bmw, vhash );
sph_bmw512( &ctx.bmw, hash0, dataLen );
sph_bmw512_close( &ctx.bmw, hash0 );
memcpy( &ctx.bmw, &xevan_4way_ctx.bmw, sizeof(sph_bmw512_context) );
sph_bmw512( &ctx.bmw, hash1, dataLen );
sph_bmw512_close( &ctx.bmw, hash1 );
memcpy( &ctx.bmw, &xevan_4way_ctx.bmw, sizeof(sph_bmw512_context) );
sph_bmw512( &ctx.bmw, hash2, dataLen );
sph_bmw512_close( &ctx.bmw, hash2 );
memcpy( &ctx.bmw, &xevan_4way_ctx.bmw, sizeof(sph_bmw512_context) );
sph_bmw512( &ctx.bmw, hash3, dataLen );
sph_bmw512_close( &ctx.bmw, hash3 );
mm256_deinterleave_4x64( hash0, hash1, hash2, hash3, vhash, dataLen<<3 );
update_and_final_groestl( &ctx.groestl, (char*)hash0, (char*)hash0,
dataLen<<3 );
@@ -412,20 +390,10 @@ void xevan_4way_hash( void *output, const void *input )
sph_fugue512( &ctx.fugue, hash3, dataLen );
sph_fugue512_close( &ctx.fugue, hash3 );
sph_shabal512( &ctx.shabal, hash0, dataLen );
sph_shabal512_close( &ctx.shabal, hash0 );
memcpy( &ctx.shabal, &xevan_4way_ctx.shabal,
sizeof(sph_shabal512_context) );
sph_shabal512( &ctx.shabal, hash1, dataLen );
sph_shabal512_close( &ctx.shabal, hash1 );
memcpy( &ctx.shabal, &xevan_4way_ctx.shabal,
sizeof(sph_shabal512_context) );
sph_shabal512( &ctx.shabal, hash2, dataLen );
sph_shabal512_close( &ctx.shabal, hash2 );
memcpy( &ctx.shabal, &xevan_4way_ctx.shabal,
sizeof(sph_shabal512_context) );
sph_shabal512( &ctx.shabal, hash3, dataLen );
sph_shabal512_close( &ctx.shabal, hash3 );
mm_interleave_4x32( vhash, hash0, hash1, hash2, hash3, dataLen<<3 );
shabal512_4way( &ctx.shabal, vhash, dataLen );
shabal512_4way_close( &ctx.shabal, vhash );
mm_deinterleave_4x32( hash0, hash1, hash2, hash3, vhash, dataLen<<3 );
sph_whirlpool( &ctx.whirlpool, hash0, dataLen );
sph_whirlpool_close( &ctx.whirlpool, hash0 );
@@ -480,7 +448,6 @@ int scanhash_xevan_4way( int thr_id, struct work *work, uint32_t max_nonce,
{
uint32_t hash[4*8] __attribute__ ((aligned (64)));
uint32_t vdata[24*4] __attribute__ ((aligned (64)));
// uint32_t _ALIGN(64) hash[8];
uint32_t _ALIGN(64) endiandata[20];
uint32_t *pdata = work->data;
uint32_t *ptarget = work->target;