void whirlpool_hash(const char* input, char* output) { sph_whirlpool1_context ctx_whirlpool; uint32_t hash[16]; sph_whirlpool1_init(&ctx_whirlpool); sph_whirlpool1 (&ctx_whirlpool, input, 80); sph_whirlpool1_close (&ctx_whirlpool, hash); memcpy(output, hash, 32); }
static void WhirlCoinHash(void *state, const void *input,int mode) { uint32_t hashA[16],hashB[16]; sph_whirlpool1_context ctx_whirlpool; sph_whirlpool1_init(&ctx_whirlpool); sph_whirlpool1 (&ctx_whirlpool, input, 80); sph_whirlpool1_close(&ctx_whirlpool, hashA); sph_whirlpool1_init(&ctx_whirlpool); sph_whirlpool1 (&ctx_whirlpool, hashA, 64); sph_whirlpool1_close(&ctx_whirlpool, hashB); sph_whirlpool1_init(&ctx_whirlpool); sph_whirlpool1 (&ctx_whirlpool, hashB, 64); sph_whirlpool1_close(&ctx_whirlpool, hashA); sph_whirlpool1_init(&ctx_whirlpool); sph_whirlpool1 (&ctx_whirlpool, hashA, 64); sph_whirlpool1_close(&ctx_whirlpool, hashB); memcpy(state, hashB, 32); }
inline void whirlcoin_hash(void *state, const void *input) { init_whirlcoin_hash_contexts(); Whash_context_holder ctx; uint32_t hashA[16], hashB[16]; memcpy(&ctx, &base_contexts, sizeof(base_contexts)); sph_whirlpool1 (&ctx.whirlpool1, input, 80); sph_whirlpool1_close (&ctx.whirlpool1, hashA); sph_whirlpool1(&ctx.whirlpool2, hashA, 64); sph_whirlpool1_close(&ctx.whirlpool2, hashB); sph_whirlpool1(&ctx.whirlpool3, hashB, 64); sph_whirlpool1_close(&ctx.whirlpool3, hashA); sph_whirlpool1(&ctx.whirlpool4, hashA, 64); sph_whirlpool1_close(&ctx.whirlpool4, hashB); memcpy(state, hashB, 32); }
static int crypt_1(int *pcount, struct db_salt *salt) { int count = *pcount; int index = 0; #ifdef _OPENMP #pragma omp parallel for for (index = 0; index < count; index++) #endif { sph_whirlpool1_context ctx; sph_whirlpool1_init(&ctx); sph_whirlpool1(&ctx, saved_key[index], strlen(saved_key[index])); sph_whirlpool1_close(&ctx, (unsigned char*)crypt_out[index]); } return count; }