예제 #1
0
static void metishash(void *state, const void *input)
{
	metishash_context_holder ctx;

	
    uint32_t hashA[16], hashB[16];	
	
	//do one memcopy to get fresh contexts, its faster even with a larger block then issuing 9 memcopies
	memcpy(&ctx, &base_contexts, sizeof(base_contexts));
	
    sph_keccak512 (&ctx.keccak1, input, 80);
    sph_keccak512_close (&ctx.keccak1, hashA);	
	
    sph_shavite512 (&ctx.shavite1, hashA, 64);   
    sph_shavite512_close(&ctx.shavite1, hashB); 
   	
    sph_metis512 (&ctx.metis1, hashB, 64);   
    sph_metis512_close(&ctx.metis1, hashA); 
	

	memcpy(state, hashA, 32);
	
}
예제 #2
0
void metiscoin_process(minerMetiscoinBlock_t* block)
{
	sph_keccak512_context	 ctx_keccak;
	sph_shavite512_context	 ctx_shavite;
	sph_metis512_context	 ctx_metis;
	static unsigned char pblank[1];
	block->nonce = 0;

	uint32 target = *(uint32*)(block->targetShare+28);
	uint64 hash0[8];
	uint64 hash1[8];
	uint64 hash2[8];
	for(uint32 n=0; n<0x1000; n++)
	{
		if( block->height != monitorCurrentBlockHeight )
			break;
		for(uint32 f=0; f<0x8000; f++)
		{
			sph_keccak512_init(&ctx_keccak);
			sph_shavite512_init(&ctx_shavite);
			sph_metis512_init(&ctx_metis);
			sph_keccak512(&ctx_keccak, &block->version, 80);
			sph_keccak512_close(&ctx_keccak, hash0);
			sph_shavite512(&ctx_shavite, hash0, 64);
			sph_shavite512_close(&ctx_shavite, hash1);
			sph_metis512(&ctx_metis, hash1, 64);
			sph_metis512_close(&ctx_metis, hash2);
			if( *(uint32*)((uint8*)hash2+28) <= target )
			{
				totalShareCount++;
				xptMiner_submitShare(block);
			}
			block->nonce++;
		}
		totalCollisionCount += 0x8000;
	}
}