2 #include "algo-gate-api.h" 18 static __thread sph_whirlpool_context whirl1_mid_ctx;
22 sph_whirlpool1_init( &whirl_ctx.
whirl1 );
23 sph_whirlpool1_init( &whirl_ctx.
whirl2 );
24 sph_whirlpool1_init( &whirl_ctx.
whirl3 );
25 sph_whirlpool1_init( &whirl_ctx.
whirl4 );
31 memcpy( &ctx, &whirl_ctx,
sizeof(whirl_ctx) );
33 const int midlen = 64;
34 const int tail = 80 - midlen;
35 unsigned char hash[128];
39 memcpy( &ctx.
whirl1, &whirl1_mid_ctx,
sizeof whirl1_mid_ctx );
40 sph_whirlpool1( &ctx.
whirl1, input + midlen, tail );
41 sph_whirlpool1_close(&ctx.
whirl1, hash);
43 sph_whirlpool1(&ctx.
whirl2, hash, 64);
47 sph_whirlpool1_close(&ctx.
whirl3, hash);
49 sph_whirlpool1(&ctx.
whirl4, hash, 64);
50 sph_whirlpool1_close(&ctx.
whirl4, hash);
57 memcpy( &whirl1_mid_ctx, &whirl_ctx.
whirl1,
sizeof whirl1_mid_ctx );
58 sph_whirlpool1( &whirl1_mid_ctx, input, 64 );
62 int scanhash_whirlpool(
int thr_id,
struct work* work, uint32_t max_nonce,
unsigned long *hashes_done)
64 uint32_t _ALIGN(128) endiandata[20];
65 uint32_t* pdata = work->data;
66 uint32_t* ptarget = work->target;
67 const uint32_t first_nonce = pdata[19];
68 uint32_t n = first_nonce - 1;
73 for (
int i=0; i < 19; i++)
74 be32enc(&endiandata[i], pdata[i]);
79 const uint32_t Htarg = ptarget[7];
82 be32enc(&endiandata[19], n );
85 if (vhash[7] <= Htarg && fulltest(vhash, ptarget)) {
87 *hashes_done = n - first_nonce + 1;
91 }
while ( n < max_nonce && !work_restart[thr_id].restart);
93 *hashes_done = n - first_nonce + 1;
sph_whirlpool_context whirl4
bool register_whirlpool_algo(algo_gate_t *gate)
sph_whirlpool_context whirl2
sph_whirlpool_context whirl1
sph_whirlpool_context whirl3
void * memcpy(void *a, const void *b, size_t c)
void whirlpool_midstate(const void *input)
int scanhash_whirlpool(int thr_id, struct work *work, uint32_t max_nonce, unsigned long *hashes_done)
void init_whirlpool_ctx()
void whirlpool_hash(void *state, const void *input)