Introduction

Image security is a crucial research area in information security, and cryptography is one of the most effective methods available in this field [1]. In innovative encryption techniques, secret images are transformed to meaningless noise-like images. Chaos-based image encryption methods have become one of the most ideal methods [2,3,4]. Chaos systems need to be evaluated by some severe tests, such as Lyapunov exponent, histogram and 0–1 test. The 0–1 test for chaos, which is a fundamental issue in the theory of chaotic dynamics to determine between regular and chaotic dynamics, was proposed by Gottwald and Melbourne [5,6,7]. Therefore, along with other methods of evaluating chaotic maps, we use these tests to confirm the chaotic behavior of the introduced 3D modular hybrid chaotic map with two control parameters.

A cyclic redundancy check (CRC) is one of the error detection techniques which generates some redundant bits called CRC to detect accidental changes to raw data in digital data and storage devices [8]. In order to produce the appropriate key space for the proposed algorithm, we find CRCs for different data blocks with different divisors.

Von Neumann was the first to introduce cellular automata (CA) as a tool for studying biological processes [9]. These automata belong to a class of discrete dynamical systems and possess unique characteristics such as linearity, reversibility and boundary conditions. The vast array of CA evolution rules allows for an extensive range of possibilities in generating sequences of CA data security. Additionally, one-dimensional CA substitutions solely comprise straightforward and uncomplicated logic operations, making them easy to compute. Cryptographic techniques are typically more efficient when using CA because of its parallelism, regular and straightforward structure and uncomplicated hardware design. Therefore, they can be utilized in the development of encryption algorithms for image encryption. In recent years, many researchers have used cellular automata in their presented algorithm for image encryption [10,11,12,13]. In [10], a technique for reconstructing the produced sequence is introduced, which exploits the linearity of the CA-based model. In [11], a unique type of cellular automata with periodic boundaries and unity attractors is employed. To ensure security, the number of attractor states in the cellular automata is altered based on the encrypted image, and distinct key streams are utilized to encrypt various plain images. Discrete transforms provide a highly efficient method for compressing and decompressing images while preserving their quality and offer a high degree of security. Discrete framelet transform provides a more flexible and adaptable approach to image processing and allows for greater control over the compression and encryption process. Additionally, discrete frame transforms can be used to create more complex encryption schemes and can provide even greater security for sensitive data. Khedmati et al. [12] presented an image security transform algorithm based on cellular automata, discrete framelet transform and chaotic system. In [13], an image encryption technique is introduced, which utilizes 2D Moore Cellular Automata to ensure both security and efficiency. This method is lossless and can be easily implemented in hardware. To enhance the security and resilience of our proposed method, we incorporate cellular automata. This involves considering the pixels of the original image as states at different times sequentially. Additionally, we utilize the outputs of the chaos system at the outset of this process.

In this article, a robust and resistive image encryption algorithm against noise and data loss attacks is presented. This algorithm due to utilizing the proposed chaos map and designed cellular automata has high sensitivity to initial conditions, uncertainty, high complex behavior and so on. The main advantages of this work can be described as follows:

  • We derive high-dimensional chaotic maps to have larger chaotic space.

  • We create a strong key space based on the proposed chaos map and CRC error detection method.

  • We designed a special shift operator to shuffle pixels of images, which results in the correlation reduction between pixels.

  • We utilize cellular automata to make the image encryption method more efficient.

The layout of this paper is as follows. In Sect. 2, we introduce a three-dimensional hybrid chaos map and then this map is generalized to a map with two control parameters. Section 3 delves into the detail of the designed shift function. Generation of CRC key and its all aspects are described in Sect. 4. Section 5 gives a brief description of new cellular automata used in the new encryption algorithm whose construction is presented in Sect. 6. Finally, numerical performance can be found in Sect. 7 to demonstrate efficiency of the proposed method.

3D Modular hybrid chaotic maps

Sensitive dependence on initial conditions is a key characteristic of chaos, making chaotic systems valuable for use in the development of cryptographic schemes. High-dimensional chaotic maps offer a larger chaotic space, further enhancing their utility in this regard. In this section, we first introduce the three-dimensional hybrid chaos map \({{\,\textrm{C3D}\,}}\), then we generalize this map to a map with two control parameters \({{\,\textrm{GC3D}\,}}\). Sequences of this chaotic map are extracted and used to construct the proposed key space and to present a new encryption algorithm. \({{\,\textrm{C3D}\,}}\) system with inputs \(x_0, y_0\) and \(z_0\) is defined as follows:

$$\begin{aligned}&x_{n+1}=E(x_n,y_n,z_n)\nonumber \\&\quad \times \left\{ \begin{array}{ll} rx_n(1-x_n)+2\sin (rx_ny_n)&{}\\ \quad +2\cos (20rz_n)+(4-r)z_n,&{}{{\,\textrm{mod}\,}}\,1;\;z_n<x_n,\\ rx_n(1-x_n)+2\sin (\pi rx_n)&{}\\ \quad +\sin (x_nz_n)+2(9-r)(1-z_n),&{}{{\,\textrm{mod}\,}}\,1;\;z_n\ge x_n,\\ \end{array}\right. \nonumber \\&y_{n+1}=E(x_n,y_n,z_n)\nonumber \\&\quad \times \left\{ \begin{array}{ll} ry_n(1-y_n)+2\cos (rx_{n+1}+y_n)&{}\\ \quad +\exp (y_n+z_n^2)+(4-r)x_{n+1}, &{}{{\,\textrm{mod}\,}}\,1;\;x_{n+1}<y_n,\\ \coth \big (ry_n(1-y_n)\big )+z_n^2+2\coth (\pi r y_n)&{}\\ \quad +(20-r)^2(1-x_{n+1})^2,&{}{{\,\textrm{mod}\,}}\,1;\;x_{n+1}\ge y_n,\\ \end{array}\right. \nonumber \\&z_{n+1}=E(x_n,y_n,z_n)\nonumber \\&\quad \times \left\{ \begin{array}{ll} \sinh \big (rz_n(1-z_n)\big )+2\cos (rz_n+y_{n+1}+z_n)&{}\\ \quad +(4-r)y_{n+1},&{} {{\,\textrm{mod}\,}}\,1;\;y_{n+1}<z_n,\\ rz_n(1-z_n)+2\tan (ry_{n+1})+\exp (2rx_ny_{n+1})&{}\\ \quad +\cos \big (2(7-r)(1-y_{n+1})\big ),&{}{{\,\textrm{mod}\,}}\,1;\;y_{n+1}\ge z_n,\\ \end{array}\right. \end{aligned}$$
(1)

in which \(E(x,y,z)=\exp \big ((0.1+xyz)^{-1}\big )\). To generalize this map to \({{\,\textrm{GC3D}\,}}\) with two control parameters \(r_1, rR_2\), we replace r with \(r_1\), \(\frac{r_1+r_2}{2}\) and \(r_2\) in the sub-functions related to \(x_{n+1}\), \(y_{n+1}\) and \(z_{n+1}\), respectively.

Fig. 1
figure 1

Histogram for proposed 3D hybrid chaos map. a–c Histograms of \({{\,\textrm{C3D}\,}}\) with \(r=1.85\) for \(x_n, y_n\) and \(z_n\), respectively, d–f histograms of \({{\,\textrm{GC3D}\,}}\) with \((r_1,r_2)=(1.05,0.65)\) for \(x_n, y_n\) and \(z_n\), respectively

If the dynamical system is chaotic, then two trajectories starting very close together will rapidly diverge from each other. There are some ways of measuring chaos of a dynamical system which we will discuss in the following. A histogram is a graphical representation of the distribution of numerical data. It is a bar graph which height of each bar shows how many are in each value. Smooth histograms are one of the most important features of ideal chaotic maps. Figure 1 shows the uniform distribution of proposed 3D hybrid chaotic maps. Lyapunov exponent (LE) is a fundamental instrument of the chaos theory which measures rate of separation or convergence of infinitesimally close trajectories. LE of discrete-time system \(x_{i+1}=f(x_i)\) can be calculated as:

$$\begin{aligned} \lambda =\lim _{n\rightarrow \infty }\dfrac{1}{n}\sum _{i=0}^{n-1}\ln |f^\prime (x_i)|. \end{aligned}$$
(2)

In Fig. 2, 501 and 4000 points are generated by \({{\,\textrm{C3D}\,}}\) and \({{\,\textrm{GC3D}\,}}\), respectively, are used. Positive \(\lambda\) means the dynamical system has chaotic behavior and larger \(\lambda\) proves greater sensitivity, i.e., the faster two nearby trajectories pulled apart. On the other hand, negative \(\lambda\) means the dynamical system is either periodic or stable.

Fig. 2
figure 2

Lyapunov exponent plot for proposed 3D hybrid chaos maps. a For \({{\,\textrm{C3D}\,}}\), b–d for \({{\,\textrm{GC3D}\,}}\)

A cobweb plot is a particularly effective way to visualize the dynamics. Figure 3 depicts 100 points obtained by \({{\,\textrm{C3D}\,}}\) and \({{\,\textrm{GC3D}\,}}\).

Fig. 3
figure 3

Cobweb plot for proposed 3D hybrid chaos maps. a–c For \({{\,\textrm{C3D}\,}}\), d–f for \({{\,\textrm{GC3D}\,}}\)

The bifurcation diagram in Fig. 4 illustrates the values obtained by the map for various control parameters of \({{\,\textrm{C3D}\,}}\) and \({{\,\textrm{GC3D}\,}}\). This diagram also analyzes the chaotic behavior of a nonlinear system. Also, the trajectories \((x_i,y_i,z_i)\) are plotted by setting the parameters at fixed values in Fig. 4g, h.

Fig. 4
figure 4

Bifurcation diagram for proposed 3D hybrid chaos maps s and their trajectory. a–c Bifurcation diagram for \({{\,\textrm{C3D}\,}}\), d–f bifurcation diagram for \({{\,\textrm{GC3D}\,}}\), g trajectory of \({{\,\textrm{C3D}\,}}\) under \(r=1.85\), h trajectory of \({{\,\textrm{GC3D}\,}}\) under \((r_1,r_2)=(1.05,0.65)\)

Recently, the 0–1 test is also used to determine the regular from chaotic dynamics in dynamics systems, in which the input of the test is a one-dimensional time series \(\phi (n)\) for \(n\in \mathbb {N}\). In contrast to LE, this test is applied directly to the time series data and does not require phase space reconstruction. This test equips a 2D system as follow.

$$\begin{aligned} p(n+1)&=p(n)+\phi (n+1)\cos (cn),\\ q(n+1)&=q(n)+\phi (n+1)\sin (cn), \end{aligned}$$
(3)

where \(c\in (0,2\pi )\) is fixed. The mean square displacement of this 2D system is given as follow.

$$\begin{aligned} M(n)&=\lim _{n\rightarrow \infty }\dfrac{1}{N}\sum _{j=1}^{N}\Big ([p(j+n)-p(j)]^2\\&\quad +[q(j+n)-q(j)]^2\Big ),\quad n=1,2,\ldots , \end{aligned}$$
(4)

and the growth of this 2D system is given by

$$\begin{aligned} K=\lim _{n\rightarrow \infty }\dfrac{\log \big (M(n)\big )}{\log (n)}. \end{aligned}$$
(5)

The dynamics of p(n) and q(n) are bounded when the time series \(\phi (n)\), represent regular dynamics. In this case, M(n) is bounded as well and return \(K=0\). For the chaotic time series, we have \(K=1\). As we know, the logistic map \(x_{n+1}=rx_n(1-x_n)\) is not chaos for \(r=3.55\), so to better understand, the diagram related to this mapping is also given in Fig. 5d. Figure 5 shows the difference between regular and chaotic dynamics.

Fig. 5
figure 5

Plot of p versus q for a regular dynamics logistic map at \(r=3.55\), b–d chaotic dynamics for \({{\,\textrm{GC3D}\,}}\) at \((r_1,r_2)=(3.97,1.56)\). We use 3000 data points

Plot of c versus K is given in Fig. 6.

Fig. 6
figure 6

Plot of c versus K at \((r_1,r_2)=(3.97,1.56)\), corresponding to \({{\,\textrm{GC3D}\,}}\). We use 629 data points

In Fig. 7, we see the value of K for different values of \(r_1\) and \(r_2\).

Fig. 7
figure 7

Plot of \(r_1,r_2\) versus K for \({{\,\textrm{GC3D}\,}}\) for \(0 \le r_1, r_2\le 10\). We use 10,000 data points

Implementation of the 0–1 test for chaos is described in [7, 14]. For more on chaos test, we refer to [14].

Outputs of \({{\,\textrm{GC3DV}\,}}(x_0,y_0,z_0,r_1,r_2,n,k)\) are vectors XYZ of length n which are obtained by repeating \({{\,\textrm{GC3D}\,}}\) in \(n-1\) steps and considering the first k decimal digits of outputs.

Shift functions

In this section, we introduce a shift function that operates based on vectors to shuffle pixels of images. First of all, we define some basic shift functions, and then we compose these functions to obtain the final one. In the continuation of this section \(A,B,C\in \mathbb {R}^{n\times n}\), \(V_1,V_2,V_3,V_5,V_6,V_7\in \mathbb {Z}^{1\times (2n-3)}\) and \(V_0,V_4\in \mathbb {Z}^{1\times n}\). To obtain the output matrix \({{\,\textrm{DiagSh1D}\,}}(A,V_1)\) diameters \({{\,\textrm{diag}\,}}(A,i)\) are shifted \(V_1(n-i-1)\) units, independently, where \(i=-n+2:n-2\).

for \(i=-n+2:n+2\) do

\(\quad O={{\,\textrm{circshift}\,}}\big ({{\,\textrm{diag}\,}}(A,i),V_1(n-i-1)\big )\);

\({{\,\textrm{SubDiagSh1D}\,}}\) shift function is defined similarly, this time the shift operation is performed on sub-diameters. Intending to better understand these functions, we have applied them to a four-dimensional matrix.

figure a

Now, we introduce the simple shift functions \({{\,\textrm{RowSh3D}\,}}\) and \({{\,\textrm{ColSh3D}\,}}\), which are suitable for shuffling the pixels of color images. To obtain the output

$$\begin{aligned}{}[A_1,B_1,C_1]={{\,\textrm{RowSh3D}\,}}(A,B,C,V_0), \end{aligned}$$
(6)

the i-th row of the matrix \([A,B,C]\in \mathbb {R}^{n\times (3n)}\) is shifted \(V_0(i)\) units, separately, and finally, the resulting matrix is divided into three equal parts to obtain \(A_1,B_1,C_1\in \mathbb {R}^{n\times n}\). \({{\,\textrm{ColSh3D}\,}}\) shift function is defined similarly, this time the shift operation is implemented on columns of the matrix \([A;B;C]\in \mathbb {R}^{3n\times (n)}\). It is time to open up the main shift function \({{\,\textrm{ColDiagRowSh3D}\,}}\) by using all the shift functions defined above, as follows.

\([A_1,B_1,C_1]={{\,\textrm{RowSh3D}\,}}(A,B,C,V_0)\);

\(A_2={{\,\textrm{DiagSh1D}\,}}(A_1,V_1)\);

\(B_2={{\,\textrm{DiagSh1D}\,}}(B_1,V_2)\);

\(C_2={{\,\textrm{DiagSh1D}\,}}(C_1,V_3)\);

\([A_3,B_3,C_3]={{\,\textrm{ColSh3D}\,}}(A_2,B_2,C_2,V_4)\);

\(A_4={{\,\textrm{SubDiagSh1D}\,}}(A_3,V_5)\);

\(B_4={{\,\textrm{SubDiagSh1D}\,}}(B_3,V_6)\);

\(C_4={{\,\textrm{SubDiagSh1D}\,}}(C_3,V_7)\);

Figure 8 shows the effect of this function on a color image, in which the input vectors components are between \(-200\) and 200.

Fig. 8
figure 8

Output image after applying the \({{\,\textrm{ColDiagRowSh3D}\,}}\) shift function on the input image: a input image, b output image

In order to investigate the performance of the proposed shift function and Arnold transformation, Fig. 8 is presented for the cropping attack. The Arnold transformation is defined as Function 1, and it is worth noting that the Fig. 9a is obtained after applying this transfer four times consecutively. Considering that our introduced shift function is three-dimensional, the corresponding image is considered three times as inputs of the function.

Function 1
figure b

ArnoldTransformation

Fig. 9
figure 9

Results for data loss attacks: a output image after applying ÙžArnolad transformation; b–d output images after applying the \({{\,\textrm{ColDiagRowSh3D}\,}}\); e–h cropping \(50\times 50\) pixels of images; i–l decrypted images corresponding the loss attacks

CRC as a key generator

The key space is a critical component of any encryption system, as it directly influences the level of security and ability to withstand attacks. In this section, we introduce functions named \({{\,\textrm{KS}\,}}\) and \({{\,\textrm{KS3D}\,}}\) to create a strong key space generator for the proposed algorithm. These functions are defined based on \({{\,\textrm{GC3D}\,}}\) hybrid chaos map and CRC error detection method. In CRC error-detecting code, some bits are appended to blocks of data based on the remainder of a polynomial division of their contents. The algorithm is based on cyclic codes, and CRCs are easy to implement and to analyze mathematically. In practice, all commonly used CRCs employ the finite field of two elements, simply. A CRC is called an n-bit CRC (CRC-n) when its check value is n bits long.

The values of our key space, in addition to the initial input, also depend on secret images and the execution of the program. In a way, different outputs are obtained either by changing the secret image or by running algorithms for intended image. First, we introduce \({{\,\textrm{KS}\,}}\) function, whose inputs are grayscale image \(J\in \mathbb {R}^{n\times m}\) and control parameter \(r_1\in \mathbb {R}\), and its output is a number that is made during the following steps. As it can be seen, in the process of defining this function, \({{\,\textrm{CRC}\,}}\) has been used \(n+1\) times with different divisors, in which data blocks are initially binary formats of secret image rows and divisors are rows of binary matrix resulting from \({{\,\textrm{GC3D}\,}}\) (see Fig. 10). The first two steps are related to the construction of vector \(V\in \mathbb {R}^{n\times 1}\) based on generalized 3D modular hybrid chaos map \({{\,\textrm{GC3D}\,}}\).

Fig. 10
figure 10

Key generation for grayscale image

  1. Step 1.

    Random selection of three numbers named \(x_0, y_0, z_0\) from pixels \({{\,\textrm{double}\,}}(J)\).

  2. Step 2.

    Random production of the control parameter \(r_2\).

  3. Step 3.

    Constructing vectors \(V_1\) and \(V_2\) by applying \({{\,\textrm{GC3D}\,}}\).

    \([X_1,Y_1,Z_1]={{\,\textrm{GC3DV}\,}}(x_0,y_0,z_0,r_1,r_2,n,2)\);

    \([X_2,Y_2,Z_2]={{\,\textrm{GC3DV}\,}}(2x_0,2y_0,2z_0,2r_1,2r_2,8m,2)\);

    \(V_1={{\,\textrm{floor}\,}}\big ({{\,\textrm{mean}\,}}(X1,Y1,Z1)\big )\);

    \(V_2={{\,\textrm{floor}\,}}\big ({{\,\textrm{mean}\,}}(X2,Y2,Z2)\big )\);

  4. Step 4.

    Convert J to the binary format \(J_B\in \mathbb {R}^{n\times 8m}\).

  5. Step 5.

    Shuffling the rows and columns of \(J_B\) based on \(V_1\) and \(V_2\), respectively, to get \(J_{BS}\).

  6. Step 6.

    Converting \(J_{SB}\) to matrix \(J_S\in \mathbb {R}^{n\times m}\) with integer array.

  7. Step 7.

    Reducing the size of \(J_S\) to one-ninth of its size by using the \({{\,\textrm{DFT2}\,}}\) function.

    \(J_{SF}=\left( {{\,\textrm{DFT2}\,}}(J_S)\right) \left( 1:\frac{n}{3},1:\frac{n}{3}\right)\);

  8. Step 8.

    Converting \(J_{SF}\) and \(V_1\) to binary matrices and showing by \(J_{SFB}\) and \(V_{1B}\), respectively.

  9. Step 9.

    Finding the CRC for the data blocks \(J_{SFB}(i,:)\) with the divisors

    $$\begin{aligned} x^9+\sum _{j=1}^8V_{1B}(i,j)x^{9-j}+1, \end{aligned}$$

    to make a cell matrix with binary cells \(C_1\in (\mathbb {R}^{1\times 9})^{n\times 1}\) for \(i=1,2,\ldots ,n\).

    for \(i=1:n\) do

       \(C_1(i,:)={{\,\textrm{CRC}\,}}\big (J_{SFB}(i,:),x^9+\sum _{j=1}^8V_{1B}(i,j)x^{9-j}+1\big )\);

  10. Step 10.

    Deforming \(C_1\) to binary vector \(C_1V\in \mathbb {R}^{1\times 9n}\).

  11. Step 11.

    Random selection of one row of \(V_{1B}\) named l and finding \(C_2\in \mathbb {R}^{1\times 8}\) as follows.

    \(C_2={{\,\textrm{CRC}\,}}\big (C_1V,x^8+\sum _{j=1}^7V_{1B}(l,j+1)x^{9-j}+1\big )\);

  12. Step 12.

    Converting \(C_2\) to integer array.

For secret color image \(I\in \mathbb {R}^{n\times m\times 3}\) with channels R,G and B, we define \({{\,\textrm{KS3D}\,}}\) function with four inputs \(I,r_1,r_2,r_3\) and three outputs as follow.

\(\quad {\textit{out}}1={{\,\textrm{KS}\,}}(R,r1)\);

\(\quad {\textit{out}}2={{\,\textrm{KS}\,}}(G,r2)\);

\(\quad {\textit{out}}3={{\,\textrm{KS}\,}}(B,r3)\);

Results of \({{\,\textrm{KS}\,}}\) for various inputs are given in Table 1. To show the output sensitivity of \({{\,\textrm{KS}\,}}\) to small change in secret image J, we keep all the parameters that are generated randomly in the key generation process as

$$\begin{aligned} (x_0,y_0,z_0,r_2,l)=\Big ({{\,\textrm{double}\,}}(J)(2,2),{{\,\textrm{double}\,}}(J)(3,3),{{\,\textrm{double}\,}}(J)(4,4),4,50\Big ), \end{aligned}$$

and then add one unit to one of the pixels of J. The results are shown in Table 2.

Table 1 Key space generated by the \({{\,\textrm{KS}\,}}\) for various images and running
Table 2 Key space sensitivity for various images

Cellular automata

Cellular automata (CA) is a discrete dynamical systems consisting of multiple cells, each with a finite number of states, such as on/off or white/black. These cells are arranged in networks by placing them adjacent to one another. Reversible and irreversible are two main categories of cellular automata. In reversible cellular automata (RCA), every configuration of it has only one preceding configuration, and therefore, its evolutionary process can be traced back uniquely. The second-order cellular automata method is also a type of \({{\,\textrm{RCA}\,}}\), where the new state is obtained by combining states from two previous steps of the automata. In simpler terms, to determine the state at time \(t+2\) in a one-dimensional reversible cellular automaton, we combine the current state at time t with the next moment at time \(t+1\). This process involves eight positions in a one-dimensional CA and duplex positions in a one-dimensional \({{\,\textrm{RCA}\,}}\), as illustrated in Fig. 11.

Fig. 11
figure 11

Reversible cellular automata under Rule 87

In this figure, the top row shows the current state at t, the middle row represents neighborhoods of state \(t+1\), and the bottom row displays the rule used to adjust the state at time \(t + 2\) based on the previous two states. In the presented algorithm, we define the \({{\,\textrm{RCA}\,}}\) function with inputs of a matrix \(M\in \mathbb {Z}_{256}^{m\times n}\) and two numbers (ab) in the range [0, 255]. We use \({{\,\textrm{RCA}\,}}\) to cipher the matrix M, which is detailed in Function 2. The resulting ciphered matrix is returned as \(M_{en}={{\,\textrm{RCA}\,}}\big (M, a, b\big )\in \mathbb {Z}^{m\times n}_{256}\). In \({{\,\textrm{RCA}\,}}\), transforming the matrix into a vector is based on the approach outlined in article [15], as illustrated in Fig. 12. The two numbers are added to the first of the vector. The first number serving as the neighborhood and the second number serving as the rule for encrypting the next number. Then, with the second number now serving as the neighborhood and the previously encrypted number serving as the rule for encrypting the next number. The process continues in the same manner until the entire vector has been encrypted. Figure 13 illustrates an example of a two-by-two matrix that has been encrypted using \({{\,\textrm{RCA}\,}}\). Additionally, Fig. 14 shows the output obtained by applying the Function 2 with inputs a gray square image of size 512 and numbers (50, 165).

Fig. 12
figure 12

Matrix to vector conversion path

figure c

Function 2

Fig. 13
figure 13

Illustration of \({{\,\textrm{RCA}\,}}\) step by step

Fig. 14
figure 14

\({{\,\textrm{RCA}\,}}\) results: a plain image, b ciphered image (a), c histogram of plain image, d histogram of ciphered image

Proposed image encryption model

In this section, we leave the detailed steps of the proposed encryption algorithm.

  1. Step 1

    . A color image I of size \(n\times n\) is divided into three color matrices as

    $$\begin{aligned}{}[I^r,I^g,I^b]={{\,\textrm{DivideColors}\,}}(I) \end{aligned}$$
  2. Step 2

    . We define \(X^r, X^g\) and \(X^b\) vectors based on the proposed chaotic map as:

    $$\begin{aligned}{}[X^r, X^g, X^b]={{\,\textrm{GC3D}\,}}({\textit{out}}1, {\textit{out}}2, {\textit{out}}3, r_1, r_2, N^2+N), \end{aligned}$$
    (7)

    where \({\textit{out}}1, {\textit{out}}2\) and \({\textit{out}}3\) were obtained from \({{\,\textrm{KS}\,}}\) function (Sect. 4). Since all the ranges of \(X^r, X^g\) and \(X^b\) are [0, 1], set

    $$\begin{aligned} X^r={{\,\textrm{floor}\,}}(10^3.X^r),\quad X^g={{\,\textrm{floor}\,}}(10^3.X^g), \quad X^b={{\,\textrm{floor}\,}}( 10^3.X^b). \end{aligned}$$
  3. Step 3

    . In this step, the shift function \({{\,\textrm{ColDiagRowSh3D}\,}}\) (see Sect. 3) is called by quantifying eight vectors \(V_1,V_2,V_3,V_5,V_6,V_7\in \mathbb {Z}^{1\times (2n-3)}\) and \(V_0,V_4\in \mathbb {Z}^{1\times n}\) from the set vectors (6.1). And then, pixels of the image are scrambled as follows:

    $$\begin{aligned}{}[ I^r_1,I^g_1,I^b_1] ={{\,\textrm{ColDiagRowSh3D}\,}}( I^r,I^g,I^b,V_0,V_1,V_2,V_3,V_4,V_5,V_6,V_7). \end{aligned}$$
  4. Step 4

    . Here, we use reversible cellular automata (\({{\,\textrm{RCA}\,}}\)) introduced in Sect. 5 to have more confuse and diffuse. The function \({{\,\textrm{RCA}\,}}\) is called as

    $$\begin{aligned} I^k_2 = {{\,\textrm{RCA}\,}}(I^k_1,a_k, b_k ), \quad k=r,g,b, \end{aligned}$$

    where \(a_k,b_k\) are in \(\mathbb {Z}_{256}^{2}\) and obtained from the new chaotic map.

  5. Step 5

    . The sequences \(X^k,\, k=r,g,b\) is used as the original row of the circulant matrix \(M^k,\, k=r,g,b\) as follows:

    $$\begin{aligned} M^k(1,1:N)=X^k(1:N), \quad k=r,g,b. \end{aligned}$$

    To have low relevance among the column vectors, we construct the rest of matrix in this way:

    $$\begin{aligned}{} & {} M^k(i,1:N)={{\,\textrm{circshift}\,}}\left( M^k(i-1,:), [ 0,(-1)^i.X^{k+}(i)] \right) ,\\{} & {} M^k(i,1)=X^{k-}(i) \cdot M^k(i,1), \quad 2\le i\le N, \quad k=r, g,b, \end{aligned}$$

    where \(k+\) stands for the next value of K, depending on the value of k and \(k-\) is the previous one, for example if \(k=g\), b is allocated for \(k+\) and \(k-=r\).

  6. Step 6

    . Then, XOR operation is carried out to get the final encrypted image:

    $$\begin{aligned} I^k_{enc}=A^k_2\oplus M^k, \quad k=r,g,b. \end{aligned}$$

Performance and security analysis

Experiments have been conducted in this section to evaluate the performance and security of the proposed algorithm. The total time of the encryption algorithm for RGB images \(256\times 256\) is about 48 s. The results pertaining to different properties of this algorithm have been compared with those of other studies, and the corresponding figures and tables are presented below. The new model is applied to some color images and simulation results are shown in Fig. 15. In this figure, the first columns are the plain images, the second columns are their cipher images and the third columns are their decrypted images. As it can be seen from this figure, the decrypted images are the same with the plain images which display security and effectiveness of the algorithm.

Fig. 15
figure 15

Encrypted and decrypted images using the proposed algorithm

Histogram analysis

To show the proposed algorithm’s resistance against statistical attacks, we use the histogram plot of the encrypted images, which shows frequency distributions of encryption systems. Figure 16 shows that the histogram plot is flat and uniform, thus the proposed scheme is significantly secure.

Fig. 16
figure 16

Original images and encryption results and their histograms in the red, green and blue components

Information entropy analysis

Information entropy is a measure of the amount of uncertainty or randomness in a system. The entropy value for an ideally encrypted gray level image is very close to 8. In other words, any encrypted image having this value has been more randomly distributed. We conducted experiments to compare the entropy values of the proposed algorithm with those of recent encryption algorithms in Table 3. This table demonstrates that the information entropy value of encrypted images is almost 8, indicating that the proposed algorithm has minimal information loss and is highly secure against entropy attacks.

Table 3 Information entropy values using the proposed and different encryption methods
Table 4 Average NPCR and UACI values for Lena \((256\times 256\times 3)\)

Differential attacks

The Number of Pixels Change Rate (NPCR) and the Unified Average Changing Intensity (UACI) are using to measure the resistance of an encrypted image against differential attacks. Ideally these values are close to 100 and 33.33%, respectively, that show the highly sensitivity of an algorithm to ever minor changes in plain images. To test the proposed algorithm, the obtained results for NPCR and UACI have been compared with different algorithms in Table 4.

Table 5 Comparison of correlation coefficients for color images using the proposed and [16] algorithms

Statistical analysis

In order to gain an efficient encryption algorithm, the pixel correlations should be eliminated in the plain image and the encrypted image should have sufficiently low correlations close to 0. We have compared and tabulated the results of the proposed algorithm with those of [16] in Table 5.

Noise and crop attack analysis

A robust and effective encryption algorithm should be resist against data loss attacks in various types, namely noise, crop attacks and so on. Figures 18 and 19 demonstrate the ability of the new scheme. Figure 18 displays results of the decrypted images after cropping attacks, and Fig. 19 shows the decrypted images after contaminating cipher images by salt-and-pepper noise with different noise densities. We have compared and presented results of the proposed algorithm alongside existing methods in Fig. 17 which shows that the proposed algorithm possesses good performance against the noise and crop attacks.

Fig. 17
figure 17

Crop attack results: a cipher image with 1/8 data loss, d cipher image with 1/2 data loss; b decrypted by Ref. [23]; e decrypted by Ref. [16]; c, f decrypted by the proposed algorithm

Fig. 18
figure 18

Results for data loss attacks: a encrypted image splash; b cropping \(300\times 300\times 3\) pixels of image; c data loss attacks by fractal graphs; d data loss attacks by color logo images(\(300\times 300\times 3\)); e–h decrypted images corresponding the loss attacks; i data loss attacks by fractal graphs; j cropping \(3\times (150\times 150\times 3)\) pixels of image; k data loss attacks by fractal graphs; l data loss attacks by color logo images(\(150\times 150\times 3\)); m–p decrypted images corresponding the loss attacks

Fig. 19
figure 19

Results for noise attacks: a noisy image by salt and pepper with density = 0.001; b noisy image by salt and pepper with density = 0.01; c noisy image by salt and pepper with density = 0.1; d decrypted image of (a); e decrypted image of (b); f decrypted image of (c)

Conclusion

This paper presents a pioneering approach to image encryption, applying a novel 3D modular hybrid chaotic map governed by two control parameters. The system comprises four components:

  • A novel chaotic system: We introduce high-dimensional chaotic maps with dual control parameters to expand the chaotic space, enhancing security.

  • A shift operator: We present a shift operator to rearrange image pixels, effectively reducing correlations between adjacent pixels.

  • A key space: Our method establishes a robust key space derived from the proposed chaos map and CRC error detection technique, ensuring enhanced security.

  • Cellular automata integration: We incorporate cellular automata to optimize the efficiency of the image encryption process, further enhancing its effectiveness.