Next Article in Journal
Analysis of Power Allocation for NOMA-Based D2D Communications Using GADIA
Previous Article in Journal
TextQ—A User Friendly Tool for Exploratory Text Analysis
Previous Article in Special Issue
Profiling Attack against RSA Key Generation Based on a Euclidean Algorithm
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Probabilistic Evaluation of the Exploration–Exploitation Balance during the Search, Using the Swap Operator, for Nonlinear Bijective S-Boxes, Resistant to Power Attacks

by
Carlos Miguel Legón-Pérez
1,
Jorge Ariel Menéndez-Verdecía
2,
Ismel Martínez-Díaz
1,
Guillermo Sosa-Gómez
3,*,
Omar Rojas
3,4 and
Germania del Roció Veloz-Remache
2
1
Institute of Cryptography, University of Havana, Havana 10400, Cuba
2
Facultad de Informática y Electrónica, Escuela Superior Politécnica de Chimborazo, Riobamba 060155, Ecuador
3
Facultad de Ciencias Económicas y Empresariales, Universidad Panamericana, Álvaro del Portillo 49, Zapopan 45010, Mexico
4
Faculty of Economics and Business, Universitas Airlangga, Surabaya 60286, Indonesia
*
Author to whom correspondence should be addressed.
Information 2021, 12(12), 509; https://doi.org/10.3390/info12120509
Submission received: 28 September 2021 / Revised: 23 November 2021 / Accepted: 3 December 2021 / Published: 8 December 2021
(This article belongs to the Special Issue Side Channel Attacks and Defenses on Cryptography)

Abstract

:
During the search for S-boxes resistant to Power Attacks, the S-box space has recently been divided into Hamming Weight classes, according to its theoretical resistance to these attacks using the metric variance of the confusion coefficient. This partition allows for reducing the size of the search space. The swap operator is frequently used when searching with a random selection of items to be exchanged. In this work, the theoretical probability of changing Hamming Weight class of the S-box is calculated when the swap operator is applied randomly in a permutation. The precision of these probabilities is confirmed experimentally. Its limit and a recursive formula are theoretically proved. It is shown that this operator changes classes with high probability, which favors the exploration of the Hamming Weight class of S-boxes space but dramatically reduces the exploitation within classes. These results are generalized, showing that the probability of moving within the same class is substantially reduced by applying two swaps. Based on these results, it is proposed to modify/improve the use of the swap operator, replacing its random application with the appropriate selection of the elements to be exchanged, which allows taking control of the balance between exploration and exploitation. The calculated probabilities show that the random application of the swap operator is inappropriate during the search for nonlinear S-boxes resistant to Power Attacks since the exploration may be inappropriate when the class is resistant to Differential Power Attack. It would be more convenient to search for nonlinear S-boxes within the class. This result provides new knowledge about the influence of this operator in the balance exploration–exploitation. It constitutes a valuable tool to improve the design of future algorithms for searching S-boxes with good cryptography properties. In a probabilistic way, our main theoretical result characterizes the influence of the swap operator in the exploration–exploitation balance during the search for S-boxes resistant to Power Attacks in the Hamming Weight class space. The main practical contribution consists of proposing modifications to the swap operator to control this balance better.

1. Introduction

Nowadays, side-channel attacks, in conjunction with deep learning techniques, are threatened computational systems [1,2,3]. Those systems rely on the security that emerges from cryptographic algorithms. At the lowest level, the security is provided by vector Boolean functions or S-boxes, an important component in block ciphers [4].
The search for secure S-boxes is considered as a combinatorial optimization problem given the high dimension of the search space [5] and the existence of several properties. Some of them are in contradiction with each other and redefine the problem as multi-objective [6,7,8]. S-boxes with high theoretical resistance against side-channel attacks that use power consumption as a side-channel can be found by applying heuristics methods. Many of these methods apply the swap operator over a permutation (sometimes as mutation) in the S-box space [7,9,10,11,12,13,14,15,16].
For heuristic methods over a solution space, an essential aspect that determines the efficiency is the trade-off between exploration and exploitation [17,18]. However, there are several interpretations and definitions of those concepts. From [19], we cite these definitions: “Exploration refers to the ability of a search algorithm to discover a diverse assortment of solutions, spread within different regions of the search space. On the other hand, exploitation emphasizes the idea of intensifying the search process over-promising regions of the solution space to find better solutions or improve the existing ones” and also “the relationship between an individual’s representation and the balance between exploration and exploitation is still not well understood, and more research is needed” taken from [20]. While there are metrics to analyze the trade-off in a general fashion [19,21], the different components of heuristic methods are designed to ensure the exploration, the exploitation, or both, search strategy, solution representation, operators, hybridization, etc. The exploration–exploitation balance vacuum is frequently carried out experimentally, using some of these metrics [21]. At the same time, in this work, a theoretical (probabilistic) assessment is obtained in a specific setting, which is confirmed experimentally with great precision.
In [10,22,23], a partition of S-box space into Hamming Weight classes was considered. Each class was represented by a family of sets of inputs, such that, for each set, all the outputs corresponding to inputs of that set have the same weight. All S-boxes belonging to a class showed the same theoretical resistance against Power Attacks under the Hamming Weight leakage model. The partition identifies regions of the S-box space that can either be used for exploration or exploitation, depending on the components of the heuristic search. In [7], at the second phase of the hybrid method, they were taking into account a random variable p to choose if the local search (exploitation) was applied over Hamming Weight classes or inside a class. In this case of the multi-objective function, a balanced approach is used to increase the nonlinearity [24] and the Confusion Coefficient Variance [25] of the S-boxes. Moving inside a Hamming Weight class implies focusing on nonlinearity optimization; in this case, the Confusion Coefficient Variance is constant. Moving between classes is exploitation that can be seen as exploring new regions into the solution space.
The Confusion Coefficient Variance and the remaining theoretical metrics [26,27,28] used to measure a device’s physical power drain in which a cryptographic algorithm is implemented are nothing more than theoretical abstractions. None of these models is exact, nor does it accurately capture the value of actual leakage. There is no guarantee that the physical leakage will follow the theoretical abstraction of the confusion coefficient. The design or search criteria of S-boxes based on these metrics are not enough to stop a Power Attack, but they contribute to increasing the resistance of the S-box obtained against these attacks [26]. These criteria must be complemented with other countermeasures. The search for more exact metrics constitutes an interesting line of research.
These observations prompt us to make a probabilistic evaluation of the random swap operator influence of the exploration and exploitation trade-off in the particular scenario of searching permutation, taking into account a solution space partitioned by Hamming Weight classes.
The objective of this work is to theoretically determine the influence used by the swap operator (with a random selection of the elements to be exchanged), in the very important balance between exploration and exploitation in the Hamming Weight class space, during the search for S-boxes, nonlinear bijective, resistant to Power Attacks. To achieve this objective, the probabilities p n 1 of changing Hamming Weight class by applying one swap were theoretically calculated, with a random selection of the elements to be exchanged, similarly, for two swaps. The theoretical calculation of these probabilities and the experimental confirmation of their high accuracy give a definitive answer to the problem under investigation. They precisely determine the balance between exploration and exploitation in the Hamming Weight class space during the search for resistant, nonlinear bijective S-boxes to Power Attacks. The calculated probabilities show that there is a significant imbalance (a great exploration of space is carried out, but very little exploitation), since the application of a random swap causes the Hamming Weight class to be changed with a very high probability ( 1 p n 1 ) . If two swaps are applied, this probability ( 1 p n 2 ) increases even more. The importance of this result is that the exploration may be inappropriate when the Hamming Weight class is resistant to Differential Power Attacks (high CCV value). It would be more convenient to search for nonlinear S-boxes within the class. To modify/control this imbalance, it is proposed to replace the random selection of the two elements to be exchanged, during the swap, with the selection of the elements according to their weight (equal weights or different weights). The selection of the same or different weights will depend on a parameter selected by the researcher to control the balance.

2. Preliminaries

In this section, we present some basic concepts that aid with understanding the rest of the work.
The swap operator is one of the most used operators by heuristics methods [29]. This operator is applied to create neighborhoods at single solution methods or to mutate solutions at population methods. This operator swaps two elements that are usually adjacent elements or randomly selected elements. In the rest of this work, it is assumed that the two elements are randomly selected. Sometimes, this operator works over permutation vectors and can be considered for the trade-off between exploration and exploitation.
Given a permutation σ * = ( σ 1 , σ 2 , , σ n ) and two random positions i , j ; i j , the swapped permutation σ ˙ is defined as:
σ ˙ = s w a p ( σ * ) = σ ˙ ( i ) σ * ( j ) σ ˙ ( j ) σ * ( i ) σ ˙ ( x ) σ * ( x ) , x | x i , x j
An S-box is a vector Boolean function F : { 0 , 1 } n { 0 , 1 } m , with n bits as input and m bits as output. In this work, we consider bijective S-boxes where F is a mapping from { 0 , 1 } n to { 0 , 1 } n [30]. Bijective S-boxes can be efficiently represented in a computational sense by a Look Up Table [6]. This representation only takes into account the output of the S-box and conceive the S-box itself as a permutation F = ( F ( x 0 ) , , F ( x 2 n 1 ) ) .
The Hamming Weight class of a bijective S-box F is the set of all S-boxes B that has the same vector of weights of the outputs as F, i.e., the S-box B belongs to the class of F if and only if it holds that: H W ( B ) = H W ( F ) , where
H W ( F ) = ( H W ( F ( x 0 ) ) , , H W ( F ( x 2 n 1 ) ) ) .
One of the representations of the class is precisely by means of this vector of weights of the outputs of the S-box class [22,30]. This representation is not a permutation by itself because some weights of the outputs will share the same value. Appendix B shows the AES S-box permutation vector and the vector of weights that represent its Hamming Weight class; see Table A1.
Since each output of a bijective S-box F can have a weight between 0 and n, it is possible to define n + 1 sets of inputs such as C k = { x { 0 , 1 } n | H W ( F ( x ) ) = k } , 0 k n . Given two bijective S-boxes, if their respective n + 1 sets are equal, then it can be concluded that the S-boxes belongs to the same Hamming Weight class [10,22,23]. Let F a be an S-box represented as a permutation vector ( F a ( x 0 ) , , F a ( x 2 n 1 ) ) , if the values at positions i , j , i j are swapped, then the new permutation vector F b represents a new S-box which may or may not belong to the same class as F a . F b belongs to the same Hamming Weight class of F a if and only if the weights of the output of the two elements exchanged are equal, i.e., H W ( F a ( x i ) ) = H W ( F a ( x j ) ) , which causes H W ( F a ( x i ) ) = H W ( F a ( x j ) ) = k = H W ( F b ( x i ) ) = H W ( F b ( x j ) ) . Because each class contains several S-boxes, the search space of classes is smaller than the permutation search space; a swap over a permutation that implies the new permutation belongs to a new Hamming Weight class, which also implies a movement across the class search space; see Figure 1.

3. Main Contribution: Probabilistic Evaluation of the Effect of the Swap Operator on the Exploration-Exploitation Balance during the Search in the Space of Permutations of Integers of n Bits

Our main theoretical result is presented in Propositions 1–3, which characterize, in a probabilistic way, the influence of the swap operator in the exploration–exploitation balance during the search for S-boxes nonlinear resistant to Power Attacks in the Hamming Weight class space. The main practical contribution consists of proposing modifications to the swap operator to better control this balance.

3.1. Theoretical Probabilities P n 1 of Staying in the Same Hamming Weight Class, after Applying Once, Randomly, the Swap Operator in a Permutation of the 2 n Integers of n Bits

Let the search space be formed by the set of permutations whose inputs and outputs are all integers of n bits. In [23], the ( 2 n ) ! permutations F a ( x ) of this space were partitioned into Hamming Weight (HW) classes according to the weight of their outputs. The vector ( H W ( F a ( 0 ) ) , , H W ( F a ( 2 n 1 ) ) ) of weights of the outputs of a permutation F a ( x ) is the representative of its Hamming Weight class, denoted by < F a > . It will be assumed that it is of interest to optimize some properties of the permutations and an evolutionary search method with some multi-objective function used. One of the operators used in this process will be the swap operator. In this scenario, the search within the permutations space becomes a search between classes or within Hamming Weight classes. For this work, exploration will be understood as the movement between Hamming Weight classes and exploiting the movement within a Hamming Weight class. The main result of this research is to determine the influence of the swap operator on balance between exploration and exploitation in this scenario. In previous works, this topic has been investigated in other specific problems, most of the time experimentally. Here, this problem is approached and solved theoretically, confirming the results with experiments. The solution method used will be the theoretical calculation of the probabilities P n 1 :
P n 1 = P { ( < F a > = < F b > ) / ( s w a p ( F a ( x i 1 ) , F a ( x i 2 ) ) ) } ,
of staying in the same Hamming Weight class, ( < F a > = < F b > ; e x p l o i t a t i o n ) , and the probabilities ( 1 P n 1 ) of changing class, H W ( < F a > < F b > ; e x p l o r a t i o n ) , when exactly just one swap is applied between two randomly selected items in a permutation of the 2 n , n-bit integers.
The result is generalized, calculating the probability P n 2 , when two swaps are applied, in two pairs of randomly selected elements. Using these probabilities, the exploration–exploitation balance caused by this operator in this scenario is determined, and a modification is proposed to control the balance. The exact theoretical probabilities P n 1 are calculated by the following:
Proposition 1.
( P n 1 probability of staying in the same Hamming Weight class after a random swap). Let F a ( x ) be a permutation of the 2 n , n-bit integers, and < F a > its Hamming Weight class. If two different elements F a ( x i 1 ) , F a ( x i 2 ) are randomly selected from the output of F a ( x ) , and the operator s w a p ( F a ( x i 1 ) , F a ( x i 2 ) ) is applied between them, a new permutation F b is obtained whose Hamming Weight class is denoted < F b > . Then, the probability P n 1 that the new class < F b > is equal to the previous class will be:
P n 1 = P { ( < F a > = < F b > ) / ( s w a p ( F a ( x i 1 ) , F a ( x i 2 ) ) ) } = P n 1 = 1 2 n · ( 2 n 1 ) k = 1 n 1 C ( n , k ) · ( C ( n , k ) 1 ) ,
from which the probability of class change is directly calculated: 1 P n 1 .
Example 1
(Calculation of P n 1 for n = 3 ).
P n 1 = P { ( < F a > = < F b > ) / ( s w a p ( F a ( x i 1 ) , F a ( x i 2 ) ) ) }
The necessary and sufficient condition for the class < F b > obtained after the swap to be equal to the initial class < F a > , is that the s w a p ( F a ( x i 1 ) , F a ( x i 2 ) ) is carried out between elements of equal weight: H W ( F a ( x i 1 ) ) = H W ( F a ( x i 2 ) ) [23]. For n = 3 , there are four possible weights H W ( F a ( x ) ) = k { 0 , 1 , 2 , 3 } which appear with different frequencies C ( 3 , k ) , since C ( 3 , 0 ) = C ( 3 , 3 ) = 1 , while C ( 3 , 1 ) = C ( 3 , 2 ) = 3 . The only weights repeated two or more times are k = 1 and k = 2 ; therefore, the swap of two elements of equal weight k can only be done between elements with weight k = 1 and k = 2 , it remains:
P 3 1 = k = 1 2 P { H W ( F a ( x i 1 ) ) = H W ( F a ( x i 2 ) ) = k } = P ( H W ( F a ( x i 1 ) ) = 1 ) · P { H W ( F a ( x i 2 ) ) = 1 ) / H W ( F a ( x i 1 ) ) = 1 } + P ( H W ( F a ( x i 1 ) ) = 2 ) · P { ( H W ( F a ( x i 2 ) ) = 2 ) / H W ( F a ( x i 1 ) ) = 2 }
Each element F a ( x i s ) of the permutation output can be represented as a binary vector of length n = 3 . There are 8 = 2 3 possible elements. In each addend, to calculate the first probability, it is taken into account that there are exactly C ( 3 , 1 ) = 3 elements of weights one, and C ( 3 , 2 ) = 3 of weight two, among the eight possible ones. For the second probability, the element of weight k that was previously selected ( i 1 i 2 ) must be discounted (from the favorable and possible) and [ C ( 3 , k ) 1 ] = 2 elements of weight k ( k = 1 , 2 ) to choose one, among the 7 = 2 3 1 remaining elements:
P 3 1 = k = 1 2 C ( 3 , k ) 2 3 · C ( 3 , k ) 1 ) 2 3 1 = 1 2 3 · ( 2 3 1 ) k = 1 2 C ( 3 , k ) · C ( 3 , k ) 1 = 1 ( 8 7 ) C ( 3 , 1 ) · C ( 3 , 1 ) 1 + C ( 3 , 2 ) · C ( 3 , 2 ) 1 = 1 56 · 3 · 2 + 3 · 2 = 12 56 P 3 1 = 0.2142857
P 3 1 0.2143 : It is the Probability of moving to the same Hamming Weight class after a random swap in a permutation of 8 = 2 3 elements. As can be seen, the probability P 3 1 = 0.2142 is very low even for the small value of n = 3 . This result raises questions about whether this probability increases or decreases as n increases. It will be answered in two ways, first, through its practical calculation for several n and, second, theoretically demonstrating its monotony.
Proof. 
Demonstration of Proposition 1.
The probabilities P n 1 = P { ( < F a > = < F b > ) / ( s w a p ( F a ( x i 1 ) , F a ( x i 2 ) ) ) } are obtained directly by the total probability formula. Let F a ( x i 1 ) and F a ( x i 2 ) be the two elements of the output of the S-box F a , randomly selected to do the swap, then:
P n 1 = P { ( < F a > = < F b > ) / ( s w a p ( F a ( x i 1 ) , F a ( x i 2 ) ) ) }
As the necessary and sufficient condition for the class obtained after the swap to be equal to the initial class < F a > = < F b > is that the swap is performed between elements of equal weights [23], we obtain:
P n 1 = P { H W ( F a ( x i 1 ) ) = H W ( F a ( x i 2 ) ) } .
For the weights 0 and n, there is only one element with that weight, therefore, you can only swap between elements with weights different from 0 and n, that is, H W ( F a ( x i 1 ) ) = H W ( F a ( x i 2 ) ) 0 and H W ( F a ( x i 1 ) ) = H W ( F a ( x i 2 ) ) 1 . Adding over the remaining weights:
P n 1 = k = 1 n 1 P { H W ( F a ( x i 1 ) ) = H W ( F a ( x i 2 ) ) } = k } = k = 1 n 1 P ( H W ( F a ( x i 1 ) ) = k ) · P { H W ( F a ( x i 2 ) ) = k / H W ( F a ( x i 1 ) ) = k }
Each element F a ( x i s ) of the permutation output can be represented as a binary vector of length n. In each addend, to calculate the first probability, it is taken into account that there are C ( n , k ) elements of weight k among the 2 n possible elements. For the second probability, the element of weight k that was previously selected ( i 1 i 2 ) must be discounted (from the favorable and possible), and there are C ( n , k ) 1 elements of weight k to choose one among the remaining ( 2 n 1 ) elements:
P n 1 = k = 1 n 1 C ( n , k ) 2 n · C ( n , k ) 1 2 n 1 = 1 2 n · ( 2 n 1 ) k = 1 n 1 C ( n , k ) · C ( n , k ) 1
The expressions P n 1 of the Proposition 1 are valid for any n. The values of n of greatest practical interest are n = 4 and n = 8 . The S-boxes with values of minimum and maximum n of which we have found reports are n = 3 and n = 16 [8,31,32]. The probabilities P n 1 in the range n { 3 , , 16 } are then calculated, tabulated, and plotted. Later expressions will be given that facilitate the calculation of P n 1 for values greater than n.
Table 1 and Figure 2 illustrate the high probability ( 1 P n 1 ) 0.775 of changing Hamming Weight class after a random swap. The curve of these probabilities as a function of n is shown in Figure 3.
Observed properties of P n 1 . In Table 1 and Figure 3, two properties of P n 1 are clearly seen. First, the theoretical probabilities P 1 n have a small value for any n ( P n 1 < 0.225 ) . Second, starting with n 4 , a strictly monotonous decreasing behavior of its values is clearly observed. These and other properties will be theoretically demonstrated in Proposition 2. The greatest probability of staying in the same class is reached at n = 4 with P 4 1 = 0.225 < 0.5 .
Interpretation of the probabilities P n 1 . The values of P n 1 and ( 1 P n 1 ) show that, although the elements F a ( x i 1 ) and F a ( x i 2 ) of the swap are chosen randomly, the move to another Hamming Weight class is much more likely than the move within the same class, that is, the random swap strongly favors the exploration of the Hamming Weight class space but reduces, limits, the exploitation within the Hamming Weight classes. The exploration–exploitation ratio depends on the probability P n 1 , whose values are shown in Table 1. It is observed that, as n increases, the probability P n 1 of moving to the same class decreases more and more.

3.2. Properties of the Probabilities P n 1

In this section, three properties of the probabilities P n 1 are demonstrated, which are confirmed experimentally.
Proposition 2.
(Properties of the probabilities P n 1 )
1. 
Limit expression P n 1 L of the probabilities P n 1 as n increases. It allows for approximating the value of P n 1 by a more compact limit expression P n 1 L , which facilitates the theoretical analysis of its properties and also its approximate practical calculation:
a. 
P n 1 L = lim n P n 1 = ( 2 n ) ! 2 2 n · ( n ! ) 2 .
b. 
P n 1 L 1 π n
Proof.
  • P n 1 = P { ( < F a > = < F b > ) / ( s w a p ( F a ( x i 1 ) , F a ( x i 2 ) ) ) } = 1 2 n · ( 2 n 1 ) k = 1 n 1 C ( n , k ) · C ( n , k ) 1 .
    For large values of n and for all k, this expression can be approximated superiorly, by means of a very close upper bound:
    1 2 2 n · 1 1 2 n k = 1 n 1 C ( n , k ) 2
    For C ( n , k ) 2 C ( n , k ) C ( n , k ) 2 , the differences between C ( n , k ) 2 and C ( n , k ) 2 C ( n , k ) , determine the precision of this approximation. This approximation is accurate even for small values of n, which can be verified numerically. On the other hand, for values of n, such that 1 2 n and this expression converges very quickly to:
    lim n P n 1 = lim n P { ( < F a > = < F b > ) / ( s w a p ( F a ( x i 1 ) , F a ( x i 2 ) ) ) }
    lim n 1 2 2 n · 1 1 2 n k = 0 n C ( n , k ) 2 = 1 2 2 n k = 1 n 1 C ( n , k ) 2
    = 1 2 2 n k = 0 n C ( n , k ) 2 C ( n , 0 ) 2 C ( n , n ) 2 = 1 2 2 n k = 0 n C ( n , k ) 2 2
    and applying the combinatorial identity:
    k = 0 n C ( n , k ) 2 = C ( 2 n , n ) = ( 2 n ) ! ( n ! ) 2 , whose proof can be seen in Appendix A, it remains: = 1 2 2 n · ( 2 n ) ! ( n ! ) 2 2
    1 2 2 n · ( 2 n ) ! ( n ! ) 2 = ( 2 n ) ! 2 2 n · ( n ! ) 2
    lim n P n 1 = lim n P { < F a > = < F b > / s w a p ( F a ( x i 1 ) , F a ( x i 2 ) ) } ( 2 n ) ! 2 2 n · ( n ! ) 2
  • Substituting, for large n, the Catalan number C n = 2 n ! ( n + 1 ) ! n ! = C ( 2 n , n ) ( n + 1 ) by its limit expression [33]: C n 4 n n π n .
    It remains that P n 1 L = lim n P n 1 = ( 2 n ) ! 2 2 n · ( n ! ) 2 = ( n + 1 ) ! 2 2 n n ! ( 2 n ) ! ( n + 1 ) ! · n ! = n + 1 2 2 n C n n + 1 2 2 n · 4 n n π n = n + 1 n π n
    For n > > 1 , it can be approximated by: P n 1 L 1 π n
    The principal value of this new expression is that it is even more compact and facilitates the visualization and theoretical analysis of the properties of this probability. Another practical advantage of this limiting expression is that, for arbitrarily large values of n, it substantially simplifies the calculation of this probability.
By giving values to n, this expression can be calculated and compared with the previous results.
Table 2 and Figure 4 show that there is a great coincidence between the two limit expressions of P n 1 , since the difference is in the order of the thousandths.
Although the difference is minimal, it can be seen that the limit probabilities P n 1 L are always less than those obtained by the limit of the numbers C n in Catalan.
2. 
Recursive Formula P n 1 R for P n 1 . Monotony of P n 1 .
It is another way for the recursive and approximate calculation of P n 1 and allows for determining its monotony.
P n + 1 1 R 1 1 2 ( n + 1 ) P n 1 < P n 1 ,
P n 1 is monotonic decreasing function of n.
The limit expression obtained using the Catalan numbers (part b of Proposition 2) allows us to easily observe the decreasing monotony of these probabilities since the numerator is constant and when increasing n and therefore its root. This quotient is the approximate value of probability.
Proof. The decreasing monotony of P n 1 is demonstrated, which allows us to demonstrate its convergence for large values of n and to find the exact limit.
Be part of the Property # 1 of the Proposition 2.
Since P n 1 ( 2 n ) ! 2 2 n · ( n ! ) 2 , then, for n + 1 , we get: P n + 1 1 ( 2 n + 2 ) ! 2 2 n + 2 · ( n + 1 ) ! 2
P n + 1 1 ( 2 n + 2 ) ! 2 2 n + 2 · ( n + 1 ) ! 2 = ( 2 n + 2 ) ( 2 n + 1 ) ( ( 2 n ) ! ) 2 2 2 2 n ( n + 1 ) 2 ( n ! ) 2 = ( 2 n + 2 ) ( 2 n + 1 ) 2 2 ( n + 1 ) 2 ( 2 n ) ! 2 2 n ( n ! ) 2
P n + 1 1 = 2 ( n + 1 ) ( 2 n + 1 ) 2 2 ( n + 1 ) 2 P n 1 = ( 2 n + 1 ) 2 ( n + 1 ) P n 1 = 2 ( n + 1 ) 1 2 ( n + 1 ) P n 1 = 1 1 2 ( n + 1 ) P n 1
3. 
Convergence from P n + 1 1 to P n 1 .
As n increases, the difference between successive probabilities P n 1 , P n + 1 1 ( P n + 1 1 < P n 1 ) becomes smaller and smaller, so that the value of their quotient converges to 1.
lim n P n + 1 1 P n 1 1 1 2 ( n + 1 ) n 1 .
Proof. Property # 2 (Proposition 2) indicates that the values of P n 1 decrease with increasing n, which suggests that they could converge to zero with increasing n, but Property # 3 (Proposition 2) indicates that the speed of convergence decreases with increasing n (see Figure 3). The values of P n + 1 1 decrease as n increases, but at an increasingly slower rate, so that consecutive values tend to be very close to (Figure 5). □
Example 2
( n = 4 ). Application of the limit formulas for the calculation of P n + 1 1 :
P 4 1 L = ( 2 · 4 ) ! 2 2 · 4 ( 4 ! ) 2 = 8 ! 2 8 ( 24 ) 2 = 0.2734375 P 4 1 L 0.2734 > 0.225 = P 4 1 : The limiting probability P 4 1 L is greater than the exact P 4 1 .
Example 3
( n = 4 ). Application of the recursive formula for the calculation of P n + 1 1 . In Example 1, the exact probability was obtained for
n = 3 : P 3 1 = 0.2142857
By the recursive formula:
P 4 1 R = 1 1 2 3 + 2 P 3 = ( 0.875 ) ( 0.2142857 ) = 0.18749 < P 4 1 = 0.225
The recursive probability P 4 1 R is less than the exact P 4 1 .
Observe that, for n = 4 , the following was obtained: P 4 1 R < P 4 1 < P 4 1 L .
For higher values of n, the behavior of P n 1 L and P 4 1 R will be studied in two ways: first through their calculation and comparison with P n 1 and second through the theoretical demonstration of its relationship with P n 1 . The tabulation, graphical representation, and comparison of the probabilities P n 1 L and P n 1 R are presented below.

3.2.1. Comparison of P n 1 L and P n 1 R with P n 1

Table 3 and Figure 5 show an important difference between P n 1 R and P n 1 L . It can be seen that the limiting probabilities P n 1 L of property 1 are more exact than the recursive probabilities P n 1 R of Property # 2, since:
  • P n 1 R < P n 1 for all values of n.
  • P n 1 < P n 1 L for n < 7 ,
  • P n 1 P n 1 L for n 6 . From n = 6 , the limit P n 1 L coincides with the exact P n 1 up to 2 decimal places ( P n 1 = P n 1 L ); therefore, the error e L = P n 1 L P n 1 0.00 X .
On the other hand, for the recursive ones, it is also observed, in Table 3, Table 4 and Table 5, and Figure 5, that the error e n 1 R = ( P n 1 P n 1 R ) is approximately constant, with approximately zero variance, which it can be reduced by neglecting the small finite set of values n < 6 , since they are not important for studying the limit behavior.

3.2.2. Improving the Accuracy of the Recursive Calculation P n 1 R of P n 1

For the recursive formula, the errors e R = ( P n 1 P n 1 R ) 0 , but its variance is close to zero (it vanishes for n > 7 ), which suggests using this estimate of the constant error to calculate a formula improved recursive P n + 1 1 R M , estimating the error e R = ( P n 1 P n 1 R ) and adding it to P n 1 R :
P n 1 R M = 1 1 2 n + 2 · P n 1 1 + e R ¯ , where e R ¯ = 0.0140 , for n 7 .
Figure 5 shows the increase in effectiveness, which was confirmed by comparing higher values of n with the limiting probabilities. Thus far, Properties # 1 and # 2 have been compared. Let us now look at a representation of Property # 3, which illustrates very well the convergence between successive probabilities as n increases.
It can be seen how by increasing n, the quotient P n + 1 P n (in red), converges to 1 1 2 n + 2 (in blue), which in turn converges to 1. This Figure 6 illustrates the high accuracy of Property # 3 starting from n 9 , where the coincidence is almost exact.

3.3. Experimental Validation of Propositions 1 and 2

Experiment 1. The objective of the experiment is to evaluate the practical precision of the theoretical probabilities calculated according to Proposition 1. The probabilities P n 1 will be estimated by applying M successive random swaps, starting from a randomly selected and comparing the Hamming Weight classes obtained between successive permutations.
Design of experiment 1. A permutation F was randomly generated, and its Hamming Weight class, denoted < F a > , was calculated. M successive random swaps were made from it. In each step, the Hamming Weight class obtained was calculated and compared with the previous class. The absolute and relative frequencies of changing classes and staying in the same class were calculated. The probabilities ( P n 1 ) ^ were estimated through the relative frequency of staying in the same class, and its value was compared with the theoretical P n 1 .
Results of experiment 1. Table 6 and Figure 7 show the estimated probabilities ( P n 1 ) ^ and their comparison with the theoretical P n 1 .
Discussion of the results of experiment 1. The most notable result of Table 6 and Figure 7 is the excellent fit, which is observed, for all n, between the exact theoretical probabilities P n 1 calculated using Proposition 1 with the probabilities estimated by experiment 1. These results strongly confirm the practical validity and precision of the theoretical probabilities of Proposition 1. (The theoretical probabilities are always slightly less than or equal to the estimated ones, and the fit gets better and better when the value of n is increased).
Experiment 2. The objective of the experiment is to evaluate the influence of the initial permutation on the estimated probabilities ( P n 1 ) ^ .
Design of experiment 2. The same probabilities P n 1 will be estimated, but generating M different permutations and each one of them was performed only one random swap: For n = 3 , , 16 , M = 1,000,000 were generated randomly of permutations, and each one was made a random swap. After each swap, the Hamming Weight class obtained was calculated and compared with the original Hamming Weight class. The frequency with which one changes Hamming Weight classes and the frequency with which one falls in the same Hamming Weight class were counted. The probabilities P n 1 were estimated using the relative frequencies, and their value was compared with the theoretical ones.
Results of experiment 2. Table 7 and Figure 8 show the estimated probabilities and their comparison with the theoretical ones.
Discussion of the result of Experiment 2. The first notable aspect of Table 7 and Figure 8 are the excellent fit, which is observed, for all n, between the exact theoretical probabilities P n 1 calculated by Proposition 1, with the probabilities estimated by experiment 2. On the other hand, it is observed how the estimated probabilities of experiment 2 coincide with those estimated in experiment 1 and with the theoretical ones, which shows that their values depend little on that of the initial permutation. In experiment 2, the fit is slightly better than in experiment 1, which could be explained because, in experiment 2, we started from M = 1,000,000 different initial permutations.

3.4. Generalization of Proposition 1, for Two Random Swaps

How do the probabilities P { < F a > = < F b > } and P { < F a > < F b > } change, when two pairs of elements of the initial permutation F a are chosen, and two swaps are made, one in each pair? Intuitively, it is to be expected that P { < F a > = < F b > } will decrease because, in a swap, there are restrictions on two weights, and, if two swaps are made, there are restrictions on four weights. Proposition 3 confirms that intuition, answering that question through the exact calculation of the probabilities, which will be denoted as P n 2 .
Proposition 3.
(Exact calculation of the probability P n 2 ). By randomly selecting two pairs of four different elements ( F a ( x i 1 ) , F a ( x i 2 ) ) and ( F a ( x j 1 ) , F a ( x j 2 ) ) from the output of the permutation F a ( x ) and applying within each pair the operator s w a p ( F a ( x i 1 ) , F a ( x i 2 ) ) and s w a p ( F a ( x j 1 ) , F a ( x j 2 ) ) , we obtain a new permutation F b whose class is denoted < F b > . Then, the probability that the classes < F a > and < F b > are equal after two simultaneous swaps, in two pairs of outputs of < F a > , will be:
P n 2 = P { < F a > = < F b > / s w a p ( F a ( x i 1 ) , F a ( x i 2 ) ) a n d s w a p ( F a ( x j 1 ) , F a ( x j 2 ) ) } = k = 1 n 1 C ( n , k ) · C ( n , k ) 1 · C ( n , k ) 2 · C ( n , k ) 3 2 n ( 2 n 1 ) ( 2 n 2 ) ( 2 n 3 ) + k = 1 n 2 r = 1 , r k n 1 C ( n , k ) · C ( n , k ) 1 · C ( n , r ) · C ( n , r ) 1 2 n ( 2 n 1 ) ( 2 n 2 ) ( 2 n 3 )
Proof. 
It is analogous to the proof of Proposition 1; the difference is that now there are two different cases to stay in the same Hamming Weight class—first that the four weights are equal to each other; second that the weights are equal between the elements of each pair but different between pairs, which gives rise to two different addends:
P n 2 = P { < F a > = < F b > / s w a p ( F a ( x i 1 ) , F a ( x i 2 ) ) a n d s w a p ( F a ( x j 1 ) , F a ( x j 2 ) ) } = P { H W ( F a ( x i 1 ) ) = H W ( F a ( x i 2 ) ) = H W ( F a ( x j 1 ) ) = H W ( F a ( x j 2 ) ) } + P { ( H W ( F a ( x i 1 ) ) = H W ( F a ( x i 2 ) ) ) ( H W ( F a ( x j 1 ) ) = H W ( F a ( x j 2 ) ) ) } = k = 1 n 1 P { H W ( F a ( x i 1 ) ) = H W ( F a ( x i 2 ) ) = H W ( F a ( x j 1 ) ) = H W ( F a ( x j 2 ) ) = k } + k = 1 n 2 r k n 1 P { H W ( F a ( x i 1 ) ) = H W ( F a ( x i 2 ) ) = k } · P { H W ( F a ( x j 1 ) ) = H W ( F a ( x j 2 ) ) = r } = k = 1 n 1 P { H W ( F a ( x i 1 ) ) = k } · P { ( H W ( F a ( x i 2 ) ) = k ) / ( H W ( F a ( x i 1 ) ) = k ) } · P { ( H W ( F a ( x i 3 ) ) = k ) / ( H W ( F a ( x i 1 ) ) = H W ( F a ( x i 2 ) ) = k ) } · P { ( H W ( F a ( x i 4 ) ) = k ) / ( H W ( F a ( x i 1 ) ) = H W ( F a ( x i 2 ) ) = H W ( F a ( x i 3 ) ) = k ) } + k = 1 n 2 r k n 1 P { H W ( F a ( x i 1 ) ) = k } · P { ( H W ( F a ( x i 2 ) ) = k ) / ( H W ( F a ( x i 1 ) ) = k ) } · P { ( H W ( F a ( x i 3 ) ) = r ) / ( H W ( F a ( x i 1 ) ) = H W ( F a ( x i 2 ) ) = k ) } · P { ( H W ( F a ( x i 4 ) ) = r ) / ( H W ( F a ( x i 1 ) ) = H W ( F a ( x i 2 ) ) = k a n d H W ( F a ( x i 3 ) ) = r ) }
Each element F a ( x i s ) of the output of the permutation can be represented as a binary vector of length n, with weights k { 0 , , n } . In the first addend, first probability, it is taken into account that there are C ( n , k ) elements of weight k between those 2 n elements. For the second probability, the previously selected element of weight k ( i 1 i 2 ) must be discounted and C ( n , k ) 1 elements of weight k remain to choose one among the ( 2 n 1 ) remaining items. Similarly, the elements of weight k already selected from the first addend are discounted for the two remaining probabilities. In the second summation, for the first two probabilities, it is analogous to the previous case, but for the last two probabilities, the difference is that the weight r is different from the weight k of the first two; therefore, they are not discounted in the elements of the weight sought, but in the total number of possible elements. In addition, you get:
P n 2 = P { < F a > = < F b > / s w a p ( F a ( x i 1 ) , F a ( x i 2 ) ) a n d s w a p ( F a ( x j 1 ) , F a ( x j 2 ) ) } = k = 1 n 1 C ( n , k ) 2 n · C ( n , k ) 1 2 n 1 · C ( n , k ) 2 2 n 2 · C ( n , k ) 3 2 n 3 + k = 1 n 2 r k n 1 C ( n , k ) 2 n · C ( n , k ) 1 2 n 1 · C ( n , r ) 2 n 2 · C ( n , r ) 1 2 n 3 = k = 1 n 1 C ( n , k ) · C ( n , k ) 1 · C ( n , k ) 2 · C ( n , k ) 3 2 n ( 2 n 1 ) ( 2 n 2 ) ( 2 n 3 ) + k = 1 n 2 r k n 1 C ( n , k ) · C ( n , k ) 1 · C ( n , r ) · C ( n , r ) 1 2 n ( 2 n 1 ) ( 2 n 2 ) ( 2 n 3 )

3.5. Experimental Validation of Proposition 3

Experiment 3. Estimation of the probabilities P n 2 of staying in the same class after doing two simultaneous random swaps from a pre-fixed permutation. The experiment has two objectives. The first is to evaluate the precision of the theoretical probabilities calculated according to Proposition 3, comparing them with the probabilities estimated in this experiment. The second is to compare the P n 2 probabilities obtained using two random swaps with the P n 1 obtained using a random swap to know exactly the influence of the swap number on the probability values.
Experiment 3a. Calculation of the exact theoretical probabilities P n 2 . The calculation of the exact probabilities P n 2 was implemented, according to the formulas of Proposition 3.
Experiment 3b. Estimation of the probabilities P n 2 of staying in the same Hamming Weight class after making two simultaneous random swaps from a pre-fixed permutation.
Design of experiment 3b. An initial permutation F 0 is randomly generated and its class < F 0 > is calculated. M = 1,000,000 iterations will be performed. For each iteration, r = 1 , , M , a new permutation F r is generated from the previous permutation F r 1 , randomly selecting two pairs of indices ( i 1 , i 2 ) , ( j 1 , j 2 ) , and swapping each pair: s w a p ( F r 1 ( x i 1 ) , F r 1 ( x i 2 ) ) and s w a p ( F r 1 ( x j 1 ) , F r 1 ( x j 2 ) ) . For F r , the obtained class < F r > is calculated and compared with the previous class < F r 1 > :
If < F r > = < F r = 1 > , a counter of equal classes is incremented. If < F r > < F r = 1 > , a counter of different classes is incremented. At the end of the M iterations, the probabilities ( P n 2 ) ^ are estimated, using the relative frequencies of equal classes. Comparison of these estimated probabilities ( P n 2 ) ^ , with the theoretical P n 2 . Evaluate the influence of the swap number on the probability values by comparing the probabilities P n 2 with P n 1 .

3.6. Results of Experiment 3

Discussion of the results of experiment 3. About the comparison between P n 1 (one swap) and P n 2 (two swaps), the most important difference is in the decrease of the values of P n 2 concerning P n 1 and the increase in the speed of convergence to zero, as can be seen in Figure 9. It means that, by increasing the swap number, the probability P n 2 of moving towards the same class is further reduced. This behavior is intuitively understandable since, by doing two swaps, the number of weights on which a restriction is imposed increases to move within the same class, reducing the probability. This reduction in the probability P n 2 of remaining in the same class when going from one to two swaps ( P n 2 < < P n 1 ) suggests the hypothesis that, if the number of swaps NS is increased to N S > = 3 , 4 , , the probability P n N S to change classes HW must converge to 1 (since they increase the restrictions on the number of equal weights between the elements exchanged, which is necessary to stay in the same class). This hypothesis is easily testable by direct calculation or estimation. Taking into account that P n N S 1 is equivalent to exploring the class space, this result could be applied in practice, when it is desired to explore the class space, to eliminate the check of the condition of different weights of the exchanged elements and replace it with an increase in the number of swaps. It is not clear which of the two ways of exploring the space is more efficient since, in one swap to change classes, the condition on the different weights is checked, which is eliminated by performing many NS swaps. The investigation of this aspect is an open problem that will be investigated in future works.
About fit estimation ( P n 2 ) ^ -theory P n 2 . Starting from n = 6 , a great coincidence is observed between the theoretical probabilities P n 2 and their estimation ( P n 2 ) ^ . For n < 6 , the theoretical ones are less than the estimated ones, and the difference is greater for the smaller values of n, such as n = 3 , 4 , 5 . The cause of this reduced fit for small n is unclear. It is important to note that, even for these small values of n the difference is very small, of decimals for n = 3 , 4 and hundredths for n = 5 ; see Figure 10 and Table 8.
About monotony. Comparison of the monotony of P n 2 (two swaps) with that of P n 1 (one swap). For n = 3 , 4 , 5 , a slight growth of P n 2 (and of ( P n 2 ) ^ ) is observed. From n = 6 , they begin to decrease. In the case of P n 1 , the growth was only when going from n = 3 to n = 4 . The cause of this difference is not clear.

3.7. Modification of the Swap Operator (Selection Criteria of the Elements to Be Exchanged)

The previous results show that the random application of the swap favors the exploration of the class space but drastically limits the exploitation within the classes. To control the exploration of the class space in proportion U 0 , it is necessary and sufficient to change the random selection of the elements to be exchanged and select elements of equal or different weight, depending on U 0 .
Proposed modification of the Swap.
  • Set the proportion U 0 0 , 1 that controls the balance of exploration, exploitation in the Hamming Weight class space. (The Hamming Weight class is changed with probability U 0 .)
  • Generate a random number N a in the interval 0 , 1
  • If N a U 0 , then swap between elements of different Hamming weight to explore between classes.
  • If N a < U 0 , then swap between elements of equal weight to exploit within classes.
  • Advantage. This modification allows the exploration/exploitation ratio to be easily controlled by the researcher’s decision, through the proportion U 0 of pairs of elements ( F a ( x i 1 ) , F a ( x i 2 ) ) of different weight H W ( F a ( x i 1 ) ) H W ( F a ( x i 2 ) ) that are selected, that is, the class is changed with probability U 0 .
    Comparison with the antecedents. For U 0 = 0.5 , it coincides with the swap applied in [10]. In comparison, the strategy proposed in [23] consists of taking U 0 = 0 , when Confusion Coefficient Variance (CCV) is less than the preset value (the class is changed) and U 0 = 1 , when CCV is greater than or equal to the preset value (moves within the class). As already mentioned, in the case U 0 = 1 , the check of the condition of the equal weight could be eliminated and replaced by the increase in the NS number of swaps. However, the determination of the minimum value of NS (to reduce the number of operations required by the NS swaps) that guarantees with high probability that the change of class HW is an open problem.
    The selection of the optimal U 0 parameter is a problem of great interest, but it is beyond the objectives of this work and will be investigated in future works.

3.8. Application in Search of Nonlinear S-Boxes Resistant to Power Attacks

According to the Hamming Weight class space, during the search for S-boxes, not linear resistant to Power Attacks, it is satisfied that the resistance to Power Attacks according to the CCV metric is constant within each Hamming Weight class. At the same time, the nonlinearity varies within each class [23]. For this reason, a good balance between exploration between classes and exploitation within classes is desirable. If during the exploration, Hamming Weight classes with a high value of the CCV metric are found, the search algorithm should start to exploit within these classes to search for S-boxes that meet the remaining cryptographic properties, such as nonlinearity.
The result of the work does not have a direct relationship with differential or linear attacks. Still, it does provide new knowledge about the influence of the swap operator during movement in the Hamming Weight class space of bijective S-boxes. This knowledge must be taken into account when searching for S-boxes resistant to these attacks: If the swap operator is intentionally applied to move from class to class trying to increase the resistance to power attacks (higher CCV), then S-weaker boxes before the linear attack (lower NL value). For this reason, the movement between classes Hamming Weight to raise the value of the CCV metric cannot ignore the compromise between CCV and NL, which is usually taken into account in the objective function.
The results on the values of P n 1 and P n 2 obtained in the previous sections mean that, when applying the swap operator, with a random selection of the elements to be exchanged, the search algorithm will change classes with very high probability, and it practically does not explore within classes, as illustrated in Figure 11. This figure shows how the positive answer to the question about the equality of the weights of the swapped elements (movement within the same class) occurs with very low probabilities P n 1 0.23 for one random swap and P n 2 0.06 for two random swaps.
This limitation is resolved if the modified swap, proposed in the previous section, is applied since the desired exploration can be set a priori. You can also apply the strategy proposed in [23] that recommends setting a CCV threshold and changing classes while this is not reached.

4. Conclusions

In many of the previous investigations on the search for nonlinear bijective S-boxes, resistant to Power Attacks, the S-boxes are represented as permutations, and in the search process, to move within the space of S-boxes, the swap operator is applied with random selection of the elements to be exchanged [7,9,10]. Recently in [23], the space of bijective S-boxes was partitioned into equivalence classes, denoted as Hamming Weight classes. This partition allowed us to understand that the movement within the space of S-boxes can occur within the same Hamming Weight class (intra-class) or between different classes (inter-class). All the S-boxes of the same Hamming Weight class have the same CCV value, which causes an exponential reduction of the search space when the search for S-boxes with high CCV is carried out on the Hamming Weight space (illustrated in Figure 1). The inter-class or intra-class movement is equivalent in this scenario to the exploration or exploitation of the Hamming Weight space. The exploitation–exploration balance is an essential aspect of the efficiency of any heuristic search method on a solution space. This balance can determine the success or failure of the search [17,18]. In most cases, this balance is investigated by experimental methods and very rarely by theoretical methods.
In this work, a probabilistic evaluation of the exploration–exploitation equilibrium caused by the swap operator during the search in Hamming space was carried out in weight classes of S-boxes for nonlinear S-boxes, resistant to Power Attacks. The main theoretical result consists of the proof that, when applying the swap operator, with a random selection of the elements to be exchanged, this operator changes class with high probability (approximately 0.77 for the cases of greater practical interest), which favors exploration of the Hamming Weight class space but reduces exploitation within classes. We consider that this behavior of the swap operator in this specific problem may be ineffective when the class is resistant to Differential Power Attacks, and it would be more convenient to exploit within the class to find S-Boxes with high nonlinearity. As the main practical result, it is proposed to modify/improve the use of the swap operator, replacing its random application with the convenient selection of the elements to be exchanged, which allows for controlling the relationship between exploration and exploitation at the researcher’s convenience. As an open problem, the previous result will be used to investigate in future works, which is the optimal ratio between exploration-exploit in this specific problem. It will also be investigated in future works how the increase in the number of swaps made during the exploration influences the effectiveness and efficiency of the search.

Author Contributions

Conceptualization, C.M.L.-P. and I.M.-D.; Formal analysis, C.M.L.-P., I.M.-D. and G.d.R.V.-R.; Investigation, G.S.-G., C.M.L.-P., I.M.-D., J.A.M.-V. and G.d.R.V.-R.; Methodology, O.R., C.M.L.-P. and G.d.R.V.-R.; Project administration, C.M.L.-P.; Supervision, G.S.-G., C.M.L.-P. and J.A.M.-V.; Validation, C.M.L.-P.; Visualization, I.M.-D.; Writing—original draft, G.S.-G., O.R., C.M.L.-P., I.M.-D. and J.A.M.-V.; Writing—review & editing, G.S.-G. and O.R. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Informed consent was obtained from all subjects involved in the study.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.

Appendix A. Proof of Identity

k = 0 n [ C ( n , k ) ] 2 = C ( 2 n , n ) .
The right term C ( 2 n , n ) is the number of choosing n elements from a set A made up of 2 n elements. As is usual in many combinatorial proofs, consider a partition A = A 1 A 2 of the same set A into two disjoint subsets A 1 , A 2 of n elements each. The left term can be expressed as: k = 0 n [ C ( n , k ) ] 2 = k = 0 n [ C ( n , k ) · C ( n , n k ) ] . To choose n elements of A, we can take k elements of A 1 which can be made of C ( n , k ) forms, and ( n k ) elements of A 2 which can be made of C ( n , n k ) forms. To find the total number C ( 2 n , n ) of ways to choose n elements from the 2 n elements of A, using this partition, all the values of k must be traversed, and we obtain C ( 2 n , n ) = k = 0 n [ C ( n , k ) · C ( n , n k ) ] = k = 0 n [ C ( n , k ) ] 2 .

Appendix B. AES S-Box

63 7c 77 7b f2 6b 6f c5 30 01 67 2b fe d7 ab 76 ca 82 c9 7d fa 59 47 f0 ad d4 a2 af 9c a4 72 c0 b7 fd 93 26 36 3f f7 cc 34 a5 e5 f1 71 d8 31 15 04 c7 23 c3 18 96 05 9a 07 12 80 e2 eb 27 b2 75 09 83 2c 1a 1b 6e 5a a0 52 3b d6 b3 29 e3 2f 84 53 d1 00 ed 20 fc b1 5b 6a cb be 39 4a 4c 58 cf d0 ef aa fb 43 4d 33 85 45 f9 02 7f 50 3c 9f a8 51 a3 40 8f 92 9d 38 f5 bc b6 da 21 10 ff f3 d2 cd 0c 13 ec 5f 97 44 17 c4 a7 7e 3d 64 5d 19 73 60 81 4f dc 22 2a 90 88 46 ee b8 14 de 5e 0b db e0 32 3a 0a 49 06 24 5c c2 d3 ac 62 91 95 e4 79 e7 c8 37 6d 8d d5 4e a9 6c 56 f4 ea 65 7a ae 08 ba 78 25 2e 1c a6 b4 c6 e8 dd 74 1f 4b bd 8b 8a 70 3e b5 66 48 03 f6 0e 61 35 57 b9 86 c1 1d 9e e1 f8 98 11 69 d9 8e 94 9b 1e 87 e9 ce 55 28 df 8c a1 89 0d bf e6 42 68 41 99 2d 0f b0 54 bb 16.
Table A1. Class HW < F A E S > of the S-box of the AES algorithm.
Table A1. Class HW < F A E S > of the S-box of the AES algorithm.
0123456789ABCDEF
04566556421547655
14246644454364342
26743467434554433
31534242432146445
42333454235553552
54406164545643336
63747344336172463
73415353655521864
85235652435653535
92255232236426536
A3342322435433445
B6355454444554551
C5434344446454643
D3554226334553345
E4532454354455427
F3333752324443363

References

  1. Kim, J.; Picek, S.; Heuser, A.; Bhasin, S.; Hanjalic, A. Make some noise. unleashing the power of convolutional neural networks for profiled side-channel analysis. IACR Trans. Cryptogr. Hardw. Embed. Syst. 2019, 2019, 148–179. [Google Scholar] [CrossRef]
  2. Bhasin, S.; Chattopadhyay, A.; Heuser, A.; Jap, D.; Picek, S.; Ranjan, R. Mind the portability: A warriors guide through realistic profiled side-channel analysis. In Proceedings of the NDSS, San Diego, CA, USA, 23–26 February 2020; Volume 2020. [Google Scholar] [CrossRef]
  3. Batina, L.; Djukanovic, M.; Heuser, A.; Picek, S. It Started with Templates: The Future of Profiling in Side-Channel Analysis. In Security of Ubiquitous Computing Systems; Springer: Berlin/Heidelberg, Germany, 2021; pp. 133–145. [Google Scholar]
  4. Van Tilborg, H.C.; Jajodia, S. Encyclopedia of Cryptography and Security; Springer Science & Business Media: Berlin, Germany, 2014. [Google Scholar]
  5. Behera, P.K.; Gangopadhyay, S. An improved hybrid genetic algorithm to construct balanced Boolean function with optimal cryptographic properties. Evol. Intell. 2021, 1–15. [Google Scholar] [CrossRef]
  6. Knežević, K. Combinatorial optimization in cryptography. In Proceedings of the 2017 40th International Convention on Information and Communication Technology, Electronics and Microelectronics (MIPRO), Opatija, Croatia, 22–26 May 2017; pp. 1324–1330. [Google Scholar]
  7. Freyre-Echevarría, A.; Martínez-Díaz, I.; Pérez, C.M.L.; Sosa-Gómez, G.; Rojas, O. Evolving Nonlinear S-Boxes with Improved Theoretical Resilience to Power Attacks. IEEE Access 2020, 8, 202728–202737. [Google Scholar] [CrossRef]
  8. Wood, C.A. Large Substitution Boxes with Efficient Combinational Implementations. Master’s Thesis, Rochester Institute of Technology, Rochester, NY, USA, 2013. [Google Scholar]
  9. Xu, Y.; Wang, Q. Searching for Balanced S-Boxes with High Nonlinearity, Low Differential Uniformity, and Improved DPA-Resistance. In International Conference on Information Security; Springer: Berlin/Heidelberg, Germany, 2020; pp. 95–106. [Google Scholar]
  10. Díaz, I.M. Búsqueda Local de S-Cajas con Alta Varianza del Coeficiente de Confusión. Master’s Thesis, Universidad de la Habana, Havana, Cuba, 2019. [Google Scholar]
  11. Picek, S. Applications of Evolutionary Computation to Cryptology. Ph.D. Thesis, Faculty of Electrical Engineering and Computing, University of Zagreb, Zagreb, Croatia, 2015. [Google Scholar]
  12. Behera, P.K.; Gangopadhyay, S. Evolving bijective S-Boxes using hybrid adaptive genetic algorithm with optimal cryptographic properties. J. Ambient. Intell. Humaniz. Comput. 2021, 1–18. [Google Scholar] [CrossRef]
  13. Khadem, B.; Rajavzade, S. Construction of Side Channel Attacks Resistant S-boxes using Genetic Algorithms based on Coordinate Functions. arXiv 2021, arXiv:2102.09799. [Google Scholar]
  14. Zahid, A.H.; Iliyasu, A.M.; Ahmad, M.; Shaban, M.M.U.; Arshad, M.J.; Alhadawi, H.S.; Abd El-Latif, A.A. A Novel Construction of Dynamic S-Box With High Nonlinearity Using Heuristic Evolution. IEEE Access 2021, 9, 67797–67812. [Google Scholar] [CrossRef]
  15. Ivanov, G.; Nikolov, N.; Nikova, S. Cryptographically strong S-boxes generated by modified immune algorithm. In Proceedings of the International Conference on Cryptography and Information Security in the Balkans, Koper, Slovenia, 3–4 September 2015; Springer: Berlin/Heidelberg, Germany, 2015; pp. 31–42. [Google Scholar]
  16. Isa, H.; Jamil, N.; Z’aba, M. Hybrid heuristic methods in constructing cryptographically strong S-boxes. Int. J. Cryptol. Res. 2016, 6, 1–15. [Google Scholar]
  17. Xu, J.; Zhang, J. Exploration-exploitation trade-offs in metaheuristics: Survey and analysis. In Proceedings of the 33rd Chinese Control Conference, Nanjing, China, 28–30 July 2014; pp. 8633–8638. [Google Scholar]
  18. Yang, X.S.; Deb, S.; Fong, S. Metaheuristic algorithms: Optimal balance of intensification and diversification. Appl. Math. Inf. Sci. 2014, 8, 977. [Google Scholar] [CrossRef]
  19. Morales-Castañeda, B.; Zaldivar, D.; Cuevas, E.; Fausto, F.; Rodríguez, A. A better balance in metaheuristic algorithms: Does it exist? Swarm Evol. Comput. 2020, 54, 100671. [Google Scholar] [CrossRef]
  20. Črepinšek, M.; Liu, S.H.; Mernik, M. Exploration and exploitation in evolutionary algorithms: A survey. ACM Comput. Surv. (CSUR) 2013, 45, 1–33. [Google Scholar] [CrossRef]
  21. Cuevas, E.; Diaz, P.; Camarena, O. Experimental Analysis Between Exploration and Exploitation. In Metaheuristic Computation: A Performance Perspective; Springer: Berlin/Heidelberg, Germany, 2021; pp. 249–269. [Google Scholar]
  22. Sánchez, R. Generación de s-Cajas Equivalentes según su Resistencia a los Ataques por Análisis Diferencial de Potencia; Technical Report; Facultad de Ingeniería Informática, Universidad Tecnologica de la Habana, CUJAE: La Habana, Cuba, 2016. [Google Scholar]
  23. Legón-Pérez, C.M.; Sánchez-Muiña, R.; Miyares-Moreno, D.; Bardaji-López, Y.; Martínez-Díaz, I.; Rojas, O.; Sosa-Gómez, G. Search-Space Reduction for S-Boxes Resilient to Power Attacks. Appl. Sci. 2021, 11, 4815. [Google Scholar] [CrossRef]
  24. Nyberg, K. Differentially uniform mappings for cryptography. In Workshop on the Theory and Application of of Cryptographic Techniques; Springer: Berlin/Heidelberg, Germany, 1993; pp. 55–64. [Google Scholar]
  25. Picek, S.; Papagiannopoulos, K.; Ege, B.; Batina, L.; Jakobovic, D. Confused by confusion: Systematic evaluation of DPA resistance of various s-boxes. In Proceedings of the International Conference on Cryptology in India, New Delhi, India, 14–17 December 2014; Springer: Berlin/Heidelberg, Germany, 2014; pp. 374–390. [Google Scholar]
  26. Prouff, E. DPA attacks and S-boxes. In International Workshop on Fast Software Encryption; Springer: Berlin/Heidelberg, Germany, 2005; pp. 424–441. [Google Scholar]
  27. Chakraborty, K.; Sarkar, S.; Maitra, S.; Mazumdar, B.; Mukhopadhyay, D.; Prouff, E. Redefining the transparency order. Des. Codes Cryptogr. 2017, 82, 95–115. [Google Scholar] [CrossRef] [Green Version]
  28. Li, H.; Zhou, Y.; Ming, J.; Yang, G.; Jin, C. The Notion of Transparency Order, Revisited. Comput. J. 2020, 63, 1915–1938. [Google Scholar] [CrossRef]
  29. Talbi, E.G. Metaheuristics: From Design to Implementation; John Wiley & Sons: Hoboken, NJ, USA, 2009; Volume 74. [Google Scholar]
  30. Wang, Y.; Zhang, Z.; Zhang, L.Y.; Feng, J.; Gao, J.; Lei, P. A genetic algorithm for constructing bijective substitution boxes with high nonlinearity. Inf. Sci. 2020, 523, 152–166. [Google Scholar] [CrossRef]
  31. Bilgin, B.; Nikova, S.; Nikov, V.; Rijmen, V.; Tokareva, N.; Vitkup, V. Threshold implementations of small S-boxes. Cryptogr. Commun. 2015, 7, 3–33. [Google Scholar] [CrossRef] [Green Version]
  32. Khadem, B.; Ghasemi, R. Improved algorithms in parallel evaluation of large cryptographic S-boxes. Int. J. Parallel Emergent Distrib. Syst. 2020, 35, 461–472. [Google Scholar] [CrossRef]
  33. Qi, F. Some properties of the Catalan numbers. Ars Comb. 2021, 2022, 1–9. [Google Scholar]
Figure 1. S-box and HW-class search spaces.
Figure 1. S-box and HW-class search spaces.
Information 12 00509 g001
Figure 2. Graphical representation of the probabilities P n 1 of moving towards the same Hamming Weight class and ( 1 P n 1 ) of changing Hamming Weight class after a random swap: (a) probability of transition between classes; (b) pie chart. (The probabilities P n 2 correspond to two random swaps, calculated in Proposition 3).
Figure 2. Graphical representation of the probabilities P n 1 of moving towards the same Hamming Weight class and ( 1 P n 1 ) of changing Hamming Weight class after a random swap: (a) probability of transition between classes; (b) pie chart. (The probabilities P n 2 correspond to two random swaps, calculated in Proposition 3).
Information 12 00509 g002
Figure 3. The curve of the theoretical probabilities P n 1 (y-axis), as a function of n (x-axis), for n = ( 3 , 16 ) ¯ .
Figure 3. The curve of the theoretical probabilities P n 1 (y-axis), as a function of n (x-axis), for n = ( 3 , 16 ) ¯ .
Information 12 00509 g003
Figure 4. Curves of the two limits’ approximations obtained for P n 1 .
Figure 4. Curves of the two limits’ approximations obtained for P n 1 .
Information 12 00509 g004
Figure 5. Comparison of the limiting probabilities P n 1 L and the recursive probabilities P n 1 R with the exact theoretical probabilities P n 1 .
Figure 5. Comparison of the limiting probabilities P n 1 L and the recursive probabilities P n 1 R with the exact theoretical probabilities P n 1 .
Information 12 00509 g005
Figure 6. Representation of the convergence between successive probabilities, as n increases. (Property # 3).
Figure 6. Representation of the convergence between successive probabilities, as n increases. (Property # 3).
Information 12 00509 g006
Figure 7. For n = 3 , , 16 : Graph of the Theoretical probabilities P n 1 of falling into the same Hamming Weight class after a random swap (in blue) and comparison with its estimate (in red) using M = 1,000,000 successive permutations fixed initially.
Figure 7. For n = 3 , , 16 : Graph of the Theoretical probabilities P n 1 of falling into the same Hamming Weight class after a random swap (in blue) and comparison with its estimate (in red) using M = 1,000,000 successive permutations fixed initially.
Information 12 00509 g007
Figure 8. For n = 3 , , 16 : Graph of the Theoretical probabilities P n 1 (in blue) and comparison with their estimate ( P n 1 ) ^ (in red) using a swap in M = 1,000,000 of different initial permutations.
Figure 8. For n = 3 , , 16 : Graph of the Theoretical probabilities P n 1 (in blue) and comparison with their estimate ( P n 1 ) ^ (in red) using a swap in M = 1,000,000 of different initial permutations.
Information 12 00509 g008
Figure 9. Comparison between the theoretical probabilities P n 2 (two swaps, in red) of Proposition 3 and the theoretical probabilities P n 1 (one swap, in blue) of Proposition 1, when increasing n (X-axis).
Figure 9. Comparison between the theoretical probabilities P n 2 (two swaps, in red) of Proposition 3 and the theoretical probabilities P n 1 (one swap, in blue) of Proposition 1, when increasing n (X-axis).
Information 12 00509 g009
Figure 10. Comparison between the theoretical probabilities P n 2 of Proposition 3 and its estimate ( P n 2 ) ^ .
Figure 10. Comparison between the theoretical probabilities P n 2 of Proposition 3 and its estimate ( P n 2 ) ^ .
Information 12 00509 g010
Figure 11. Influence of the random swap operator (for 1 or 2 swaps) on the exploration–exploitation balance during the search for S-boxes resistant to Power Attacks in the Hamming Weight class space.
Figure 11. Influence of the random swap operator (for 1 or 2 swaps) on the exploration–exploitation balance during the search for S-boxes resistant to Power Attacks in the Hamming Weight class space.
Information 12 00509 g011
Table 1. Values of the theoretical probabilities P n 1 and ( 1 P n 1 ) of Proposition 1, n = 3 , , 16 .
Table 1. Values of the theoretical probabilities P n 1 and ( 1 P n 1 ) of Proposition 1, n = 3 , , 16 .
nTheoretical Probability P n 1 Theoretical Probability 1 P n 1 Entropy
30.2140.7860.75
40.2250.7750.77
50.2220.7780.76
60.2130.7870.75
70.2030.7970.73
80.1930.8070.71
90.1840.8160.69
100.1750.8250.670
110.1680.8320.653
120.1610.8390.637
130.1550.8450.622
140.1490.8510.608
150.1440.8560.596
160.1400.8600.584
Table 2. Comparison of the two limit approximations obtained for P n 1 .
Table 2. Comparison of the two limit approximations obtained for P n 1 .
n P n 1 L 1 π n 1 π n P n 1 L
30.31250.3257350.01323500
40.2734380.2820950.00865729
50.2460940.2523130.00621950
60.2255860.2303290.00474350
70.2094730.2132440.00377096
80.1963810.1994710.00309052
90.1854710.1880630.00259261
100.1761970.1784120.00221536
110.1681880.170110.00192146
120.161180.1628680.00168725
130.1549810.1564780.00149702
140.1494460.1507860.00134003
150.1444640.1456730.00120868
160.139950.1410470.00109746
Table 3. Comparing the probabilities limits P n 1 L and P n 1 R recursive probabilities with exact theoretical probabilities P n 1 .
Table 3. Comparing the probabilities limits P n 1 L and P n 1 R recursive probabilities with exact theoretical probabilities P n 1 .
nTheoretical
Probability
P n 1
Theoretical
Probability Limit
P n 1 L
Recursive
Theoretical
Probability
P n 1 R
e L = P n 1 L P n 1 e R = P n 1 P n 1 R
30.21430.31250.21430.09820.0000
40.22500.27340.19290.04840.0321
50.22180.24610.17680.02430.0450
60.21330.22560.16420.01230.0491
70.20320.20950.15390.00630.0493
80.19320.19640.14530.00320.0479
90.18390.18550.13810.00160.0458
100.17540.17620.13180.00080.0436
110.16780.16820.12630.00040.0415
120.16100.16120.12150.00020.0395
130.15490.15500.11710.00010.0378
140.14940.14940.11320.00000.0362
150.14440.14450.10970.00010.0347
160.13990.13990.10640.00000.0335
Table 4. The mean and estimated variance of the errors made when calculating P n 1 , by its limit formula, for two different ranges of n.
Table 4. The mean and estimated variance of the errors made when calculating P n 1 , by its limit formula, for two different ranges of n.
Range of n { 3 , , 16 } { 7 , , 16 }
E ( e L ) 0.01400.0013
V a r ( e L ) 0.00080.0000
Table 5. The mean and estimated variance of the errors made when calculating P n 1 , by its recursive formula, for two different ranges of n.
Table 5. The mean and estimated variance of the errors made when calculating P n 1 , by its recursive formula, for two different ranges of n.
Range of n { 3 , , 16 } { 7 , , 16 }
E ( e R ) 0.03830.0410
V a r ( e R ) 0.00020.0000
Table 6. Comparison between the Theoretical Probability P n 1 of falling into the same Hamming Weight class after a random swap with its estimate ( P n 1 ) ^ obtained using M = 1,000,000 successive swaps made from a fixed, arbitrary initial permutation.
Table 6. Comparison between the Theoretical Probability P n 1 of falling into the same Hamming Weight class after a random swap with its estimate ( P n 1 ) ^ obtained using M = 1,000,000 successive swaps made from a fixed, arbitrary initial permutation.
nTheoretical
Probability
P n 1
Estimation
P n 1 ^
P n 1 ^ P n 1
30.21430.31250.0982
40.22500.27340.0493
50.22180.24610.0243
60.21330.22560.0123
70.20320.20950.0063
80.19320.19640.0032
90.18390.18550.0016
100.17540.17620.0008
110.16780.16820.0004
120.16100.16120.0002
130.15490.15500.0001
140.14940.14940.0000
150.14440.14450.0001
160.13990.13990.0000
Table 7. For n = 3 , , 16 : theoretical probability P n 1 and comparison with its estimate ( P n 1 ) ^ by means of a swap in M = 1,000,000 of different initial permutations.
Table 7. For n = 3 , , 16 : theoretical probability P n 1 and comparison with its estimate ( P n 1 ) ^ by means of a swap in M = 1,000,000 of different initial permutations.
nTheoretical
Probability
P n 1
Estimation
of
P n 1 ^
P n 1 ^ P n 1
30.21430.21490.0006
40.2250.22630.0013
50.22180.2217−0.0001
60.21330.21330
70.20320.2029−0.0003
80.19320.19350.0003
90.18390.18490.001
100.17540.17580.0004
110.16780.1677−0.0001
120.1610.16110.0001
130.15490.15530.0004
140.14940.14950.0001
150.14440.14420.0002
160.13990.1396−0.0003
Table 8. Comparison between the theoretical probabilities P n 2 of Proposition 3, and its estimation ( P n 2 ) ^ .
Table 8. Comparison between the theoretical probabilities P n 2 of Proposition 3, and its estimation ( P n 2 ) ^ .
nTheoretical
Probability
P n 2
Estimation
of
P n 2
30.02140.0428
40.03740.0486
50.04370.0485
60.04350.0449
70.04060.0413
80.03710.0371
90.03370.0338
100.03070.0311
110.02810.0283
120.02590.0259
130.02400.0241
140.02230.0222
150.02090.0208
160.01960.0196
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Legón-Pérez, C.M.; Menéndez-Verdecía, J.A.; Martínez-Díaz, I.; Sosa-Gómez, G.; Rojas, O.; Veloz-Remache, G.d.R. Probabilistic Evaluation of the Exploration–Exploitation Balance during the Search, Using the Swap Operator, for Nonlinear Bijective S-Boxes, Resistant to Power Attacks. Information 2021, 12, 509. https://doi.org/10.3390/info12120509

AMA Style

Legón-Pérez CM, Menéndez-Verdecía JA, Martínez-Díaz I, Sosa-Gómez G, Rojas O, Veloz-Remache GdR. Probabilistic Evaluation of the Exploration–Exploitation Balance during the Search, Using the Swap Operator, for Nonlinear Bijective S-Boxes, Resistant to Power Attacks. Information. 2021; 12(12):509. https://doi.org/10.3390/info12120509

Chicago/Turabian Style

Legón-Pérez, Carlos Miguel, Jorge Ariel Menéndez-Verdecía, Ismel Martínez-Díaz, Guillermo Sosa-Gómez, Omar Rojas, and Germania del Roció Veloz-Remache. 2021. "Probabilistic Evaluation of the Exploration–Exploitation Balance during the Search, Using the Swap Operator, for Nonlinear Bijective S-Boxes, Resistant to Power Attacks" Information 12, no. 12: 509. https://doi.org/10.3390/info12120509

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop