This commit is contained in:
Jay D Dee
2021-09-29 17:31:16 -04:00
parent 9b905fccc8
commit 2cd1507c2e
80 changed files with 8145 additions and 2097 deletions

View File

@@ -28,7 +28,7 @@
#include "algo/echo/echo-hash-4way.h"
#endif
#if defined(__SHA__)
#include "algo/sha/sph_sha2.h"
#include "algo/sha/sha256-hash.h"
#endif
#if defined(X22I_8WAY)
@@ -51,9 +51,7 @@ union _x22i_8way_ctx_overlay
haval256_5_8way_context haval;
sph_tiger_context tiger;
sph_gost512_context gost;
#if defined(X22I_8WAY_SHA)
sph_sha256_context sha256;
#else
#if !defined(X22I_8WAY_SHA)
sha256_8way_context sha256;
#endif
#if defined(__VAES__)
@@ -391,30 +389,14 @@ int x22i_8way_hash( void *output, const void *input, int thrid )
#if defined(X22I_8WAY_SHA)
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash0, 64 );
sph_sha256_close( &ctx.sha256, output );
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash1, 64 );
sph_sha256_close( &ctx.sha256, output+32 );
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash2, 64 );
sph_sha256_close( &ctx.sha256, output+64 );
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash3, 64 );
sph_sha256_close( &ctx.sha256, output+96 );
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash4, 64 );
sph_sha256_close( &ctx.sha256, output+128 );
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash5, 64 );
sph_sha256_close( &ctx.sha256, output+160 );
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash6, 64 );
sph_sha256_close( &ctx.sha256, output+192 );
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash7, 64 );
sph_sha256_close( &ctx.sha256, output+224 );
sha256_full( hash0, hash0, 64 );
sha256_full( hash1, hash1, 64 );
sha256_full( hash2, hash2, 64 );
sha256_full( hash3, hash3, 64 );
sha256_full( hash4, hash4, 64 );
sha256_full( hash5, hash5, 64 );
sha256_full( hash6, hash6, 64 );
sha256_full( hash7, hash7, 64 );
#else
@@ -551,9 +533,7 @@ union _x22i_4way_ctx_overlay
haval256_5_4way_context haval;
sph_tiger_context tiger;
sph_gost512_context gost;
#if defined(X22I_4WAY_SHA)
sph_sha256_context sha256;
#else
#if !defined(X22I_4WAY_SHA)
sha256_4way_context sha256;
#endif
};
@@ -757,18 +737,10 @@ int x22i_4way_hash( void *output, const void *input, int thrid )
#if defined(X22I_4WAY_SHA)
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash0, 64 );
sph_sha256_close( &ctx.sha256, output );
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash1, 64 );
sph_sha256_close( &ctx.sha256, output+32 );
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash2, 64 );
sph_sha256_close( &ctx.sha256, output+64 );
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash3, 64 );
sph_sha256_close( &ctx.sha256, output+96 );
sha256_full( hash0, hash0, 64 );
sha256_full( hash1, hash1, 64 );
sha256_full( hash2, hash2, 64 );
sha256_full( hash3, hash3, 64 );
#else

View File

@@ -24,6 +24,7 @@
#include "algo/shabal/sph_shabal.h"
#include "algo/whirlpool/sph_whirlpool.h"
#include "algo/sha/sph_sha2.h"
#include "algo/sha/sha256-hash.h"
#include "algo/haval/sph-haval.h"
#include "algo/tiger/sph_tiger.h"
#include "algo/lyra2/lyra2.h"
@@ -57,7 +58,6 @@ union _x22i_context_overlay
sph_haval256_5_context haval;
sph_tiger_context tiger;
sph_gost512_context gost;
sph_sha256_context sha256;
};
typedef union _x22i_context_overlay x22i_context_overlay;
@@ -172,9 +172,7 @@ int x22i_hash( void *output, const void *input, int thrid )
sph_gost512 (&ctx.gost, (const void*) hash, 64);
sph_gost512_close(&ctx.gost, (void*) hash);
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash, 64 );
sph_sha256_close( &ctx.sha256, hash );
sha256_full( hash, hash, 64 );
memcpy(output, hash, 32);

View File

@@ -33,7 +33,7 @@
#include "algo/echo/echo-hash-4way.h"
#endif
#if defined(__SHA__)
#include "algo/sha/sph_sha2.h"
#include "algo/sha/sha256-hash.h"
#endif
void x25x_shuffle( void *hash )
@@ -84,7 +84,7 @@ union _x25x_8way_ctx_overlay
sph_tiger_context tiger;
sph_gost512_context gost;
#if defined(X25X_8WAY_SHA)
sph_sha256_context sha256;
sha256_context sha256;
#else
sha256_8way_context sha256;
#endif
@@ -447,31 +447,15 @@ int x25x_8way_hash( void *output, const void *input, int thrid )
#if defined(X25X_8WAY_SHA)
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash0[20], 64 );
sph_sha256_close( &ctx.sha256, hash0[21] );
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash1[20], 64 );
sph_sha256_close( &ctx.sha256, hash1[21] );
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash2[20], 64 );
sph_sha256_close( &ctx.sha256, hash2[21] );
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash3[20], 64 );
sph_sha256_close( &ctx.sha256, hash3[21] );
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash4[20], 64 );
sph_sha256_close( &ctx.sha256, hash4[21] );
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash5[20], 64 );
sph_sha256_close( &ctx.sha256, hash5[21] );
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash6[20], 64 );
sph_sha256_close( &ctx.sha256, hash6[21] );
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash7[20], 64 );
sph_sha256_close( &ctx.sha256, hash7[21] );
sha256_full( hash0[21], hash0[20], 64 );
sha256_full( hash1[21], hash1[20], 64 );
sha256_full( hash2[21], hash2[20], 64 );
sha256_full( hash3[21], hash3[20], 64 );
sha256_full( hash4[21], hash4[20], 64 );
sha256_full( hash5[21], hash5[20], 64 );
sha256_full( hash6[21], hash6[20], 64 );
sha256_full( hash7[21], hash7[20], 64 );
intrlv_8x32_512( vhash, hash0[21], hash1[21], hash2[21], hash3[21],
hash4[21], hash5[21], hash6[21], hash7[21] );
@@ -646,7 +630,7 @@ union _x25x_4way_ctx_overlay
sph_tiger_context tiger;
sph_gost512_context gost;
#if defined(X25X_4WAY_SHA)
sph_sha256_context sha256;
sha256_context sha256;
#else
sha256_4way_context sha256;
#endif
@@ -848,18 +832,10 @@ int x25x_4way_hash( void *output, const void *input, int thrid )
#if defined(X25X_4WAY_SHA)
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash0[20], 64 );
sph_sha256_close( &ctx.sha256, hash0[21] );
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash1[20], 64 );
sph_sha256_close( &ctx.sha256, hash1[21] );
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash2[20], 64 );
sph_sha256_close( &ctx.sha256, hash2[21] );
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, hash3[20], 64 );
sph_sha256_close( &ctx.sha256, hash3[21] );
sha256_full( hash0[21], hash0[20], 64 );
sha256_full( hash1[21], hash1[20], 64 );
sha256_full( hash2[21], hash2[20], 64 );
sha256_full( hash3[21], hash3[20], 64 );
intrlv_4x32_512( vhash, hash0[21], hash1[21], hash2[21], hash3[21] );

View File

@@ -23,7 +23,7 @@
#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/sha/sha256-hash.h"
#include "algo/haval/sph-haval.h"
#include "algo/tiger/sph_tiger.h"
#include "algo/lyra2/lyra2.h"
@@ -60,7 +60,7 @@ union _x25x_context_overlay
sph_haval256_5_context haval;
sph_tiger_context tiger;
sph_gost512_context gost;
sph_sha256_context sha256;
sha256_context sha256;
sph_panama_context panama;
blake2s_state blake2s;
};
@@ -174,9 +174,7 @@ int x25x_hash( void *output, const void *input, int thrid )
sph_gost512 (&ctx.gost, (const void*) &hash[19], 64);
sph_gost512_close(&ctx.gost, (void*) &hash[20]);
sph_sha256_init( &ctx.sha256 );
sph_sha256( &ctx.sha256, &hash[20], 64 );
sph_sha256_close( &ctx.sha256, &hash[21] );
sha256_full( &hash[21], &hash[20], 64 );
sph_panama_init(&ctx.panama);
sph_panama (&ctx.panama, (const void*) &hash[21], 64 );