Introduction

Data security plays an essential task in daily life because of the increasing growth of the internet and communication technologies. Visual data, like images and videos, are commonly utilized for representing the majority of data due to its having more detailed information. Digital images can be secured during the transmission and storing process on local or cloud storage via utilizing one of several image data hiding or image cryptosystems [1, 2]. The main aim of image cryptosystems is to transform the image from a recognizable style to an unrecognizable format. There are many tools utilized in designing modern image cryptosystems, like chaotic maps, S-boxes, cellular automata, DNA, etc. [3,4,5].

Any well-designed image cryptosystem has mainly three phases: (1) key generation, which is related to the pristine image; (2) confusion; and (3) diffusion. In addition to their main role in the diffusion process, S-boxes may be utilized as permutation boxes for fulfilling the confusion process. Recently, chaotic systems have been commonly utilized as a primary tool for constructing S-boxes because of their chaotic behavior, ease of implementation, and sensitivity to control parameters and primary conditions [6, 7].

Motivation

Optimization algorithms play an essential role in constructing S-boxes to gain secure S-boxes with good nonlinearity [8, 9]. However, the role of optimization algorithms is to select a well-constructed S-box based on its performance analyses, not to utilize optimization algorithms in designing S-box mechanisms. Correspondingly, optimization algorithms play an essential role in developing image cryptosystems to gain secure cipher images with good cryptographic properties [10, 11]. However, the role of optimization algorithms is to select a well-constructed cipher image based on its performance analyses, not to utilize optimization algorithms in designing image cryptosystems. Optimization algorithms include particle swarm optimization (PSO) [12], artificial bee colony [13], ant colony optimization [14], and others, with the PSO algorithm having a low computational time, being simple to execute due to it does not need a large number of parameters, and having a high confluence rate. PSO focuses on a small number of random particles and uses recurrence to find an effective solution. Therefore, Luo et al. [15] utilized the benefits of the PSO algorithm and customized it to perform as a chaotic system for designing a novel image cryptosystem with good performance.

The physical implementation of quantum computers does not have sufficient capability for hacking any traditional cryptosystem yet, but amidst the growth of quantum resources, sufficient capability may be available in the near future and most digital cryptosystems may be breached because their design is based on mathematical models [16]. Therefore, some researchers are concerned with developing quantum algorithms for securing data in the quantum era [17]. However, most digital data have a long lifetime, like military, medical, personal, etc. Consequently, confidential data must be secured before powerful quantum computers are available for hacking these data. Based on the issues raised, we need to develop new cryptosystems with structures based on quantum-inspired models that can withstand possible assaults from both classical and quantum devices, and their structures are based on optimization techniques to provide extra security. Among quantum paradigms, there is a quantum walk (QW), which is a quantum computing model used in the development of quantum mechanisms and may be used as a quantum-inspired model for constructing current cryptosystems that can be run on both digital and quantum platforms.

Contribution

From the stated issues above, we present a new S-box whose design is based on quantum-inspired QW, Hénon map, and a customized PSO algorithm. In the suggested S-box approach, QW is utilized as a quantum-inspired model to be performed on digital resources, and the PSO algorithm is customized to be utilized in designing the proposed mechanism. Performance analysis of the presented S-box proves its effectiveness and its reliability in designing various cryptosystems. Based on the efficiency of the presented S-box, a new image cryptosystem is suggested. In the suggested image cryptosystem, the probability vector generated from operating quantum-inspired QW and the generated sequences from Hénon map are utilized to operate the customized PSO algorithm for generating two sequences (X and Y), in which X and Y sequences are utilized for constructing different two permutation boxes to shuffle columns and rows of the pristine image. Then, the X sequence is utilized for constructing an \(8\times 8\) S-box to substitute the pixels of the permutated image, while the Y sequence is utilized for generating a pseudo-random sequence to construct the cipher image from the substituted image. Experimental results of the suggested image cryptosystem prove its efficiency and security against various attacks.

The summary of the key contributions of this study is listed below:

  1. 1.

    This study opens the door to utilizing quantum-inspired models with optimization algorithms in designing S-boxes.

  2. 2.

    Designing a new S-box using quantum-inspired QW, Hénon map, and the customized PSO algorithm.

  3. 3.

    Performance analysis of the presented S-box proves its effectiveness and its reliability in designing various cryptosystems.

  4. 4.

    Suggesting a new image encryption approach using the presented S-box approach.

  5. 5.

    The presented encryption approach has a high sensitivity for both pristine image and key sensitivity.

Organization

The remnant of this study is scheduled as given: the recent works related to the presented study are discussed in the next section, while the preliminaries for QW, Hénon map, and the customized PSO algorithm are given in “Preliminaries”. The suggested S-box approach and its performance are delivered in “Proposed S-box algorithm and its analyses”, while the proposed image cryptosystem and its performance analyses are provided in “Proposed encryption algorithm” and “Experimental outcomes and analyses”.

Related work

Visual data, like images and videos, are commonly utilized for representing the majority of data due to its having more detailed information. Digital images can be secured during the transmission and storing process on local or cloud storage via utilizing one of several image encryption techniques. Recently, chaotic systems have been commonly utilized as a primary tool for developing image cryptosystems because of their chaotic behavior, ease of implementation, and sensitivity to control parameters and primary conditions. For example, Wang and Gao [18] presented a new chaos-based image encryption approach using the semi-tensor product. In the presented cryptosystem, the plain image is splitted into 4 blocks at random, then utilize several rounds of Arnold cat map to scramble each block. Based on the logistic map, Rupa et al. [19] presented a new medical multimedia cryptosystem, but the presented cryptosystem suffers from plain image-sensitivity attacks. Using logistic map and a 2D chaotic system, Askar et al. [20] presented an image encryption algorithm, but the suggested approach does not achieve the sensitivity of the pristine image. Vaidyanathan et al. [21] introduced a new 4D hyperchaotic system and demonstrated its use in developing a new image cryptosystem.

Any well-designed image cryptosystem has mainly three phases: (1) key generation, which is associated with the original image; (2) confusion; and (3) diffusion. In addition to their main role in the diffusion process, S-boxes may be utilized as permutation boxes for fulfilling the confusion process. In [4], Naseer et al. presented an image encryption mechanism based on a 3D chaotic system, in which the permutation phase is based on a permutation box and the substitution phase is based on an S-box. However, plain image sensitivity is not achieved for the presented cryptosystem. Using a 1D chaotic system, Rehman et al. [22] offered a medical image cryptosystem for privacy-preserving the medical data during transmission before evaluating it for cancer detection, in which an S-box is used in the substitution phase of the encryption procedure. Recently, chaotic systems have been commonly utilized as a primary tool for constructing S-boxes because of their chaotic behavior, implementation easy, and parameters sensitivity and primary conditions. For example, Maazouz et al. [3] suggested a new 3D chaotic system and presented its purpose in constructing S-boxes and utilizing the generated S-box in designing a new image encryption scheme, but the final encrypted image is generated after several rounds of encryption. Based on a 3D chaotic system, El-Latif et al. [23] offered a new S-box construction algorithm and its application in designing a new image encryption scheme, in which the generated S-boxes are utilized in permutation and substitution phases. Also, El-Latif et al. [7] suggested a new 3D hyperchaotic system and presented its application in constructing S-boxes and utilizing the generated S-box in designing a new image cryptosystem. In [24], Belazi et al. presented a new approach for constructing S-boxes based on a 1D chaotic map and utilizing the generated S-box in designing a new image encryption scheme. Using the Latin square and a 1D chaotic map, Hua et al. [25] presented a new S-box construction algorithm and presented its purpose in designing an image encryption. Based on the Gingerbreadman chaotic system, Khan and Asghar [26] presented a new S-box construction algorithm.

Optimization algorithms play an essential role in constructing S-boxes to gain secure S-boxes with good nonlinearity. For example, Zamli [9] presented a new S-box construction based on the adaptive agent heroes and cowards (AAHC) algorithm and Tent map, in which the role of AAHC is to select a well-constructed S-box based on its strict avalanche criteria (SAC) and nonlinearity. Also, Zamli et al. [27] presented a new S-box construction algorithm based on selective chaotic maps, in which the Tiki-Taka algorithm is used to select a well-constructed S-box based on its nonlinearity. Based on a 1D chaotic map and the cuckoo search algorithm, Alhadawi et al. [28] presented a new S-box construction algorithm, in which the role of the cuckoo search algorithm is to select a well-constructed S-box based on its nonlinearity. In [29], Farah et al. integrated three 1D chaotic maps for the construction of a new chaotic system and presented its purpose in constructing S-boxes and utilized the Jaya optimization algorithm to select a well-constructed S-box based on its nonlinearity. Then, the newly constructed S-boxes are utilized for designing a new image cryptosystem. Based on the optimization of control parameters for 1D chaotic maps, Tanyildizi and Ozkaynak [30] presented a new S-box construction algorithm, in which the Chi-square value is utilized as the objective function of optimization algorithms. Based on ergodic chaotic map and improved PSO, Hematpour and Ahadpour [8] presented a new S-box construction algorithm, in which the task of the improved PSO is to pick a well-constructed S-box based on its nonlinearity and entropy. However, the role of optimization algorithms stated in [8, 9, 27,28,29,30] is to select a well-constructed S-box based on its performance analyses, not to utilize optimization algorithms in designing S-box mechanisms.

Likewise, optimization algorithms play an essential role in developing image cryptosystems to gain secure cipher images with good cryptographic properties. For example, based on the integration of PWLC and 2DLC maps and improved whale optimization, Saravanan and Sivabalakrishnan [10] presented an image cryptosystem in which the final cipher image is obtained by iterative improved whale optimization using the best values for information entropy. In [11], Noshadian et al. introduced an image encryption approach using evolutionary algorithms and the logistic map. The final cipher image is optimized using information entropy or correlation coefficient. Wang and Li [31] introduced an image encryption approach using PSO, DNA, and the logistic map, but the final cipher image is obtained by iterative PSO using the best values for information entropy and correlation coefficient. Using a 4D hyperchaotic map and PSO, Zeng and Wang [32] suggested an image encryption scheme in which the final cipher image is obtained by iterative PSO using the best values for correlation coefficients. In [33], Ahmad et al. suggested an image cryptosystem using PSO and the logistic map, but the final cipher image is obtained by iterative PSO using the best values for correlation coefficients. However, the role of optimization algorithms stated in [10, 11, 31,32,33] is to select a well-constructed cipher image based on its performance analyses, not to utilize optimization algorithms in designing image cryptosystems. To overcome this issue, Luo et al. [15] integrate PSO with a 4D hyperchaotic system for designing a new image cryptosystem.

The physical implementation of quantum computers doesn’t have sufficient capability for hacking any traditional cryptosystem yet, but amidst the growth of quantum resources, sufficient capability may be available in the near future and the majority of digital cryptosystems may be cracked because their design is based on mathematical models. Therefore, some researchers are concerned with developing quantum algorithms for securing data in the quantum age. For instance, Jiang et al. [17] suggested an quantum image encryption scheme based on the Henon map, but the suggested encryption approach suffers from plain image-sensitivity attacks.

Most digital data have a long lifetime, like military, medical, personal, etc. Consequently, confidential data must be secured before the availability of sufficiently powerful quantum computers for hacking this data. Therefore, El-Latif et al. [34] suggested a new S-box approach using quantum walks as a quantum-inspired model and a 1D chaotic map. Then the presented S-box approach is utilized for designing a new image cryptosystem, but the presented cryptosystem suffers from plain image-sensitivity attacks. In [16], Abd-El-Atty et al. presented an image encryption algorithm for cloud applications using quantum-inspired QW model, Henon map, and Gray code, in which the final encrypted image is generated after two rounds of encryption.

Based on the issues raised, we need to design new cryptosystems with structures based on quantum-inspired models that can withstand possible assaults from both classical and quantum devices, and their structure is based on optimization techniques to bring extra security. Accordingly, Abd-El-Atty integrates PSO and quantum walks in [35] to develop a novel medical image steganography algorithm that uses PSO in the embedding process. Therefore, we need to apply this idea to developing new S-box algorithms and their applications in image cryptosystems.

Preliminaries

In this part, we present the preliminaries for QW, Hénon map, and the customized PSO algorithm that are needed for developing the proposed S-box approach.

Quantum walk

There are two main elements for QW: coin particle \(H_{c} =\cos \theta |0\rangle +\sin \theta |1\rangle \) and walker space \(H_{s}\) [36]. In every step t of acting QW on a cycle of V-node governed by a binary message S, a unitary revolution \({\hat{R}}_{1}\) (or \({\hat{R}}_{0}\)) is applied on the whole quantum system if the \({t}\text {th}\)-bit of S is 1 (or 0), otherwise \({\hat{R}}_{2}\) is applied. The mathematical expression of \({\hat{R}}_{1}\) is as in Eq. (1),

$$\begin{aligned} {\hat{R}}_{1} ={\hat{H}}({\hat{I}}\otimes {\hat{O}}_{1} ), \end{aligned}$$
(1)

where \({\hat{H}}\) is the shift operator of running QW on a cycle of V-node and can be represented as follows:

$$\begin{aligned}{} & {} {\hat{H}}=\sum _{j=0}^{V-1}\left( |\left( j-1\right) \nonumber \right. \\{} & {} \left. \mod V,1\rangle \langle j,1|+|\left( j+1\right) \mod V,0\rangle \langle j,0|\right) \end{aligned}$$
(2)

and the coin operator \({\hat{O}}_{1}\) can be expressed as follows:

$$\begin{aligned} {\hat{O}}_{1} =\left( \begin{array}{cc} {\cos \sigma _{1} } &{} {\sin \sigma _{1} } \\ {\sin \; \sigma _{1} } &{} {-\cos \sigma _{1} } \end{array}\right) , \end{aligned}$$
(3)

where \(\sigma _{1} \in \left[ 0,\pi /2\right] \). Similar \({\hat{R}}_{1}\), \({\hat{R}}_{0}\) and \({\hat{R}}_{2}\) can be formed. After operating QW t steps, the probability of finding the particle at vertex j can be stated as in Eq. (4):

$$\begin{aligned} \hbox {Prb}(j,t)=\left| {\left\langle j,0 \right| } \left( {\hat{R}}_{c} \right) ^{t} |\varphi \rangle _{0} \right| ^{2} +\left| {\left\langle j,1 \right| } \left( {\hat{R}}_{c} \right) ^{t} |\varphi \rangle _{{0}} \right| ^{2}, \end{aligned}$$
(4)

where \(c\in \left\{ 0,1,2\right\} \) and \(|\varphi {\rangle }_{{0}} \) is the original quantum state of QW.

Hénon map

Chaotic systems have been commonly utilized as a primary tool for constructing S-boxes and image cryptosystems because of their chaotic behavior, ease of implementation, and sensitivity to control parameters and primary conditions. Hénon map is a two-dimensional chaotic map and is expressed in Eq. (5):

$$\begin{aligned} \left\{ \begin{array}{l} {p_{j+1} =q_{j} -ap_{j}^{2} +1} \\ {q_{j+1} =bp_{j} }, \end{array}\right. \end{aligned}$$
(5)

where \({p}_{0}\), \({q}_{0}\) are the primary conditions and \(a=1.4,\) \(b=0.3\) are the control parameters of Hénon map. For more information about the chaotic Hénon map, go to Ref. [17].

Particle swarm optimization

Optimization algorithms play an essential role in constructing S-boxes to gain secure S-boxes with good nonlinearity. However, the role of optimization algorithms is to select a well-constructed S-box based on its performance analyses, not to utilize optimization algorithms in designing S-box mechanisms. Among optimization algorithms, there is the PSO algorithm, which has a low computational time, being simple to execute due to it does not need a large number of parameters, and having a high confluence rate. PSO focuses on a small number of random particles and uses recurrence to find an effective solution. In PSO, each particle represents an individual solution. Each particle k possesses an initial state, pbest \((z_k),\) gbest \((w_k),\) and two primary parts: velocity \((x_k)\) and position \((y_k),\) which are used to run the PSO algorithm. To update each particle’s location and velocity, Eq. (6) can be utilized [37]:

$$\begin{aligned} \left\{ \begin{array}{l} x_{k,j}(i+1) =\alpha x_{k,j}(i) +d1\times u_{j}(i) (z_{k,j} (i) -y_{k,j}(i) ) \\ \qquad \qquad \qquad \quad +d2\times v_{j}(i) (w_{k,j}(i) -y_{k,j}(i)) \\ {y_{k,j}(i+1) =x_{k,j}(i+1) +y_{k,j}(i) }, \end{array}\right. \end{aligned}$$
(6)

where i denotes the iteration number, k is the particle number, the particle’s dimensions are j, \(\alpha \) indicates the inertia coefficient, d1 is the subjective parameter, d2 is the collective parameter, and \(u_{j},v_{j} \in \left( 0,1\right) \) are random numbers.

To adapt the PSO algorithm to be employed in the designing process of the suggested S-box algorithm, we customized it as reported in [15]. The mathematical representation of the customized PSO algorithm is provided as follows:

$$\begin{aligned} \left\{ \begin{array}{l} {x_{i+1} =\alpha x_{i} +d1 \times u_{i} \left( z_{i} -y_{i} \right) +d2 \times v_{i} \left( w_{i} -y_{i} \right) } \\ {y_{i+1} =x_{i+1} +y_{i} }, \end{array}\right. \end{aligned}$$
(7)

where sequence \(\{U\}\) is generated from running QW, and sequences \(\{V\}\), \(\{Z\}\), and \(\{W\}\) are generated from iterating Hénon map.

Proposed S-box algorithm and its analyses

S-boxes are considered the backbone component of designing modern cryptosystems. Recently, chaotic systems have been commonly utilized as a primary tool for constructing S-boxes because of their chaotic behavior, ease of implementation, and sensitivity to control parameters and primary conditions. Also, optimization algorithms play an essential role in constructing S-boxes to gain secure S-boxes with good nonlinearity. However, the role of optimization algorithms in the constructed S-boxes is to select a well-constructed S-box based on its performance analyses, not to utilize optimization algorithms in designing S-box mechanisms. Amidst the growth of quantum resources, sufficient capability may be available in the near future and most S-boxes may be hacked. Based on the issues raised, we need to develop new S-box mechanisms based on quantum-inspired models that can withstand possible assaults from both classical and quantum devices, and their structures are based on optimization techniques to provide extra security. In this regard, we present a new S-box algorithm to fulfill the requirements mentioned above.

S-box algorithm

The suggested S-box algorithm is based on quantum-inspired QW, Hénon map, and the customized PSO algorithm, in which QW is utilized as a quantum-inspired model to be performed on digital resources, and the PSO algorithm is customized to be utilized in designing the proposed mechanism. The detailed steps of the suggested S-box algorithm are itemized in the following points.

  1. Step 1:

    Set the initial values of parameters (S, V, t, \(\theta \), \(\sigma _{0}\), \(\sigma _{1}\), \(\sigma _{2}\), \(p_{0}\), \(q_{0}\), a, b, \(\alpha \), d1, d2, \(x_{0}\), \(y_{0}\)).

  2. Step 2:

    Using S, V, t, \(\theta \), \(\sigma _{0}\), \(\sigma _{1}\), \(\sigma _{2}\) operate QW for t steps on a circle of V-vertex as a quantum-inspired model, for producing a probability vector Prb of length V, then resize the elements of the Prb vector to another vector of length g, where g is the number of elements in the desired S-box

    $$\begin{aligned} U=\hbox {resize}\left( \hbox {Prb},\left[ \begin{array}{cc} {g}&{1} \end{array}\right] \right) . \end{aligned}$$
    (8)
  3. Step 3:

    Using \(p_{0}\), \(q_{0}\), a, b iterate Hénon map for g times, and generating two chaotic sequences (P, Q) each of length g, then from these sequences generate three sequences as given below

    $$\begin{aligned}{} & {} V=P \mod 1, \end{aligned}$$
    (9)
    $$\begin{aligned}{} & {} Z=Q \mod 1, \end{aligned}$$
    (10)
    $$\begin{aligned}{} & {} W=\left( P-Q\right) \mod 1. \end{aligned}$$
    (11)
  4. Step 4:

    Using parameters (\(\alpha \), d1, d2, \(x_{0}\), \(y_{0}\)) and the generated sequences (U, V, Z, W) operate the customized PSO (7) for generating two sequences (X, Y) each of length g.

  5. Step 5:

    Organize the elements of a sequence X from the smallest to the largest as a sequence A, then locate the index of per element of A in X as an S-box of g-element.

S-box performance analyses

To verify the efficiency of the offered S-box algorithm, several analyses performed for the constructed \(8\times 8\) S-box. The most crucial requirements for a robust S-box have been laid forth in [38]. Among these requirements, Bijectivity, NL (“nonlinearity”), SAC (“strict avalanche criterion”), BIC (“bit independence”), LP (“linear approximation probability”), and DP (“differential probability”). The key parameters that utilized for constructing the S-box stated in Table 1 are set as: S = [0100 0100 1011 1101 0101 0101 0110 1001 1010 0110 0101], \(V=265, t= 270, \theta =0,\) \({\sigma }_{0}= \pi /3,\) \({\sigma }_{1}= \pi /4,\) \({\sigma }_{2}= \pi /6,\) \({p}_{0}=0.6495,\) \({q}_{0}=0.5073,\) \(a=1.4,\) \(b=0.3,\) \(\alpha =0.1,\) \(d1=0.5,\) \(d2=0.5,\) \({x}_{0}=0.5,\) and \({y}_{0}=1.\)

Table 1 The constructed \(8\times 8\) S-box
Table 2 Nonlinearities
Table 3 Dependence matrix of the presented S-box

Bijective characteristic

An \(n\times n\) S-box is bijective if it has \(2^n\) distinct integer and all in the range \([0,2^n-1]\). From the elements stated in Table 1, the provided S-box satisfies the bijective property.

Table 4 Comparison of SAC

Nonlinearity

The constructed S-box has nonlinearity scores of 108, 108, 108, 106, 102, 110, 106, and 108, respectively. The nonlinearities of our S-box and other S-boxes displayed in [23,24,25, 29, 39] are stated in Table 2, in which our constructed S-box has good average nonlinearity.

Table 5 BIC-nonlinearity of our S-box
Table 6 BIC–SAC criterion of our S-box

SAC

Table 3 displays the dependence matrix for the generated S-box. The average value of the generated dependence matrix is 0.5044, which is extremely close to the optimal value of 0.5000. Table 4 lists the max, min, and average values of the dependence matrix for our S-box and other S-boxes. The results show that our S-box has good SAC properties.

BIC

Tables 5 and 6 show the BIC results for our S-box. The BIC-nonlinearity is shown in Table 5 with an average value of 103. According to Table 6, the BIC-SAC average is 0.5066, which is extremely close to the ideal value of 0.5000. Therefore, the constructed S-box satisfies the BIC criteria. The results from our S-box provide a realistically acceptable range, as shown by a comparison of the nonlinearities of BIC and BIC–SAC in Table 7.

Differential approximation probability

Table 8 shows the differential approximation values for the constructed S-box. The presented approach is robust against differential assaults, as shown by the DPs values of the constructed S-box, which is 0.03125. Table 9 provides the PDs of different S-boxes, and our S-box has an acceptable DP value when compared to other S-boxes.

Table 7 Comparison of BIC
Table 8 DP for our S-box

LP

Table 10 provides the probability of linear approximation for our S-box with other S-boxes. As a result, the constructed S-box exhibits acceptable LP properties.

Table 9 DP comparison
Table 10 Comparison of LP
Table 11 Values of NL, SAC, BIC, LP, and DP for the constructed S-box compared with other related S-box algorithms

Discussion

The proposed S-box approach was evaluated in terms of NL, SAC, BIC, LP, and DP in which Table 11 displays the values of these terms for our S-box with other related S-boxes reported in [6,7,8, 23,24,25,26, 29, 30, 34, 39]. The S-boxes reported in [6, 7, 23,24,25,26] are based on chaotic systems, while the S-boxes reported in [8, 29, 30, 39] are based on optimization algorithms to select a well-constructed S-box based on its performance analyses, not to utilize optimization algorithms in developing S-box mechanisms. The S-box reported in [34] is based on quantum-inspired QW, while the proposed S-box mechanism is based on quantum-inspired QW that can withstand possible assaults from both classical and quantum devices, and its structure is based on the customized PSO to provide extra security.

From the stated evaluations above, we can deduce that:

  1. 1.

    The proposed S-box mechanism is based on quantum-inspired QW and the customized PSO to provide extra security.

  2. 2.

    Table 1 proves the bijective characteristic of the constructed S-box.

  3. 3.

    Table 11 shows that the constructed S-box performs well in comparison to other S-boxes.

  4. 4.

    The average of the S-box’s BIC–SAC value is 0.5030, which is extremely close to the ideal value.

  5. 5.

    The max value of DP, Table 9, is acceptable.

  6. 6.

    The LP value, Table 10, is acceptable.

Proposed encryption algorithm

Images are commonly utilized for representing the majority of data due to their having more detailed information. Using image encryption methods, digital images may be protected in which S-boxes are extensively utilized in the designing process of image cryptosystems. Due to the effectiveness of the proposed S-box algorithm, we propose a new image cryptosystem as a cryptographic purpose of this S-box algorithm. In the suggested image cryptosystem, the probability vector generated from operating quantum-inspired QW and the generated sequences from the Hénon map are utilized to operate the customized PSO algorithm for generating two sequences (X and Y), in which X and Y sequences are utilized for constructing different two permutation boxes to shuffle columns and rows of the pristine image. Then, the X sequence is utilized for constructing an \(8\times 8\) S-box to substitute the pixels of the permutated image, while the Y sequence is utilized for generating a pseudo-random sequence to generate the encrypted image from the substituted image. The framework of the suggested encryption algorithm is shown in Fig. 1, and the detailed steps of the encryption procedure are listed in the following points.

Fig. 1
figure 1

Description of the offered encryption scheme

  1. Step 1:

    Set the initial values of parameters (S, V, t, \(\theta \), \(\sigma _{0}\), \(\sigma _{1}\), \(\sigma _{2}\), \(p_{0}\), \(q_{0}\), a, b,\(\alpha \), d1, d2, \(x_{0}\), \(y_{0}\)).

  2. Step 2:

    Acquire the hash code (\(H=h_{1},h_{2},\ldots ,h_{256}\)) for the pristine image (PIm) using SHA-256 algorithm, and convert each 8-bit of H into integers (\(N=n_{1},n_{2},\ldots ,n_{32}\)), then update the initial values of \(p_{0}\), \(q_{0}\), and S using N as stated in the following equations:

    $$\begin{aligned}{} & {} p_{\textrm{new}} =\left( p_{0} +\frac{n_{1} \oplus n_{2} \oplus \cdots \oplus n_{8} }{256} \right) /2, \end{aligned}$$
    (12)
    $$\begin{aligned}{} & {} q_{\textrm{new}} =\left( q_{0} +\frac{n_{9} \oplus n_{10} \oplus \cdots \oplus n_{16} }{256} \right) /2, \end{aligned}$$
    (13)
    $$\begin{aligned}{} & {} S_{\textrm{new}} =\left[ \begin{array}{cc} {S}&{\textrm{de2bi}\left( \sum _{k=17}^{32}n_{k} \right) } \end{array}\right] . \end{aligned}$$
    (14)
  3. Step 3:

    Using \(S_{\textrm{new}}\), V, t, \(\theta \), \(\sigma _{0}\), \(\sigma _{1}\), \(\sigma _{2}\) operate QW for t steps on a circle of V-vertex, for producing a probability vector Prb of length V, then resize the elements of the Prb vector to another vector of length \(R \times C \times T\), where \(R\times C\) is the size of the original image PIm and T is the number of color components in PIm

    $$\begin{aligned} U=\hbox {resize}\left( \hbox {Prb},\left[ \begin{array}{cc} {{RCT}}&{1} \end{array}\right] \right) . \end{aligned}$$
    (15)
  4. Step 4:

    Using \(p_{\textrm{new}}\), \(q_{\textrm{new}}\), a, b iterate Hénon map for g times, and generating two chaotic sequences (P, Q) each of length \(R\times C \times T\), then from theses sequences generate three sequences as given below

    $$\begin{aligned}{} & {} V=P \mod 1, \end{aligned}$$
    (16)
    $$\begin{aligned}{} & {} Z=Q \mod 1, \end{aligned}$$
    (17)
    $$\begin{aligned}{} & {} W=\left( P-Q\right) \mod 1. \end{aligned}$$
    (18)
  5. Step 5:

    Using parameters (\(\alpha \), d1, d2, \(x_{0}\), \(y_{0}\)) and the generated sequences (U, V, Z, W) operate the customized PSO (7) for generating two sequences (X, Y) each of length \(R\times C \times T\).

  6. Step 6:

    Constructing a permutation box to shuffle rows of PIm image by arranging the elements of a sequence A (where A = X(501:500 + R)) in ascending order as a sequence B, then locate the index of per element of B in A as permutation box PerR.

  7. Step 7:

    Similar to constructing PerR, construct PerC using sequence Y(1001:1000 + C) to shuffle columns.

  8. Step 8:

    Permutate the pristine image PIm using the constructed permutation boxes PerR and PerC

    $$\begin{aligned}{} & {} \hbox {PerIm}\left( i,j,:\right) =\hbox {PIm}\left( \hbox {PerR}(i),\hbox {PerC}(j),:\right) \\{} & {} \hbox {for}\ i=1\ \hbox {to}\ R,\ j=1\ \hbox {to}\ C. \end{aligned}$$
  9. Step 9:

    Construct an \(8\times 8\) S-box (Sb) using sequence X(1:256), and substitute the permutated image PerIm using Sb

    $$\begin{aligned}{} & {} \hbox {SubIm}\left( i,j,k\right) =\hbox {Sb}\left( \hbox {PerIm}(i,j,k)\right) \\{} & {} \hbox {for}\ i=1\ \hbox {to}\ R,\ j=1\ \hbox {to}\ C,\ k=1\ \hbox {to}\ T. \end{aligned}$$
  10. Step 10:

    To construct the final cipher image (CiphIm), convert the Y sequence to integer values (K) and use K to perform the BitXor operation with the substituted image SubIm

    $$\begin{aligned}{} & {} K=\hbox {floor}\left( Y\times 10^{14} \mod 256\right) , \end{aligned}$$
    (19)
    $$\begin{aligned}{} & {} \hbox {CiphIm}=K\oplus \hbox {SubIm}. \end{aligned}$$
    (20)
Fig. 2
figure 2

Utilized dataset and its cipher images using the suggested cryptosystem

Experimental outcomes and analyses

To appreciate the competence of the suggested image cryptosystem, we utilized a dataset of color images brought from SIPI image database [40], in which the dimension of each image is \(512 \times 512\). Experiments were carried out using the MATLAB software version R2016b, which was installed on a PC with an Intel \({\hbox {{Core}}^{\textrm{TM}}}\) Due 3 GHz processor and 4GB of RAM. The initial key parameters are set as: S = [0100 0100 1011 1101 0101 0101 0110 1001 1010 0110 0101], \(V=265,\) \(t= 271,\) \(\theta =0,\) \({\sigma }_{0}=\pi /3,\) \({\sigma }_{1}=\pi /4,\) \({\sigma }_{2}= \pi /6,\) \({p}_{0}=0.6495,\) \({q}_{0}=0.5073,\) \(a=1.4,\) \(b=0.3,\) \(\alpha =0.1,\) \(d1=0.5,\) \(d2=0.5,\) \({x}_{0}=0.5,\) and \({y}_{0}=1.\)

The cipher images for the supplied dataset are shown in Fig. 2, in which no visual information about pristine images can be gained from encrypted images. In addition to visual effects, several analyses were carried out to validate the effectiveness of the proposed cryptosystem.

Complexity analysis

To check the efficacy of the suggested encryption scheme in terms of computational cost, we examine it from two viewpoints: computational complexity and encryption time.

The presented encryption approach primarily includes three phases: key generation, confusion, and diffusion. The utilized key streams are generated using Hénon map, QW, and the customized PSO. Hénon map iterates RC times, where RC is the dimensions of the original image, therefore the complexity of operating Hénon map is thus \({\mathcal {O}}(RC)\); and the complexity of acting QW on a cycle of V-vertex is \({\mathcal {O}}(V^2)\), while the complexity of operating the customized PSO (7) is \({\mathcal {O}}(RC)\). The confusion strategy is based on two permutation boxes, one for acting rows and the other for acting columns which both are based on sorting the elements and locating the index of per element, with an \({\mathcal {O}}(\max (R \log R, C \log C))\) computational complexity. The diffusion strategy is based on constructing an S-box with an \({\mathcal {O}}(256 \log 256)\) computational complexity, and the bitwise XOR operation with an \({\mathcal {O}}(RC)\). According to the reported computational complexity for each component of the suggested encryption approach, the whole computational complexity of the encryption approach is \({\mathcal {O}}(\max (RC, V^2))\).

Table 12 Comparison of the recommended scheme’s encryption time in megabytes/second to that of other relevant techniques
Table 13 Crf outcomes for the investigated dataset

Encryption time is known as the time taken to cipher one image. Table 12 provided a quick comparison of the recommended scheme’s encryption time in megabytes/second to that of other relevant techniques as reported in [7, 10, 15, 18, 20, 23, 24, 29, 41]. Based on the data displayed in Table 12, the presented encryption technique has an admissible time complexity and broad applicability.

Note that the constructed S-box using our methodology is generated once, not several times as in other S-box mechanisms that are based on optimization algorithms. Also, the cipher image is constructed once, not several times as in other image cryptosystems that are based on optimization algorithms. Therefore, our methodology has better performance and usability than other related methodologies that are based on optimization algorithms.

Correlation analysis

The correlation coefficient (Crf) of adjoining pixels is utilized to appreciate the meaning of an image, in which pristine images have strong Crf values close to 1 and good cipher images have Crf values close to 0. To calculate the Crf values for our experimented dataset and its related cipher images, we randomly selected \({10}^{4}\) pairs of adjacent pixels. Crf can be stated mathematically as follows

$$\begin{aligned} \hbox {Crf}=\frac{\sum _{j=1}^{M}\left( x_{j} -{\bar{x}}\right) \left( y_{j} -{\bar{y}}\right) }{\sqrt{\sum _{j=1}^{M}\left( x_{j} -{\bar{x}}\right) ^{2} \sum _{j=1}^{M}\left( y_{j} -{\bar{y}}\right) ^{2} } }, \end{aligned}$$
(21)

where M represents the number of adjacent pixel pairs \({x}_{j}\) and \({y}_{j}\). Table 13 states the Crf values for the investigated dataset, in which the Crf values for cipher images are very near to 0. To support Table 13 visually, Figs. 3, 4, and 5 plot the correlation distribution for Peppers image before and after the encryption procedure. From the stated outcomes in this subsection, we can extrapolate that the proposed cryptosystem is secure against correlation analysis.

Fig. 3
figure 3

The correlation distribution for Peppers image (red channel), in which the first row represents the original image, while the second row is for the cipher image

Fig. 4
figure 4

The correlation distribution for Peppers image (green channel), in which the first row represents the original image, while the second row is for the cipher image

Fig. 5
figure 5

The correlation distribution for Peppers image (blue channel), in which the first row represents the original image, while the second row is for the cipher image

Differential analysis

Differential analysis is utilized to appreciate the number of differences between two encrypted images for one plain image with slight modifications in one bit. There are two measures that are utilized in differential analyses: NPCR (“Number of Pixel Change Rate”) and UACI (“Unified Average Changing Intensity”), which are stated as given below

$$\begin{aligned}{} & {} \hbox {NPCR}=\frac{\sum _{a;b}f(a,b) }{M} \times 100\% \quad ,\nonumber \\{} & {} f(a,b)=\left\{ \begin{array}{ll} 0&{}\quad \hbox {if}\ R1(a,b)=R2(a,b) \\ 1&{}\quad \hbox {if}\ R1(a,b)\ne R2(a,b)\end{array}\right. \end{aligned}$$
(22)
$$\begin{aligned}{} & {} \hbox {UACI}=\frac{1}{M} \left( \sum _{a,b}\frac{\left| R1(a,b)-R2(a,b)\right| }{255} \right) \times 100\%, \end{aligned}$$
(23)

where M signifies the complete number of pixels in the image and R1,  R2 represent two encrypted images for one plain image with slight modifications in one bit. The results of NPCR and UACI are given in Table 14, in which NPCR values for all cipher images exceed 99.60% and UACI values are around 33.46%. Therefore, the suggested encryption algorithm has high pristine image sensitivity.

Table 14 UACI and NPCR results

Key sensitivity analysis

Key sensitivity analysis is utilized to appreciate the decryption effects of cipher images with slight modifications in initial key parameters. Figure 6 displays the visual effects of deciphering the Ciph-Peppers image with slight modifications in initial key parameters, from which we can deduce that the presented encryption technique has high key sensitivity.

Fig. 6
figure 6

Visual effects of deciphering the Ciph-Peppers image with slight modifications in initial key parameters

Histogram analysis

A histogram is used to appreciate the distribution of pixel values in an image. Cipher images generated by a well-developed cryptosystem should have indistinguishable histograms for different encrypted images. Figure 7 shows the histograms of the experimented dataset and its resulting encrypted images, in which the plots for the encrypted images are semi-similar to each other. To verify that the constructed cipher images have a regular distribution of histograms, we utilized a numerical test like the Chi-square \((\chi ^{2})\) test whose mathematical expression is given below

$$\begin{aligned} \chi ^{2} =\sum _{i=0}^{255}\frac{\left( r_{i} -s\right) ^{2} }{s}, \end{aligned}$$
(24)

where \(r_{i}\) is the frequency of the pixel value i, and s represents the dimension of the image. If the \(\chi ^{2}\) value does not exceed the threshold value \(\chi _{0.05}^{2} (255)=293.3\), then its histogram is regular, else the image has a non-uniform histogram. The outcomes of \(\chi ^{2}\) are given in Table 15, in which the \(\chi ^{2}\) values for all encrypted images are less than 293.3. Therefore, the suggested image cryptosystem can withstand histogram analysis attacks.

Fig. 7
figure 7

Histograms of the investigated dataset and its resulting cipher images, in which the last three columns are devoted to cipher images, while other histograms are for the pristine images

Entropy analysis

Image entropy test is used to appreciate the distribution of bit levels in an image. Cipher images constructed by a well-developed image encryption should have an entropy value very close to 8. The mathematical expression for entropy is given in Eq. (25)

$$\begin{aligned} E(A)=-\sum _{i=0}^{255}r(a_{i} )\log _{2} \left( r(a_{i} )\right) , \end{aligned}$$
(25)

where \(r(a_{i})\) represents the probability of \(a_{i}\). Table 16 states the results of the entropy test, in which cipher images have entropy values very approximately 8-bit. Hence, the suggested encryption approach can resist entropy attacks.

Occlusion analysis

To appreciate the suggested encryption scheme against occlusion attacks, we made cuts out of some parts of the encrypted image and then tried to decipher it. Figure 8 shows the outcomes of occlusion attacks, in which the deciphered image is recovered perfectly without lack of any visual information in the cutout part.

Table 15 The outcomes of \(\chi ^{2}\) test

Classical attacks

Generally, the cryptanalyst is familiar with the design and the operation of the under-consideration cryptosystem, aware of virtually everything about the encryption algorithm except the key parameters. A well-developed encryption algorithm must be has the ability to resist common attacks such as known-plaintext, ciphertext-only, chosen-ciphertext, and chosen-plaintext attacks. A cryptoanalyst in ciphertext-only attacks has only the ciphertext he has trapped, but in known-plaintext attacks, the cryptoanalyst has pairs of plaintext–ciphertext and tries to breach the secret key. In chosen-plaintext attacks, the cryptoanalyst has the ciphertext for a selected plaintext by himself, whereas in chosen-ciphertext attacks, the cryptoanalyst has the plaintext for a chosen ciphertext. The chosen-plaintext attack is the most powerful known assault, in which the cryptoanalyst earns transitory access to the cryptosystem and constructs ciphertext associated with a picked plaintext, attempting to breach the secret key or devising a strategy to decipher the ciphertext even access to the secret key. If an encryption approach can endure the chosen-plaintext attack, it can also endure other types of assaults. Due to the fact that the used keystream in the encryption procedure for our cryptosystem is based on the pristine image, the cryptoanalyst for the suggested encryption algorithm cannot get any information about the original key parameters by examining the ciphertext. In another manner, for each pristine image, a one-time keystream is generated, while the original key parameters remain unmodified. Because the totally paralyzed responsibilities of permutation and substitution procedures, cryptoanalysts prefer to nominate full-back and full-white images in chosen-plaintext assaults. The cipher images for FullBlack and FullWhite images, as well as their related histograms, are shown in Fig. 9, where no visual information can be acquired, and some statistical analyses for those images are stated in Table 17. As a consequence, the presented cryptosystem can withstand classical attacks.

Table 16 Entropy results
Fig. 8
figure 8

Occlusion outcomes

Fig. 9
figure 9

Cipher images for FullBlack and FullWhite images and their histograms

Table 17 Statistical analyses of Ciph-FullWhite and Ciph-FullBlack images

Discussion

The presented encryption approach was evaluated from two viewpoints to prove its effectiveness: performance and withstanding cryptanalysis attacks. Regarding performance, the final cipher image is constructed once, not several times as in other image cryptosystems that are based on optimization algorithms; and based on the data displayed in Table 12, the presented encryption technique has an admissible time complexity and broad applicability. Therefore, our methodology has better performance and usability than other related methodologies that are based on optimization algorithms.

Table 18 Comparison of the suggested encryption technique with other corresponding ones

Regarding cryptanalysis attacks, we performed several analyses to evaluate the presented encryption approach for withstanding differential, statistical, occlusion, brute-force, and classical types of attacks. Table 13 states the correlation coefficients for the analyzed dataset, in which its values for cipher images are very near to 0. To support Table 13 visually, Figs. 3, 4, and 5 plot the correlation distribution for Peppers image before and after the encryption procedure. Cipher images constructed by a well-designed cryptosystem should have indistinguishable histograms for different cipher images. Figure 7 displays the histograms of the investigated dataset and its resulting encrypted images, in which the plots for the encrypted images are semi-similar to each other. To verify that the constructed cipher images have a regular distribution of histograms, \(\chi ^{2}\)-test is utilized. The results of \(\chi ^{2}\) are provided in Table 15, in which the \(\chi ^{2}\) values for all cipher images are \(< 293.3.\) Cipher images constructed by a well-developed cryptosystem should have an entropy value very close to 8. Table 16 states the results of the entropy test, in which cipher images have entropy values of very approximately 8 bits. From the results of correlation, histogram, and entropy analyses, we can extrapolate that the proposed cryptosystem is secure against statistical analysis. Differential analysis is utilized to appreciate the number of differences between two encrypted images for one plain image with slight modifications in one bit. There are two measures that are utilized in differential analyses: NPCR and UACI. The results of NPCR and UACI are given in Table 14, in which NPCR values for all cipher images are \(> 99.60\%\) and UACI values are around 33.46%. Therefore, the suggested encryption algorithm has high pristine image sensitivity. Figure 6. displays the visual effects of deciphering the Ciph-Peppers image with slight modifications in initial key parameters, from which we can deduce that the presented encryption technique has high key sensitivity. To appreciate the suggested encryption scheme against occlusion attacks, we made cuts out of some parts of the cipher image and then tried to decipher it. Figure 8 shows the results of occlusion attacks, in which the ciphered image is restored perfectly without lack of any visual information in the cutout part. If an encryption approach can resist the chosen-plaintext attack, it can also resist other types of assaults. Due to the fact that the used keystream in the encryption procedure for our cryptosystem is based on the pristine image, the cryptoanalyst for the suggested encryption algorithm cannot gain any information about the original key parameters by examining the ciphertext. The ciphered images for FullBlack and FullWhite images, as well as their related histograms, are shown in Fig. 9, where no visual information can be acquired, and some statistical analyses for those images are stated in Table 17. As a consequence, the proposed cryptosystem can resist classical attacks. To verify the effectiveness of the offered encryption scheme alongside other corresponding ones, Table 18 stated the average values of UACI, NPCR, Chi-square, entropy, and correlation coefficients for the suggested scheme and their values in other corresponding ones. From the given values in Table 18, we deduce that the suggested encryption algorithm is effective and has high security.

Conclusion

The key contribution of this study is to pave the way to utilizing quantum-inspired models with optimization algorithms in designing robust S-boxes. In this paper, a new S-box technique based on quantum-inspired QW, Hénon map, and the customized PSO algorithm is proposed. Several analyses were performed to assess the effectiveness of the presented S-box technique, and its outcomes were utterly acceptable. Also, a new image cryptosystem based on the presented S-box approach is proposed. The stated experimental outcomes for the suggested cryptosystem prove its effectiveness and the reliability of the suggested S-box approach for various cryptographic purposes.

But the proposed cryptosystem is only appropriate for transmitting images securely over communication channels; it is not appropriate for other data types, such as text, video, audio, etc. This is one of the study’s drawbacks. Future modifications to the proposed technique will be made to support the secure transmission of diverse data types over communication channels.