Designing $3$-bit input/output function

50 Views Asked by At

I want to find a function(S-box) (if it exists) such that $S(x) \not = x$ for every input $x$ and also changing each single bit causes at least two bit changes. This means that if we take $S(000) = abc$, the value of $S(001)$ should be $a'b'c$, $ab'c'$, $a'bc'$ or $a'b'c'$. Intuitively, putting the first condition aside, it seems that we can't have such a function because there aren't enough possibilities to cover all the possible single bit changes. I mean we have only $8$ outputs but many more single bit changes can happen. $$\require{AMScd} \begin{CD} 100 @>>> 000 @>>> 001 @>>> 101\\ @V V V @VV V @VVV @VVV\\ 110 @>>> 010 @>>> 011 @>>> 111 \end{CD}$$ How can we formally prove that such a function doesn't exist? Also what can be said about functions with $m$-bit input and $n$-bit output that have this property? I mean is there any general condition for existence of a function such that every $t$ bits changes of the input leads to at least $s$ bits changes of the output where $t\le m$ and $s\le n$?