I have a problem to find the sub-key.
The system is…
For each round, we make the following stage:
We add the round key $K_i$.
Substitution : we have 8 blocks of 4 bits, and an S-box takes each block.
S = [7,3,6,1,13,9,10,11,2,12,0,4,5,15,8,14]
Permutation : circular shift of 2 to the right.
I choose the differential $\Delta(1 \implies 4)$ because after the permutation the differential trail is $\Delta(1 \implies 4 \implies 1)$. I coded in C, the algorithm to find the $K_5$, the sub key after 5 rounds.
plainText[m]
is a random message and plainText[m+1]
is plainText[m] ^ 1
(difference).
0000 0000 0000 0000 0000 0000 0000 0001
------ ------ ------ ------ ------ ------ ------ ------
| S1 | | S2 | | S3 | | S4 | | S5 | | S6 | | S7 | | S8 |
------ ------ ------ ------ ------ ------ ------ ------
0000 0000 0000 0000 0000 0000 0000 0100
\
0000 0000 0000 0000 0000 0000 0000 0001
------ ------ ------ ------ ------ ------ ------ ------
| S1 | | S2 | | S3 | | S4 | | S5 | | S6 | | S7 | | S8 |
------ ------ ------ ------ ------ ------ ------ ------
0000 0000 0000 0000 0000 0000 0000 0100
I tested the function of encryption and decryption, it operates normally. The problem is that I get a uniform array, because when I decrypted message, the differential trail is good for all the keys while normally this should not always be the case for any key for a message.
For example:
plaintText[i]=7584 and plaintText[i+1]=7585(7584 XOR 1).
In my code, for key=0,u=69b900ca
and up=645100ca
and tmp=2b131dd4
so beta=4
. For key=1,u=69b900ca
and up=645100cb
and beta=4
. The problem is that for any key, I get the same beta.