I have a S-Box(lookup table) that I'm trying to test. The test involved creating a set (the details are very small and in the attachment, so its formated nicely) and checking its size. Since I'm working in a GF(2^4), that means additions and subtraction are both equivalent to a XOR.
I ran my code on a S-Box I'm sure is supposed to pass. I cant figure out why.
Anyone mind taking a look?
Thanks?
Code:int testCond1(unsigned char *sbox) { int count; for(unsigned char d_input = 1; d_input < 16; ++d_input) { for(unsigned char d_output = 1; d_output < 16; ++d_output) { count = 0; for(unsigned char x = 0; x < 16; ++x) { if(sbox[x] ^ sbox[x ^ d_input] == d_output) ++count; } if(count > 4) return 1; } } return 0; }