10
$\begingroup$

So, as an exercise to greater understand some things about cryptography, I decided to try and implement GOST 28147-89, which uses eight 4x4 S-Boxes. I can grasp the concept of putting 4 bits through the S-Box and getting four out, but how would one reverse this?

Furthermore, how would one reverse uneven S-Boxes, such as DES's 6x4 S-Box, when multiple inputs give the same output (e.g., for DES's S-Box S5, where inputs of 100011, 101110, 011101, and 010000 all give an output of 1000).

$\endgroup$
0

2 Answers 2

7
$\begingroup$

Ciphers that use S-boxes are typically in the form of a Feistel network. This has the property that inverting the cipher does not involve inverting the round function, but simply applying the rounds in the opposite order. Therefore one doesn't need to invert the S-box to decrypt.

$\endgroup$
1
  • 6
    $\begingroup$ I think you should make it clear that S-boxes often ARE invertible. For instance, the S-box in AES is invertible. @Liam Inverting S-boxes can be very easy: you simply create a lookup table that reverse all the possible substitutions of the S-box. E.g. if the S-box maps 0xA5 to 0x3F (this would be an 8x8 S-box), then the inverse transformation would map 0x3F to 0xA5. Thus, you simply enumerate all the possible values the S-box can have, and create an inverse table that "undoes" all those transformations (this effectively limits how large the S-boxes can be in practice). $\endgroup$
    – hakoja
    Feb 16, 2013 at 15:54
-2
$\begingroup$

The answers sound good so far; however, they do not mention the ESSENCE: let's take the AES s-box - it is NOT providing the same result for different inputs! Therefore, there is a second s-box for each encryption s-box in AES, which is used for the reverse operation (or function). Even in Wikipedia, if you read the "s-box" or similar pages, you are provided with an s-box that is NOT invertable. I went through many frustrating moments, until I have figured out what I am writing here. Have a great life.

$\endgroup$
3
  • 1
    $\begingroup$ I am afraid you are wrong. Demonstrate where you have found an AES Sbox that's not invertible. The DES Sboxes are not, since they map all 6 bit patterns into 4 bit patterns they are not one-to-one and thus not invertible. $\endgroup$
    – kodlu
    Sep 27 at 5:39
  • 1
    $\begingroup$ If an Sbox provided the same results for different inputs, then it would not be invertible. Opposite of what you say. $\endgroup$
    – kodlu
    Sep 27 at 5:40
  • 1
    $\begingroup$ @kodlu: To me it sounds like SwissSuanpan confuses invertible with self-inverse. $\endgroup$
    – j.p.
    Sep 27 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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