Consider a slightly modified variant of the Gimli SP-box:
function spbox(s) {
x = s[0];
y = s[1];
z = s[2];
X = x ^ (z << 1) ^ ((x ^ (y | ~z)) << 1);
Y = y ^ x ^ ((y ^ (x | z)) << 1);
Z = z ^ y ^ ((z ^ (x & y)) << 1);
return [Z, Y, X]
}
Here s
is an array of three $32$-bit words, ^
is the bitwise XOR, |
is the bitwise OR, &
is the bitwise AND, ~
is the bitwise NOT, <<
is the left non-cyclic shift modulo $2^{32}$:
~11000000000000000000000000000000 = 00111111111111111111111111111111,
11000000000000000000000000000000 << 1 = 10000000000000000000000000000000.
What is the inverse function of spbox
(in the C-like pseudocode)?
invspbox
function. Based on this information, I tried to write the inverse for the modifiedspbox
, but my algorithm did not output the correct results. $\endgroup$spbox
for all possible triples of 4-bit and 6-bit words (instead of 32-bit words), and it seems that the function is bijective (which implies that it is invertible). $\endgroup$Z = z ^ y ^ ((z ^ (x & y)) << 1)
the $&$ make is non-bijective. Consider that when $y=[0,\ldots,0]$ then for any value of $x$ the $(x \& y)$ Is zero. The other values are x-or and shifts that cannot make it bijective. $\endgroup$