I generated this single-cycle substitution box and I want to post it as an example for understanding what a good S-box would be like. I get the feeling that this particular one is weak. Here it is (upper four bits of input are matched with the row and the lower four bits are match with the column:
AC 17 FB CB 60 93 35 50 F7 83 DF B3 8B 66 25 05
9B 16 0E 96 04 2A 95 62 FD 43 BE 37 4D 38 D9 07
E7 9C 80 3F D2 8E BA 1E 2F 36 F4 2E 2B AF A8 5A
9E 4C C0 19 82 3B 30 E9 4E DE 01 C8 15 8D 20 0B
39 CA E6 D0 F6 E3 57 D6 A3 1B 03 69 81 CE 22 AD
31 5E 57 34 70 A8 68 09 F2 B9 EA 6A 02 3E 21 78
C6 86 2C 85 6F D3 5C 2D 24 FF 92 D4 CF 18 4F B7
C5 12 FE 51 B1 B4 1C A1 97 40 C4 2F 47 F1 0A DA
F3 A2 8A 29 EE 10 32 F0 3D 48 D7 E8 6D A4 26 DC
B8 FC 91 DB A7 49 0C 5B 9F 13 F8 76 6C 11 73 58
B0 67 CD 88 44 27 75 D5 FA 8C 58 AE 14 7F 0F BB
B5 B6 46 E2 89 A6 63 08 E1 5F 1F 9D F9 98 64 79
4B 1A 42 AC D1 59 61 41 87 EB 77 A0 C2 DD CC 74
45 7D B2 8F C1 E5 99 C7 7E 3A 7B E4 F9 6E A5 7A
1D 53 56 ED 0D EC C9 71 C3 65 AB 06 EF 3C A7 5D
E0 7C 90 9A D8 06 23 A9 54 33 4A BF BD 72 84 6B
I'm noticing several things:
- There are a few places where the upper four bits of the output match the upper four bits of the byte right above or below it in the table. There are also ones where it is the lower four bits that match.
- There are a few places where the output's lower four bits match the lower four bits of the output to the left or right of it in the table. Same goes for the upper four bits.
I'm not well-versed in the art of S-box construction, but I'm getting the feeling that this one is a poor one.
What I'd like to know is: what rule for a good S-box is this one violating here and how it relates to non-linearity and all that?
Update #1
Richie Frame has pointed out that the S-box above is not bijective. Here is the correct one:
AC 17 FB CB 60 93 35 50 F7 83 DF B3 8B 66 25 05
9B 16 0E 96 04 2A 95 62 FD 43 BE 37 4D 38 D9 07
E7 9C 80 3F D2 8E BA 1E 2F 36 F4 2E 2B AF 55 5A
9E 4C C0 19 82 3B 30 E9 4E DE 01 C8 15 8D 20 0B
39 CA E6 D0 F6 E3 52 D6 A3 1B 03 69 81 CE 22 AD
31 5E 57 34 70 A8 68 09 F2 B9 EA 6A 02 3E 21 78
C6 86 2C 85 6F D3 5C 2D 24 FF 92 D4 CF 18 4F B7
C5 12 FE 51 B1 B4 1C A1 97 40 C4 28 47 F1 0A DA
F3 A2 8A 29 EE 10 32 F0 3D 48 D7 E8 6D A4 26 DC
B8 FC 91 DB A7 49 0C 5B 9F 13 F8 76 6C 11 73 AA
B0 67 CD 88 44 27 75 D5 FA 8C 58 AE 14 7F 0F BB
B5 B6 46 E2 89 A6 63 08 E1 5F 1F 9D F9 98 64 79
4B 1A 42 00 D1 59 61 41 87 EB 77 A0 C2 DD CC 74
45 7D B2 8F C1 E5 99 C7 7E 3A 7B E4 BC 6E A5 7A
1D 53 56 ED 0D EC C9 71 C3 65 AB F5 EF 3C 94 5D
E0 7C 90 9A D8 06 23 A9 54 33 4A BF BD 72 84 6B
It still has the same problems I noted before.