I'd like to generate all possible 6-bit to 4-bit S-Boxes that satisfy the criteria for S-Box design given by Coppersmith, but I have a few doubts:

  1. How many such S-Boxes are possible?
  2. Is there any existing implementation of said boxes?
  3. What would be the most efficient way to implement them?

Any help is appreciated, thanks!

  • $\begingroup$ 6 to 4 bit boxes are not that many, you can just check them all for whatever criteria you choose. I think there are $2^{4 \times 6}$ different boxes, but quite a lot can be ignored straight away (e.g. if at least one input has no effect on the result or one output bit is constant). About implementation: Lookup tables are pretty much the most efficient way for any kind of S-box. $\endgroup$
    – tylo
    Sep 8, 2014 at 9:05
  • 1
    $\begingroup$ My estimate of the number of functions is wrong, I am sorry. The correct amount can be found in picarresursix answer. And those $2^{256}$ can not be iterated through. $\endgroup$
    – tylo
    Sep 8, 2014 at 12:11

2 Answers 2


For each of the $2^6$ possible inputs, there are $2^4$ possible outputs. Thus, there are $(2^4)^{2^6} = 2^{256}$ possible S-Boxes mapping 6 bits to 4 bits: you cannot exhaust this many possibilities.

You need to construct S-Boxes which satisfies all the criteria directly, in contrast to looking at all S-Boxes and then testing for the criteria.

You may have a look at "affine equivalence" to divide the search space (see e.g. [1]) and at DESL [2], a variant of DES which uses a unique S-Box satisfying most of the Coppersmith criteria as well as other ones [2].

  • [1] On the Classification of 4 Bit S-Boxes, Arithmetic of Finite Fields (2007)
  • [2] New Lightweight DES Variants, Fast Software Encryption (2007)

Take a look at this paper. It describes a very efficient DES S-box generator and gives an idea of how many exist. A naive implementation of enumerating all 6x4 s-boxes is infeasible.


  • $\begingroup$ Would you mind adding a little more detail here of what's in the paper and what the paper says is the answer to the question? "very efficient" and "idea of how many" are both very vague and probably won't be satisfying to a reader. $\endgroup$
    – SEJPM
    Oct 13, 2016 at 22:45

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.