Example #1
0
void ExpandKey(const unsigned char* masterKey, unsigned char* keys)
{
	unsigned char C[16] = {0};
	unsigned char temp1[16] = {0};
	unsigned char temp2[16] = {0};
	unsigned char j, i;

	memcpy(keys, masterKey, 16);
	memcpy(keys + 16, masterKey + 16, 16);


	for(j = 0; j < 4; ++j)
	{
		memcpy(temp1, keys + j * 2 * 16, 16);
		memcpy(temp2, keys + (j * 2 + 1) * 16, 16);

		for( i = 1; i < 8; ++i )
		{
			funcC(j*8+i, C);
			funcF(temp1, temp2, C, temp1, temp2);
		}

		funcC(j*8+8, C);
		funcF(temp1, temp2, C, temp1, temp2);

		memcpy(keys + (j * 2 + 2) * 16, temp1, 16);
		memcpy(keys + (j * 2 + 3) * 16, temp2, 16);

	}
}
Example #2
0
float funcE(float input) {
  float e=-1;
  funcF(input);
  count++;
  e++;
  return input;
}