This commit is contained in:
Jay D Dee
2017-02-22 22:47:44 -05:00
parent 4521b324e3
commit 33b1bb5cd4
31 changed files with 1597 additions and 559 deletions

View File

@@ -35,6 +35,7 @@ typedef struct
} qubit_ctx_holder;
qubit_ctx_holder qubit_ctx;
static __thread hashState_luffa qubit_luffa_mid;
void init_qubit_ctx()
{
@@ -49,16 +50,25 @@ void init_qubit_ctx()
#endif
};
void qubit_luffa_midstate( const void* input )
{
memcpy( &qubit_luffa_mid, &qubit_ctx.luffa, sizeof qubit_luffa_mid );
update_luffa( &qubit_luffa_mid, input, 64 );
}
void qubithash(void *output, const void *input)
{
unsigned char hash[128]; // uint32_t hashA[16], hashB[16];
unsigned char hash[128] __attribute((aligned(64)));
#define hashB hash+64
qubit_ctx_holder ctx;
memcpy( &ctx, &qubit_ctx, sizeof(qubit_ctx) );
update_luffa( &ctx.luffa, (const BitSequence*)input, 80 );
final_luffa( &ctx.luffa, (BitSequence*)hash);
const int midlen = 64; // bytes
const int tail = 80 - midlen; // 16
memcpy( &ctx.luffa, &qubit_luffa_mid, sizeof qubit_luffa_mid );
update_and_final_luffa( &ctx.luffa, (BitSequence*)hash,
(const BitSequence*)input + midlen, tail );
cubehashUpdate( &ctx.cubehash, (const byte*) hash,64);
cubehashDigest( &ctx.cubehash, (byte*)hash);
@@ -114,7 +124,6 @@ void qubithash_alt(void *output, const void *input)
memcpy(output, hash, 32);
}
int scanhash_qubit(int thr_id, struct work *work,
uint32_t max_nonce, uint64_t *hashes_done)
{
@@ -133,6 +142,8 @@ int scanhash_qubit(int thr_id, struct work *work,
// we need bigendian data...
swab32_array( endiandata, pdata, 20 );
qubit_luffa_midstate( endiandata );
#ifdef DEBUG_ALGO
printf("[%d] Htarg=%X\n", thr_id, Htarg);
#endif