Ejemplo n.º 1
0
void PRESENT80_enc(dqword *input, const unsigned char* userkey){
	format_input(input);
	for(int i=0; i<31; i++){
		addRoundKey(input, &rks[i]);
		sBoxLayer(input);
		pLayer(input);
	}
	addRoundKey(input, &rks[31]);
	format_output(input);
}
Ejemplo n.º 2
0
void pLayer_time(){
	//100000 runs of player to generate mean for this function
	uint32_t state[64] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
	clock_t start, end, result = 0;
	mach_timebase_info_data_t info;
	mach_timebase_info(&info);

	for(int run = 0; run < 100000; run++)	{
		start = mach_absolute_time();
		pLayer(state);
		end = mach_absolute_time();
		result += (end - start);
		for(int bit = 0; bit < 64; bit++)	{
			state[bit] = 0;
		}
	}
	printf("pLayer time: %lu\n", result / 100000);
}