Browse Source

Fix bitblock algo code style

djm34
Elbandi 11 years ago
parent
commit
e64291e9b4
  1. 22
      algorithm/bitblock.c

22
algorithm/bitblock.c

@ -67,7 +67,7 @@ typedef struct {
sph_hamsi512_context hamsi1; sph_hamsi512_context hamsi1;
sph_fugue512_context fugue1; sph_fugue512_context fugue1;
sph_shabal512_context shabal1; sph_shabal512_context shabal1;
sph_whirlpool_context whilpool1; sph_whirlpool_context whirlpool1;
} Xhash_context_holder; } Xhash_context_holder;
static Xhash_context_holder base_contexts; static Xhash_context_holder base_contexts;
@ -89,7 +89,7 @@ void init_Bhash_contexts()
sph_hamsi512_init(&base_contexts.hamsi1); sph_hamsi512_init(&base_contexts.hamsi1);
sph_fugue512_init(&base_contexts.fugue1); sph_fugue512_init(&base_contexts.fugue1);
sph_shabal512_init(&base_contexts.shabal1); sph_shabal512_init(&base_contexts.shabal1);
sph_whirlpool_init(&base_contexts.whilpool1); sph_whirlpool_init(&base_contexts.whirlpool1);
} }
/* /*
@ -113,7 +113,7 @@ inline void bitblockhash(void *state, const void *input)
Xhash_context_holder ctx; Xhash_context_holder ctx;
uint32_t hashA[16], hashB[16]; uint32_t hashA[16], hashB[16];
//blake-bmw-groestl-sken-jh-meccak-luffa-cubehash-shivite-simd-echo
memcpy(&ctx, &base_contexts, sizeof(base_contexts)); memcpy(&ctx, &base_contexts, sizeof(base_contexts));
sph_blake512 (&ctx.blake1, input, 80); sph_blake512 (&ctx.blake1, input, 80);
@ -158,8 +158,8 @@ inline void bitblockhash(void *state, const void *input)
sph_shabal512 (&ctx.shabal1, (const unsigned char*)hashA, 64); sph_shabal512 (&ctx.shabal1, (const unsigned char*)hashA, 64);
sph_shabal512_close(&ctx.shabal1, hashB); sph_shabal512_close(&ctx.shabal1, hashB);
sph_whirlpool(&ctx.whilpool1, hashB, 64); sph_whirlpool (&ctx.whirlpool1, hashB, 64);
sph_whirlpool_close(&ctx.whilpool1, hashA); sph_whirlpool_close(&ctx.whirlpool1, hashA);
memcpy(state, hashA, 32); memcpy(state, hashA, 32);
@ -201,15 +201,6 @@ void bitblock_regenhash(struct work *work)
bitblockhash(ohash, data); bitblockhash(ohash, data);
} }
static inline void be32enc(void *pp, uint32_t x)
{
uint8_t *p = (uint8_t *)pp;
p[3] = x & 0xff;
p[2] = (x >> 8) & 0xff;
p[1] = (x >> 16) & 0xff;
p[0] = (x >> 24) & 0xff;
}
bool scanhash_bitblock(struct thr_info *thr, const unsigned char __maybe_unused *pmidstate, bool scanhash_bitblock(struct thr_info *thr, const unsigned char __maybe_unused *pmidstate,
unsigned char *pdata, unsigned char __maybe_unused *phash1, unsigned char *pdata, unsigned char __maybe_unused *phash1,
unsigned char __maybe_unused *phash, const unsigned char *ptarget, unsigned char __maybe_unused *phash, const unsigned char *ptarget,
@ -248,6 +239,3 @@ bool scanhash_bitblock(struct thr_info *thr, const unsigned char __maybe_unused
return ret; return ret;
} }

Loading…
Cancel
Save