void init_whirlcoin_hash_contexts() { sph_whirlpool1_init(&base_contexts.whirlpool1); sph_whirlpool1_init(&base_contexts.whirlpool2); sph_whirlpool1_init(&base_contexts.whirlpool3); sph_whirlpool1_init(&base_contexts.whirlpool4); }
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); }
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; }