Score:0

Implementing the sbox components using lookup tables

jp flag

Does it is possible to implement the components of a SBOX tables using lookup_tables. For example for a 4-bit SBOX it is possible to obtain the component 3 using SAGE in the following way

sage: from sage.crypto.sbox import SBox
sage: S = SBox([7,6,0,4,2,5,1,3])
sage: f3 = S.component_function(3)
sage: f3.algebraic_normal_form()
x0*x1 + x0*x2 + x0 + x2

But I need to use that component several times (lime $2^{20}$), and boolean function in SAGE with substitution are so slow. Than I think it is better to use lookup tables.

poncho avatar
my flag
This appears to be a question about Sage more than cryptography
Score:1
ru flag

You are correct. The Boolean expressions for the components returned by Sage are not intended for efficient evaluation but rather to help the algebraic analysis of the cipher (e.g. as part of expressing bits of the round function or key schedule as a polynomial expression and calculating the degree thereof).

If you do want to collect data on the component function for a large number of inputs, again you are correct, the pre-computation of a look-up table is much more efficient.

Score:0
in flag

f3 in your code is a Boolean function which is basically a list of True/False values.

list(f3)                                                                                                                                                                                                                                
[False, True, False, False, True, True, True, False]
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.