mirror of
https://github.com/JayDDee/cpuminer-opt.git
synced 2025-09-17 23:44:27 +00:00
v3.5.8
This commit is contained in:
18
algo/xevan.c
18
algo/xevan.c
@@ -56,6 +56,7 @@ typedef struct {
|
||||
} xevan_ctx_holder;
|
||||
|
||||
xevan_ctx_holder xevan_ctx;
|
||||
static __thread sph_blake512_context xevan_blake_mid;
|
||||
|
||||
void init_xevan_ctx()
|
||||
{
|
||||
@@ -83,15 +84,26 @@ void init_xevan_ctx()
|
||||
#endif
|
||||
};
|
||||
|
||||
void xevan_blake512_midstate( const void* input )
|
||||
{
|
||||
memcpy( &xevan_blake_mid, &xevan_ctx.blake, sizeof xevan_blake_mid );
|
||||
sph_blake512( &xevan_blake_mid, input, 64 );
|
||||
}
|
||||
|
||||
void xevan_hash(void *output, const void *input)
|
||||
{
|
||||
uint32_t _ALIGN(64) hash[32]; // 128 bytes required
|
||||
const int dataLen = 128;
|
||||
|
||||
xevan_ctx_holder ctx;
|
||||
memcpy( &ctx, &xevan_ctx, sizeof(xevan_ctx) );
|
||||
|
||||
sph_blake512(&ctx.blake, input, 80);
|
||||
const int midlen = 64; // bytes
|
||||
const int tail = 80 - midlen; // 16
|
||||
|
||||
memcpy( &ctx.blake, &xevan_blake_mid, sizeof xevan_blake_mid );
|
||||
sph_blake512( &ctx.blake, input + midlen, tail );
|
||||
|
||||
// sph_blake512(&ctx.blake, input, 80);
|
||||
sph_blake512_close(&ctx.blake, hash);
|
||||
|
||||
memset(&hash[16], 0, 64);
|
||||
@@ -239,6 +251,8 @@ int scanhash_xevan(int thr_id, struct work *work, uint32_t max_nonce, uint64_t *
|
||||
for (int k=0; k < 19; k++)
|
||||
be32enc(&endiandata[k], pdata[k]);
|
||||
|
||||
xevan_blake512_midstate( endiandata );
|
||||
|
||||
do {
|
||||
be32enc(&endiandata[19], nonce);
|
||||
xevan_hash(hash, endiandata);
|
||||
|
||||
Reference in New Issue
Block a user