1 Introduction

In recent years, with the fast exchange and transmission of digital images over the internet, researchers have focused on the image encryption [1]. Chaotic systems have been widely used in the image encryption algorithms [222]. Chaotic systems have many particular properties, such ergodicity, sensitivity to initial conditions and to control parameters and randomness [23]. These properties are very important in cryptography. Recently, a variety of chaotic cryptosystem for gray-scale image have been proposed [213]. However, a few researches have focused on color image [1422].

In [15], a novel color image encryption algorithm based on chaos was proposed. The authors used a chaotic system to encrypt the R, G, B components of a color image at the same time and make these three components affect one other. Therefore, the correlations between the R, G, B components can be reduced and the security of algorithm is increased. Wang et al. [16] introduced a new image encryption algorithm based on iterating the chaotic maps. Using the pseudorandom sequence generated by a group of one-dimensional chaotic maps, the proposed algorithm realizes fast encryption and decryption of both a gray-scale image and a true color image. Moreover, the rounds of encryption could be set by the user. In [19] the authors designed a stream-cipher algorithm based on one-time keys and robust chaotic maps, in order to get high security and improve the dynamical degradation. We utilized the piecewise linear chaotic map as the generator of a pseudo-random key stream sequence. The initial conditions were generated by the true random number of generators and the MD5 of the mouse positions. We applied the algorithm to encrypt the color image. In [20], Benjeddou et al. proposed a new color image encryption technique using two multidimensional chaotic maps: a three dimensional chaotic map for the key expansion and a two dimensional chaotic map for the generation of two chaotic Look-Up Tables.

The rest of this paper is organized as follows. Section 2 describes the cryptosystem for color image. Section 3 presents the simulation and the experimental results to prove the performance of encryption algorithm. Finally, Sect. 4 concludes the paper.

2 Color Image Encryption Scheme Based on Chaos

We convert every image I with size (M \(\times \) N) in 24-bit true color into its 3 components (R, G and B). The size of each color’s (R, G or B) matrix is (M \(\times \) N) and contains integers between 0 and 255, then each matrix will be encrypted. In this paper, we use the Logistic Map as the chaotic system which is widely used in chaotic cryptosystem for its simplicity and high sensitivity to initial conditions. It is defined by:

$$\begin{aligned} X_{n + 1} = \mu {\text { X}}_{\text {n}} {\text { }}(1 - X_n) \end{aligned}$$
(1)

where \(\mu \) is a control parameter, \(X_n\) is a real number in the range [0, 1] and \(X_0\) is an initial condition. When \(3.569955672 < \mu \le 4\), the system becomes chaotic [24].

In the rest of this section we provide the process of encryption algorithm.

  • Step 1. The RGB color image I with size (M \(\times \) N) is divided into three separate images \(I_{R}\), \(I_{G}\) and \(I_{B}\) (i.e., every image represents one of the three color components (red, green and blue)) as follows:

    $$\begin{aligned} \begin{aligned}&{\text { }}I_R (x,y) = I(x,y,1);{\text { }}I_G (x,y) = I(x,y,2); \\&\qquad \qquad \quad I_B (x,y) = I(x,y,3) \\&\qquad where{\text { }}1 \le x \le M{\text { }}and{\text { }}1 \le y \le N \\ \end{aligned} \end{aligned}$$
    (2)
  • Step 2. Firstly, we generate a chaotic matrix using the Logistic Map function \(LM_{1}\) with the parameters (\(x_{0XOR}\) and \(\mu _{0XOR}\)). We mix the obtained chaotic matrix with the original image (\(I_{R}\), \(I_{G}\) or \(I_{B}\)) using the logical function XOR \(\oplus \) to obtain the initial encrypted image \(I_{1}\) (Fig. 1(a)).

    Then, for each pixel \(P_{1}\) from \(I_{1}\), we generate a chaotic LUT using the second Logistic Map function (\(LM_{2}\)) having as parameters (\(x_{0}(P_{c})\) and \(\mu _{0}\)). Where \(P_{c}\) is the value of the previous encrypted pixel by our cryptosystem. The initial condition \(x_{0}(P_{c})\) depends on the previous value of the ciphered pixel and \(x_{0}\) with \(x_{0}(P_{c})\) \(\in \) [0.1, 0.9] (Fig. 1(b)).

    Finally, we apply the New LUT to \(P_{i}\) to obtain the final encrypted pixel. We repeat this process for each pixel from the initial encrypted image to get the final encrypted one (Fig. 1(c)).

  • Step 3. We apply the steps in Step 2 for each component (R, G and B) of the original image I. We obtain three encrypted images (\(I_{CR}\) is the encrypted image of \(I_{R}\), \(I_{CG}\) is the encrypted image of \(I_{G}\) and \(I_{CB}\) is the encrypted image of \(I_{B}\)).

  • Step 4. Grouping the three encrypted images (\(I_{CR}\), \(I_{CG}\) and \(I_{CB}\)) in order to have the encrypted image \(I_{C}\).

Fig. 1.
figure 1

Architecture of the proposed method: (a) XOR Chaotic encryption (b), Chaotic Dynamic Look-Up Table (c), Chaotic Look-Up Table encryption.

The decryption procedure is identical to that of the encryption algorithm except that the order is reversed.

3 Experimental Results

An image cryptosystem should be robust against all types of attacks (cryptanalytic and statistical attacks). In what follows, we present the different results obtained by statistical analysis of our cryptosystem [25]. These experiments include key space analysis, sensitivity analysis, histogram analysis of the original and the encrypted images, information entropy analysis, correlation coefficient analysis and differential analysis. The Lena color image of size (256 \(\times \) 256) is opted for encryption. Figure 2(a) shows the color original image. Figure 2(b)–(d) show the R, G, B components of the original image. The encrypted image and its R, G, B components are shown in Fig. 3(a)–(d).

Fig. 2.
figure 2

Original color image and its R, G, B components: (a) Original image, (b) R component of the original image, (c) G component of the original image, (d) B component of the original image.

Fig. 3.
figure 3

Encrypted image and its R, G, B components: (a) Encrypted image, (b) R component of the encrypted image, (c) G component of the encrypted image, (d) B component of the encrypted image.

3.1 Key Space Analysis

A good encryption algorithm should not only be sensitive to the secret key, but also the key space should be large enough to make brute-force attacks infeasible. In this cryptosystem, the initial conditions and parameters {\(x_{0}\), \(\mu _{0}\), \(x_{0XOR}\), \(\mu _{0XOR}\)} can be used as key. In our simulations we use MATLAB 8.3. This mathematical tool codes real in 8 bytes. Therefore, all the parameters are presented in 64 bits. Then, for each component of the color image we have {\(2^{64}\) \(\times \) \(2^{64}\) \(\times \) \(2^{64}\) \(\times \) \(2^{64}\)} = \(2^{256}\) combinations. Our secret key has \(2^{256}\) different combinations.

3.2 Sensitivity Analysis

  1. 1.

    Key Sensitivity Analysis in the Encryption Phase

    Figure 4(a) shows the original Lena image. Figure 4(b) shows the encrypted image of Lena with the correct encryption key \(k_{0}\) = {0.25, 3.8701, 0.4, 3.9}. We change key \(k_{0}\) by adding \(10^{-15}\) for real \(x_{0}\), then, the difference between the two corresponding encrypted images is calculated. The encrypted Lena image with key \(k_{1}\) = {0.250000000000001, 3.8701, 0.4, 3.9} is shown in Fig. 4(c). Figure 4(d) is a plot of the difference between the two encrypted images.

  2. 2.

    Key Sensitivity Analysis in the Decryption Phase

    In addition, decryption using key with slight change above is also performed so as to evaluate the key sensitivity. The original image is encrypted with the original key \(k_{0}\) = {0.25, 3.8701, 0.4, 3.9}, and the encrypted image is obtained, it shown in Fig. 5(b). The original key is modified slightly (order of \(10^{-15}\) for real \(x_{0}\)). The encrypted image obtained by key \(k_{0}\) is decrypted with the modified key \(k_{1}\) = {0.250000000000001, 3.8701, 0.4, 3.9}. The results are plotted in Fig. 5. Figure 5(d) shows that the reconstructed image is noisy even when the key has only a tiny modification.

    Therefore, it can be concluded that the proposed algorithm is sensitive to the key, a small change of the key will generate a completely different decryption result and cannot get the correct original image.

Fig. 4.
figure 4

Key sensitivity analysis in encryption phase: (a) Original image of Lena, (b) Encrypted image with key \(k_{0}\), (c) Encrypted image with key \(k_{1}\), (d) Difference between (b) and (c).

Fig. 5.
figure 5

Key sensitivity analysis in decryption phase: (a) Original image of Lena, (b) Encrypted image with key \(k_{0}\), (c) Decrypted image with key \(k_{0}\), (d) Decrypted image with key \(k_{1}\).

3.3 Histogram Analysis

The histograms of the original and the encrypted image are shown in Figs. 6 and 7. Referring to the obtained results, we can see that histogram of the encrypted image Fig. 7(a)–(c) is fairly uniform and is significantly different from that of the original image.

Fig. 6.
figure 6

Histogram of the original image R, G, B components: (a) Histogram of R component, (b) Histogram of G component, (c) Histogram of B component.

Fig. 7.
figure 7

Histogram of the encrypted image R, G, B components: (a) Histogram of R component, (b) Histogram of G component, (c) Histogram of B component.

3.4 Information Entropy Analysis

The entropy, which was proposed by Shannon in 1948 [26], is defined as:

$$\begin{aligned} H(m) = - \sum \limits _i^{2^M - 1} {P(m_i){\text { }}\mathop {\log }\nolimits _2 } P(m_i) \end{aligned}$$
(3)

Here, \(P(m_{i})\) represents the probability of symbol \(m_{i}\). The entropy H(m) is expressed in bits.

For a purely random source emitting \(2^{M}\) symbols, the entropy is H(m) = M.

Table 1 shows the entropy of the three color components R, G and B. The values obtained are very close to the theoretical value H(m) = 8 bits/pixel. From this result, it is clear that our encryption image scheme is robust against the entropy attack.

Table 1. Results of information entropy.

3.5 Correlation Between Neighboring Pixels

It is well known that adjacent image pixels are highly correlated in the original image. In order to resist a statistical attack, we must decrease the correlation of two adjacent pixels in the encrypted image [27]. We calculate the correlation for a sequence of adjacent pixels using the following formula:

$$\begin{aligned} r_{xy} = \frac{{\text {cov} (x,y)}}{{\sqrt{D(x)} \sqrt{D(y)} }} \end{aligned}$$
(4)

Here, x and y are the intensity values of two adjacent pixels in the image. \(r_{xy}\) is the correlation coefficient. The cov(x,y), E(x) and D(x) are given as follows:

$$\begin{aligned} E(x) = \frac{1}{N}\sum \limits _{i = 1}^N {x_i } \end{aligned}$$
(5)
$$\begin{aligned} D(x) = \frac{1}{N}\sum \limits _{i = 1}^N {[x_i - E(x_i )]} \end{aligned}$$
(6)
$$\begin{aligned} \text {cov} (x,y) = \frac{1}{N}\sum \limits _{i = 1}^N {[(x_i - E(x_i ))(y_i - E(y_i ))]} \end{aligned}$$
(7)

N is the number of adjacent pixels selected from the image to calculate the correlation.

To calculate the correlation coefficient, we have randomly chosen 2500 pairs of two adjacent pixels from the original image and the encrypted image.

It’s clear from Fig. 8 and Tables 2 and 3 that the correlation between two adjacent pixels for the encrypted Lena image is much smaller than that of the original image. This little correlation between two neighboring pixels in the encrypted image makes the brook of our cryptosystem difficult.

Table 2. Correlation coefficients of two adjacent pixels in the original image.
Table 3. Correlation coefficients of two adjacent pixels in the encrypted image.
Fig. 8.
figure 8

Correlation of diagonal adjacent two pixels: (a) R component of the original image, (b) R component of the encrypted image.

3.6 Differential Analysis

The objective of this analysis is to prove that a small change in the original image introduces a major change to the encrypted image. This difference can be measured by means of two criteria namely, the number of pixel change rate (NPCR) and the unified average changing intensity (UACI). The theoretical values for an ideal cryptosystem are close to 100 % to the value of NPCR while the value of UACI must be very close to 33 %.

Let \(I_{2}\) be the changed original image on one pixel. \(C_{1}\) and \(C_{2}\) are the ciphered images of the original images I and \(I_{2}\). D is a matrix having the same size as the image figures \(C_{1}\) and \(C_{2}\). D(i,j) is determined as follows:

$$\begin{aligned} D(i,j) = \left\{ \begin{aligned}&1{\text { }}if{\text { }}C_1 (i,j) \ne C_2 (i,j) \\&0{\text { }}else \\ \end{aligned} \right. \end{aligned}$$
(8)

The NPCR is defined by:

$$\begin{aligned} NPCR = \frac{{\sum \limits _{i = 0}^{M - 1} {{\text { }}\sum \limits _{j = 0}^{N - 1} {{\text { }}D(i,j)} } }}{{M \times N}} \times 100 \end{aligned}$$
(9)

M and N are the height and width of encrypted images \(C_{1}\) and \(C_{2}\).

The UACI is defined by:

$$\begin{aligned} UACI = \frac{1}{{M \times N}}\sum \limits _{i = 0}^{M - 1} {{\text { }}\sum \limits _{j = 0}^{N - 1} {{\text { }}\frac{{\left| {C_1 (i,j) - C_2 (i,j)} \right| }}{{255}}} } \times 100 \end{aligned}$$
(10)

Two images are used in the tests. The first image is the original image, and the other is obtained by changing the first pixel value of R component from ‘224’ to ‘225’. Then the two images are encrypted with the same key \(k_0\) to generate the corresponding encrypted images \(C_{1}\) and \(C_{2}\).

The results obtained are NPCR = 99.6140 % and UACI = 33.5448 %. The results show that a small change in the plain image introduces a high alteration on the encrypted one. Hence, the proposed cryptosystem is robust against the differential attacks.

4 Conclusion

In this paper, we introduced a new color image encryption algorithm based on chaotic systems called Look-Up Table. This new cryptosystem uses the “Logistic Map” function to generate a dynamic LUT. The performance of this LUT is introduced to the cryptosystem feedback because this LUT depends on the encrypted previous pixel.

Simulation results demonstrate that satisfactory performance (sensitivity and security) is achievable in our proposed cryptosystem. The results show that the cryptosystem can encrypt the color image effectively.