# Is the following s-box more linear or more non-linear?

I am trying to figure out whether the following simple s-box configuration I created is more linear than non-linear or vice versa more non-linear than linear?

The parameters for this 16*4 table of 64 values, is it takes any arbitrary 6-bit binary string, and uses the left-most column for the outer-bits (first and last) and top-row for the inner 4-bits as lookup values, to output a 4 bit final value.

Example: a binary value of 101010, starts with 1 and ends with 0 so the third row would be used for part of the coordinate lookup value, and the inner bits of 0101 correspond to the sixth column and point to the coordinate 1111. So an binary value of 101010 would transform to 1111.

This s-box was created using a deterministic process involving XOR and one of the conditions it meets for non-linearity is that each output has 4 pre-images, but I am otherwise not sure if it is totally linear or to what degree, if any, it has non-linearity and other desired s-box properties such as discussed here: Desirable S-box properties

Sidenote: It also has a balanced hamming distance of all values, not sure if that is applicable either helping or hurting it one way or another.

P.S. There have been other questions about s-box linearity but those used AES-'s s-box How are the AES S-Boxes calculated? or the one from DES S-box basic question.

• Steve, it looks like this to me Jul 1 '19 at 22:51
• Thanks @PaulUszak, do you know how to format it to resize it? In the meantime, I'll add it as a photo. Jul 2 '19 at 6:03
• please define the parameters. is it a 6-bit to 4-bit mapping? like DES sboxes? Jul 2 '19 at 6:22
• Yes, pardon added that now. Jul 2 '19 at 6:26
• Sorry, but I don't. I also don't have your patience to type all of that in so I'd just screen grab it as an image :-( The other thing to note re. AES, is that this one isn't invertable, whereas AES' is. Jul 2 '19 at 9:38

In general for any Sbox map $$S:\{0,1\}^n\rightarrow\{0,1\}^m$$ the map is linear or affine if and only if some Walsh-Hadamard transform coefficient of the function $$b \cdot S(X)$$ with $$n$$ bit input $$X$$ takes on the value $$\pm 2^{n},$$ for some $$b \neq0,$$ $$b\in \{0,1\}^m.$$