I want to see a bit-sliced implementation of 5-bit and 6-bit S-Boxes of FIDES or, at least, a representation of these two functions in algebraic normal form. Where can I find it?

  • $\begingroup$ There is some code here for turning an s-box into the ANF, but this particular program seems to require that the size be a power of two. Maybe it is still a useful starting point. $\endgroup$
    – Ella Rose
    Commented Oct 26, 2019 at 13:12

1 Answer 1


You can build this youself in a very mechanical process, it's only optimizing circuit size which gets interesting.

Take a 5 bit to 5 bit S-box, each can viewed as 5 different binary functions on 5 variables.

You can trivially construct any such function. A simple (inefficient) approach is to build it in normal form: write out the 32 different input values, and take only those whose matching output is 1. You can construct an expression which is the Or between sub expressions one for each row with 1 output. Each subexpression is the and between all variables optionally negated. Each variable will be as is if it is 1 on the given row and negated otherwise. This results in a binary function for the required output bit.

You can obviously optimize this to get smaller circuits. A basic method for optimizing circuits is: https://en.m.wikipedia.org/wiki/Karnaugh_map There are many more techniques including some which reuse structure between different bits of an S box and different S boxes.

  • $\begingroup$ Does there exist an open-source implementation of FIDES with an optimized S-Boxes circuit? $\endgroup$ Commented Oct 26, 2019 at 9:51
  • $\begingroup$ I don't know of one, this is not a common cipher. $\endgroup$
    – Meir Maor
    Commented Oct 26, 2019 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.