SBOX-CGA: Substitution Box Generator Based On Chaos and Genetic Algorithm
SBOX-CGA: Substitution Box Generator Based On Chaos and Genetic Algorithm
https://doi.org/10.1007/s00521-022-07589-4 (0123456789().,-volV)(0123456789().
,- volV)
ORIGINAL ARTICLE
Received: 2 December 2021 / Accepted: 28 June 2022 / Published online: 19 July 2022
The Author(s), under exclusive licence to Springer-Verlag London Ltd., part of Springer Nature 2022
Abstract
What makes artificial intelligence techniques so remarkable in the field of computer science is undoubtedly their success in
producing effective solutions to difficult computational problems. In particular, metaheuristic optimization algorithms are a
unique example of using artificial intelligence techniques to generate approximate solutions to problems that cannot be
solved in polynomial time, called NP. Obtaining a substitution box (s-box) structure that will satisfy the desired
requirements in cryptography is an example of these NP problems. In the literature, it is a hot topic to optimize the s-box
structures obtained from chaotic entropy sources with heuristic algorithms to improve their cryptographic properties. The
study with the highest nonlinearity value (110.25) based on optimization algorithms to date has been published in 2020. In
this study, a method with a higher nonlinearity value than the algorithms previously proposed in the literature is developed.
It has been shown that the nonlinearity value can be increased to 111.75. These results will be a basis for new research on
the chaos-based s-box literature and will motivate new studies to develop alternative optimization algorithms in the future
to obtain s-box structures based on the random selection equivalent to the AES s-box.
123
20204 Neural Computing and Applications (2022) 34:20203–20211
process to find the structure with the highest nonlinearity proposed modifications in the crossover and mutation
value among this combination of possibilities [8]. stages to take Wang’s method [21] one step further. In the
Since the most effective way to cope with this difficulty study, the randomness of the entropy source, in other words
is the optimization algorithms, it has been tried to obtain the quality of the initial population, was improved by using
chaos-based s-box structures with the highest nonlinearity four different discrete-time chaotic systems. Although the
value by using various approaches in the literature. The quality of the initial population is important to obtain high
first work in this area is proposed by Chen in 2008 [9]. This nonlinearity values, the main factor for success was the
method is based on chaotic maps and simulated annealing. way the genetic algorithm performed the crossover and
The proposed method after this study is based on the linear mutation processes. These contributions made in the study
fractional transformation method [10]. Farah et al. [11], on are explained in detail in the section two. In Sect. 2, both
the other hand, proposed a new approach by changing the the flowchart and pseudocode of the algorithm are given so
optimization algorithm. They have been used teaching– that the researchers can easily repeat the results. In the
learning-based optimization. In the study of Hematpour Sect. 3, sample s-box structures obtained using the pro-
et al. [12], effective s-boxes were developed using chaotic posed method are given. In addition, a comparison with
maps and improved particle swarm optimization algorithm. other optimization-based approaches in the literature is
Ahmad et al. proposed a meta-heuristic approach based on presented in this section. In the Sect. 4, the results obtained
ant colony optimization and chaos to obtain a suit- are discussed and possible projections for future studies are
able configuration for a strong s-box. Here, the optimiza- discussed.
tion is performed by transforming the initial s-box into a
traveling salesman problem via the edge matrix [13].
Alhadawi et al. [14] adopted a metaheuristic approach 2 Proposed method
based on firefly algorithm optimization. Ahmed et al. [15]
proposed a new scheme based on firefly optimization by In the proposed approach, since nonlinearity values are
minimizing the fitness function and guided search for near- tried to be improved by genetic algorithm, an initial pop-
optimal features. Tian et al. [16] designed a new chaotic ulation must be obtained firstly. Since chaotic systems
schema based on nested logistic map and bacterial foraging provide successful results in obtaining initial populations
optimization. Wang et al. [17] transformed the s-box gen- [22], initial populations were obtained by using chaotic
eration problem into the traveling salesman problem with systems in the study. The difference of the study from its
genetic algorithm is proposed. Alhadawi et al. [18] pro- counterparts is that more than one chaotic system feeds the
posed a new method based on a cuckoo search algorithm initial population in this process. Four different chaotic
and a discrete-space chaotic map. In the study of Zamli systems were used in the study. The most important reason
et al., a new metaheuristic algorithm is proposed by com- for using chaotic maps with the other widely known defi-
bining chaotic maps and Tiki-Taka algorithm. The most nition of discrete-time chaotic systems as a chaotic system
important difference from other studies is that it integrates in the generation of initial populations is related to speed.
chaotic maps into the algorithm. Thanks to this method, For all these reasons, discrete-time chaotic systems are
s-boxes with high nonlinearity value were obtained [19]. used in the study. Because discrete-time chaotic systems
Zamli, based on the Agent Heroes and Cowards Algorithm are modeled with difference equations. Continuous time,
(AHC), proposed a new metaheuristic algorithm called the hyper, fractional and time delayed chaotic systems, which
Adaptive Agent Heroes and Cowards Algorithm (AAHC). are other options that can be used as chaotic systems, are
Strong s-boxes were obtained using this algorithm [20]. modeled with differential equations. Chaotic maps were
Wang et al. [21] proposed a new genetic algorithm to preferred in this study, since difference equations produce
generate s-boxes with high nonlinearity. In this algorithm, results faster than differential equations when compared in
the purpose of optimization is to obtain high nonlinearity terms of speed. Another reason for this choice is that in
values. First, a chaotic system was used to create the s-box. order to observe chaos in continuous-time systems, the
Then, it has been shown that strong s-boxes can be system must be at least a third-order system, while the
obtained by using the crossover and mutation operator of systems used in this study are only first-order systems.
the genetic algorithm. The highest value obtained in Wang Although discrete-time chaotic systems are used in the
et al.’s study was measured as 110.25. This value is valu- study, the proposed method can be used in other chaotic
able in that it is the highest nonlinearity value reached for system classes. Reference [23] can be examined for the
s-box structures based on random selection by using opti- effect of chaotic systems on initial populations. In the
mization algorithms until this study. proposed method, an s-box is first generated using chaotic
The original aspect of this study is that it uses chaotic maps. In this study, four different s-boxes were obtained by
systems with a hybrid approach and is based on the using four different chaotic maps [24].
123
Neural Computing and Applications (2022) 34:20203–20211 20205
Discrete-Time Chaotic Sin Map The pseudocode of the proposed genetic algorithm is
xnþ1 ¼ a sinðpxn Þ; xn 2 ½0; 1; a 2 ½0:85; 1 ð1Þ given in Table 1.
Discrete-Time Chaotic May Map As the first step of the algorithm, the initial s-box structures
should be obtained from four different discrete-time
xnþ1 ¼ xn exp½að1 xn Þ; a 2 ½0; 5 ð3Þ
chaotic systems. The performance analysis results of
Discrete-Time Chaotic Logistic Map chaotic s-boxes generated for the initial population are
xnþ1 ¼ axn ð1 xn Þ; xn 2 ½0; 1; a 2 ½3:5; 4 ð4Þ given in Table 2. The s-boxes here were obtained by using
the Sin map, Gaussian map, May map, and logistic map,
Step 1—Creating the initial population: The chaotic respectively. Due to the page limitation, the s-box struc-
maps given above are used to obtain the s-box to be used as tures generated as the initial population are not presented
the initial population (different maps can also be used). separately as a table. Instead, performance analyses of
The approach to obtaining s-box given up to this stage, initial population s-box structures are presented in Table 2.
in other words obtaining s-box through random selections, References [1, 3, 6, 23, 25] can be examined for details on
is not much different from the solution proposals in the the metrics used in the performance analysis given in
literature. The original aspect of this study is that it pro- Table 2 and how the calculations for these metrics are
poses to use the genetic algorithm as a post-processing made.
technique. Because the starting point of the study is the After taking the first s-box structures obtained as the
previous studies pointing out that the s-box nonlinearity initial population as input and applying the steps 2 and 3 of
value can be improved with various post-processing tech- the proposed algorithm, the improved s-box structures are
niques [1, 6, 25]. With this motivation, the approach that presented in Tables 3, 4, 5 and 6, respectively.
gives the best results in the literature [21] has been In Table 7, the performance comparison of the s-box
improved with the following modifications. structures generated by basis of optimization and the s-box
Step 2—Calculating the fitness value: The fitness value structures obtained by the proposed method is presented.
is the nonlinearity value of the selected s-box. In this step, Since the study specifically focuses on optimization algo-
this value is calculated. rithms, only the comparison of optimization-based
Step 3—Crossover and mutation: This is the step where approaches is presented in Table 7. In fact, the number of
the actual operation takes place. In the chaotic s-box taken different chaos-based s-boxes published in the journals
as input, first crossover and then mutation operation is scanned in the SCI/SCIE index in the last 20 years in the
applied. literature is more than 100. Analysis tables from previous
studies [1, 6, 8, 23, 25] can be used for performance
• Crossover: In the crossover operation, two rows or two
comparisons with other chaos-based s-box structures. It has
columns in the s-box are randomly swapped. After the
been observed that the performance metrics of the s-box
crossover step, the nonlinearity value of the new s-box
structure obtained with the proposed approach are more
is calculated. If this value is greater than or equal to the
successful than other chaos-based methods.
fitness value, this chromosome is passed on to the next
generation.
• Mutation: The two values of the chromosome from the
crossover are alternately replaced. The nonlinearity 4 Dissussion and conclusion
value of the new s-box is calculated. If this value is
greater than or equal to the fitness value, this chromo- Since s-box structures based on random selection are more
some is passed on to the next generation. resistant to application-oriented attacks, the search for
s-box generator approaches that can be an alternative to the
The most important and original difference of our pro- AES s-box structure has become an increasingly important
posed method from other methods is: It is the transfer of issue in cryptology studies. However, the low nonlinearity
chromosomes with the same nonlinearity value to the next values of s-box structures based on random selection are a
generation after crossover and mutation processes. In this serious problem that must be overcome. In the literature,
way, generational diversity increases and more chromo- optimization algorithm is used to address this problem. It
somes are transferred to the next generation. The flow has been shown in previous studies that increasing the
diagram of the proposed algorithm is given in Fig. 1. nonlinearity value can be used as the objective function of
123
20206 Neural Computing and Applications (2022) 34:20203–20211
the optimization algorithm to improve the nonlinearity Tables 2 and 7 are examined, it is important that the
value from 106.75 to 110.25. maximum I/O XOR distribution values have been reduced
In this study, it has been shown that the nonlinearity from 14 to 10 because, although the proposed optimization
value can be increased up to 111.75 by making modifica- algorithm is a single-purpose (increasing the nonlinearity
tions on the s-box generation approach with the genetic value) optimization algorithm, it has been observed that it
algorithm, which is the most effective approach to date improves another s-box design metric.
[21]. This value is very close to AES s-box structure It is thought that structures equivalent to the AES s-box
nonlinearity value (AES s-box nonlinearity value is 112). structure can be produced by converting the proposed
When the results obtained in the study are analyzed, the method into a multi-objective optimization algorithm in
fact that not only the nonlinearity value but also the XOR future studies or by using only the minimization of the
distribution table value used to measure the resistance to maximum I/O XOR value as the objective function. It is
differential attacks has been improved, stands out as aimed to use all these results in practical applications such
another important achievement of the study. In the s-box as image encryption algorithm and random number gen-
design, it is desired that the maximum I/O XOR distribu- erator in future studies, and to be used in many critical
tion value be as small as possible. When the results in areas such as the Internet of Things from Industry 4.0
123
Neural Computing and Applications (2022) 34:20203–20211 20207
S-boxGeneration()
begin
Start_Chromosome =[0:255]
temporary_chromosome=[0:255]
Fitness value = nonlineary value of the starting chromosome
else
Start_chromosome = Temporary_Chromosome
end else
//----------------------------------------------------------
* Mutation (swap two elements) *
New fitness value =Calculate_Nonlinearity(Initial chromosome)
if (New fitness value >= Fitness value)
Temp= New fitness value - Fitness value
if (New fitness value > Fitness value)
Save(Start_chromosome, New fitness value)
Fitness value = Fitness value +Temp
end if
end if
else
Start_chromosome = Temporary_Chromosome
end else
end for
end for
SwapValue(value1, value2)
Calculate_Nonlinearity(S-box[])
end
123
20208 Neural Computing and Applications (2022) 34:20203–20211
123
Neural Computing and Applications (2022) 34:20203–20211 20209
0 139 181 14 149 138 69 141 251 72 178 15 209 199 244 216 110
1 242 155 165 192 130 82 102 67 74 51 238 215 182 140 87 113
2 237 9 248 47 146 11 19 80 43 28 191 196 34 150 164 95
3 161 143 103 250 125 158 94 40 21 98 179 10 173 29 243 4
4 0 204 3 223 25 154 7 121 60 68 32 211 91 177 108 225
5 132 246 231 245 212 30 190 123 62 236 168 75 205 77 46 135
6 116 171 66 228 104 235 253 78 222 2 118 111 76 169 5 107
7 170 210 183 240 120 59 172 57 122 58 163 42 221 85 70 65
8 255 129 119 241 180 137 217 128 27 24 112 81 185 36 213 160
9 167 61 201 227 37 193 247 55 41 20 147 39 109 254 88 157
10 174 200 126 136 97 45 89 117 219 48 33 156 144 18 12 131
11 189 56 1 133 195 35 220 206 84 214 152 175 54 71 239 50
12 218 44 13 79 145 127 252 188 230 229 198 176 159 52 106 101
13 207 90 187 100 226 31 142 233 26 197 63 208 148 17 6 203
14 194 38 92 105 202 162 16 8 134 93 73 53 234 224 83 166
15 49 115 184 99 23 124 249 114 232 186 86 22 96 153 151 64
0 170 50 217 214 117 197 77 12 88 35 150 184 80 208 180 237
1 2 225 203 207 138 198 97 222 56 236 142 136 76 152 26 127
2 32 84 104 253 33 73 103 148 17 111 212 223 113 7 220 164
3 109 20 55 162 206 23 210 78 3 140 190 247 179 115 34 235
4 191 194 126 38 51 176 43 112 219 122 195 107 8 100 171 1
5 130 187 218 47 177 240 116 64 242 82 114 24 106 143 228 29
6 54 243 37 79 244 22 231 42 98 14 9 178 57 121 93 27
7 87 250 135 182 83 61 105 139 145 202 58 254 75 72 18 168
8 60 252 183 110 192 92 216 95 70 234 156 40 41 193 91 63
9 226 141 19 39 52 86 166 149 249 209 134 181 157 31 90 147
10 11 230 159 13 246 201 251 172 131 169 227 204 48 0 74 200
11 5 16 4 221 232 224 133 165 174 28 62 137 167 158 239 118
12 154 44 99 94 205 66 36 85 173 229 65 49 21 71 119 144
13 89 67 161 163 186 211 132 188 215 69 189 123 45 30 53 185
14 213 46 146 199 155 10 160 96 245 101 153 25 125 129 59 248
15 233 15 175 81 120 108 68 151 124 238 241 128 196 255 6 102
[26–28]. Another issue that researchers can address in versions of the proposed genetic algorithm for other
future studies is to try different optimization algorithms metaheuristic optimization algorithms is among the possi-
with a similar approach. The preparation of equivalent ble studies planned in the future.
123
20210 Neural Computing and Applications (2022) 34:20203–20211
Improved S-box1 110 112 111.75 104 0.5033 0.4968 0.6094 0.4062 12
Improved S-box2 110 112 111.5 104.5 0.5014 0.4951 0.5781 0.4062 10
Improved S-box3 110 112 111.25 103.79 0.504 0.5039 0.5781 0.4219 10
Improved S-box4 110 112 111 103.43 0.4977 0.4973 0.5781 0.4062 10
Ref. [21] 110 112 110.25 104.07 0.5021 0.4953 0.5781 0.4219 10
Ref. [20] 108 112 109.75 104.35 0.5009 0.5068 – – 10
Ref. [19] 106 110 109.25 104.07 0.5005 0.5017 – – 10
Ref. [18] 106 110 108.5 103.85 0.5011 0.4995 – – 10
Ref. [17] 108 108 108 90 0.4950 0.5068 0.5781 0.4063 10
Ref. [16] 106 110 107.5 103.7 0.5025 0.5093 0.6094 0.3750 10
Ref. [15] 106 108 107.5 104.3 0.5001 0,4944 0.5731 0,4219 10
Ref. [14] 106 108 107 104.6 0.4974 0.496 0.5781 0,4219 10
Ref. [13] 106 110 107 105.5 0.5010 0.5015 0.5625 0.4063 10
Ref. [12] 104 108 106.5 105.85 0.4995 0.5036 0.6406 0.4062 10
Ref. [11] 104 110 106.5 105.2 0.4984 0.5120 0.6406 0.4375 10
Ref. [10] 100 108 104.7 105 0.4965 0.4037 0.5938 0.3906 32
Ref. [9] 102 106 104 103.2 0.4971 0.4980 0.6093 0.3750 10
The performance of the proposed method, the mean nonlinearity value, which is the fitness value, is highlighted in bold
Acknowledgements Fatih Özkaynak was supported in part by the 6. Artuğer F, Özkaynak F (2022) A method for generation of sub-
Scientific and Technological Research Council of Turkey under Grant stitution box based on random selection. Egypt. Inform. J.
121E600. 23(1):127–135
7. Nyberg K (1994) Differentially uniform mappings for cryptog-
Author contributions FA was involved in the conceptualization, data raphy. In: Proceedings of Eurocrypt. Lecture notes in computer
curation, formal analysis, investigation, methodology and software. science, vol 765. Springer, Berlin, pp 55–64
FÖ contributed to the supervision visualization, original draft, writ- 8. Açikkapi MŞ, Özkaynak F (2021) A method to determine the
ing—review and editing, funding acquisition, project administration most suitable initial conditions of chaotic map in statistical ran-
and resources. domness applications. IEEE Access 9:1482–1494
9. Chen G (2008) A novel heuristic method for obtaining S-boxes.
Chaos Solitons Fractals 36(4):1028–1036
Declarations 10. Hussain I, Shah T, Gondal MA, Khan WA, Mahmood H (2013) A
group theoretic approach to construct cryptographically strong
Conflicts of interest The authors declare that they have no conflicts of substitution boxes. Neural Comput Appl 23(1):97–104
interest. 11. Farah T, Rhouma R, Belghith S (2017) A novel method for
designing S-box based on chaotic map and teaching–learning-
based optimization. Nonlinear Dyn 88(2):1059–1074
References 12. Hematpour N, Ahadpour S (2021) Execution examination of
chaotic S-box dependent on improved PSO algorithm. Neural
1. Artuğer F, Özkaynak F (2021) An effective method to improve Comput Appl 33(10):5111–5133
nonlinearity value of substitution boxes based on random selec- 13. Ahmad M, Bhatia D, Hassan Y (2015) A novel ant colony
tion. Inf Sci 576:577–588 optimization based scheme for substitution box design. Procedia
2. Wei Y, Pasalic E, Zhang F, Hodžić S (2017) Efficient proba- Comput Sci 57:572–580
bilistic algorithm for estimating the algebraic properties of 14. Alhadawi HS, Lambić D, Zolkipli MF, Ahmad M (2020) Glob-
Boolean functions for large n. Inf Sci 402:91–104 alized firefly algorithm and chaos for designing substitution box.
3. Wu C, Feng D (2016) Boolean functions and their applications in J Inf Secur Appl 55:102671
cryptography. Springer, Berlin 15. Ahmed HA, Zolkipli MF, Ahmad M (2019) A novel efficient
4. Daemen J, Rijmen V (1998) AES proposal: Rijndael. In: Pro- substitution-box design based on firefly algorithm and discrete
ceedings of 1st advance encryption conference, CA, USA, chaotic map. Neural Comput Appl 31(11):7201–7210
pp 1–45 16. Tian Y, Lu Z (2017) Chaotic S-box: intertwining logistic map and
5. Ors SB, Preneel B, Verbauwhede I (2007) Side-channel analysis bacterial foraging optimization. Math Problems Eng
attacks on hardware implementations of cryptographic algo- 2017:6969312
rithms, in Wireless Security and Cryptography-Specifications and 17. Wang Y, Wong KW, Li C, Li Y (2012) A novel method to design
Implementations. CRC Press, Boca Raton S-box based on chaotic map and genetic algorithm. Phys Lett A
376(6–7):827–833
123
Neural Computing and Applications (2022) 34:20203–20211 20211
18. Alhadawi HS, Majid MA, Lambić D, Ahmad M (2021) A novel 25. Artuğer F, Özkaynak F (2020) A novel method for performance
method of S-box design based on discrete chaotic maps and improvement of chaos-based substitution boxes. Symmetry
cuckoo search algorithm. Multimed Tools Appl 80(5):7333–7350 12(4):571
19. Zamli KZ, Kader A, Din F, Alhadawi HS (2021) Selective 26. Alshammari BM, Guesmi R, Guesmi T, Alsaif H, Alzamil A
chaotic maps Tiki-Taka algorithm for the S-box generation and (2021) Implementing a symmetric lightweight cryptosystem in
optimization. Neural Comput Appl 33:16641–16658 highly constrained IoT devices by using a chaotic S-box. Sym-
20. Zamli KZ (2021) Optimizing S-box generation based on the metry 13(1):129
adaptive agent heroes and cowards algorithm. Expert Syst Appl 27. Xian Y, Wang X (2021) Fractal sorting matrix and its application
182:115305 on chaotic image encryption. Inf Sci 547:1154–1169
21. Wang Y, Zhang Z, Zhang LY, Feng J, Gao J, Lei P (2020) A 28. Ibrahim S, Alhumyani H, Masud M, Alshamrani SS, Cheikh-
genetic algorithm for constructing bijective substitution boxes rouhou O, Muhammad G, Hossain MS, Abbas AM (2020)
with high nonlinearity. Inf Sci 523:152–166 Framework for efficient medical image encryption using dynamic
22. Alatas B, Akin E, Ozer AB (2009) Chaos embedded particle S-boxes and chaotic maps. IEEE Access 8:160433–160449.
swarm optimization algorithms. Chaos Solitons Fractals https://doi.org/10.1109/Access.628763910.1109/ACCESS.2020.
40(4):1715–1734 3020746
23. Özkaynak F (2020) On the effect of chaotic system in perfor-
mance characteristics of chaos based S-box designs. Phys. A Stat. Publisher’s Note Springer Nature remains neutral with regard to
Mech. Appl. 550:124072. https://doi.org/10.1016/j.physa.2019. jurisdictional claims in published maps and institutional affiliations.
124072
24. Sprott J (2010) Elegant chaos algebraically simple chaotic flows.
World Scientific, Singapore
123