1 Introduction

With the advent of the information age, multi-media technology has been developing rapidly. People are enjoying the convenience of technology while accessing information on the Internet. However, frequent data breaches have also brought problems in people’s lives. For example, in September 2017, Equifax, one of the largest credit reporting agencies in the United States, was subject to unauthorized access, and the information of approximate 143 million consumers have been leaked; in February 2016, $81 million of the Central Bank of Bangladesh was stolen and $31 million of the central bank of Russian was stolen. And excessive data collection can also cause the personal information to be leaked [14]. In order to create a comfortable, healthy and safe social environment, it is necessary to encrypt the transmitted images.

In the early days, people designed encryption methods such as DES, RSA and AES to encrypt textual data. However, these conventional cipher algorithms are not suitable for the multimedia data with a high correlation between adjacent pixels and a large data capacity, more and more new technologies have been being proposed. Martin et al. [18] introduced a method to achieve the compression and partial encryption by selecting the significance bits for each wavelet coefficient and combining Color-SPIHT(C-SPIHT) compression. Kanso and Ghebleh [11] proposed a lossless visually meaningful image encryption scheme using existing cipher images as watermarks to embed wavelet coefficients to make the encrypted content more difficult to detect. Mahesh et al. [17] presented an encryption algorithm based on Arnold Cat Map and discrete Haar wavelet transform. In addition to combining wavelet transforms, DNA coding is also a common technique[1, 25]. Kumar et al. [12] introduced an algorithm of the color image encryption. In this algorithm, each component of the color image was encoded by doing deoxyribonucleic acid (DNA) sequence operations and symmetric encryption based on elliptic curve cryptography. Chai et al. [4] introduced a scheme of the image encryption based on chaotic system and DNA encoding. Zhang et al. [34] presented a new algorithm, which was mainly based on the spatiotemporal chaos of the Mixed Linear-Nonlinear Coupled Map Lattices (MLNCML). This algorithm not only can enhance the sensitivity to the plain image, but also can resist different attacks by employing the strategy of DNA computing and one time pad encryption policy. In 1989, the chaos-based encryption thought was proposed by the British mathematician Matthews. After that, the application of chaos theory has been being paid more and more attention. Chaos technology [2, 3, 8, 13, 24] has become a common technique in the field of image encryption due to its inherent characteristics. Logistic maps [10, 30], Arnold transformation [37], 3-D Cat maps [6], and Henon maps [5, 21, 27] are representative chaotic map techniques.

Although the technology of image encryption has become more and more sophisticated in recent years [19, 31, 32], chaos encryption algorithms for color images still have some shortcomings. Kadir et al. [9] used a coupled hyper chaotic Lorenz systems to encrypt color images, but the encryption algorithm was simple. Liu et al. [16] introduced a stream-cipher scheme, which was a combination of a one-time key and robust chaotic maps. Through scrambling and diffusion processes, it can achieve high security and dynamic degradation. The correlation between adjacent pixels was not well eliminated because the pixel disruption is not thorough enough.

In order to improve the encryption performance of the color images, we combine the CRC and the nine palace map. With the help of the principle of the nine palace map, the pixels of the plain image are initially scrambled. The attackers need to know not only the rules of the initial transformation, but also which one of them is scrambled. It can improve the security of encryption. The CRC generation mechanism is used to generate the chaotic key in the cyclic shift phase, and the pixel values are completely disorganized at the bit-level. The results of the experiments show that the algorithm has superior high security property and can resist different attacks. However, the simple encryption algorithms will eliminate spatial redundancy as much as possible, if the encrypted images need to be compressed then stored, it will inevitably affect the compression ratio, and the image quality will be affected. At the same time, because lossy compression of images such as JPEG format will selectively lose a portion of the data, the algorithm proposed in this paper is mainly performed at the bit-level, and slightly changing the bit values will make the compressed image difficult to recover. Therefore, the images in lossless compressed or uncompressed fit the algorithm studied in this paper.

In recent years, researchers have been actively looking for new applications for encryption [38, 40, 41]. One of the methods is to introduce the encryption technology into cloud storage, which can solve the problem of privacy leakage caused by daily sharing of social photos. For example, Sosa et al. [26] designed the Privacy-enhancing Image-based Collaborative File System and proved its practicality in the real world.

This paper is organized as follows: Section 2 introduces theoretical analysis; Section 3 introduces the proposed algorithm in detail; Section 4 shows a variety of simulation results; In Section 5, we make a summary of our work.

2 Theoretical analysis

2.1 Nine palace map system

The Nine palace map, named the rearrangement of the Nine Palaces, is a digital game. The rule of the which is to put 1~9 numbers into a 3 × 3 grid so that the sums of the numbers in each row, each column and either diagonal should be 15.

In the encryption algorithm mentioned in this paper, the principle of nine palace map is applied to the initial scrambling of image pixels. Each component of RGB images can be evenly divided into 9 blocks numbered 1 to 9, as shown in Fig. 1 (a). According to the layout of the nine palace map, the blocks in Fig. 1(a) are re-disrupted in a certain order to form a new map as shown in (c): the numbered block 1 is placed in the block 2 of (b); the numbered block 2 is placed in the block 9 of (b); numbered block 3 is placed in block 4 of (b); numbered block 4 is placed in block 7 of (b); numbered block 6 is placed in block 3 of (b); numbered block 7 is placed in block 6 of (b); numbered block 8 is placed in block 1 of (b); numbered block 9 is placed in block 8 of (b). When all nine blocks in (a) are rearranged, the nine palace map is completed as shown in (c). Since the position of the numbered block 5 has not changed, the block 5 is transposed in the original position to change the position of pixel data. To make the pixels scrambled in their entirety, each channel of the plain image follow placement rules above to achieve the scrambling of the initial position of the pixels.

Fig. 1
figure 1

Nine palace map scrambling

2.2 Logistic map

1D Logistic map, widely used in image encryption, is the simplest nonlinear chaotic system, which can be expressed by

$$ {\mathbf{x}}_{i+1}=\mu {\mathbf{x}}_i\left(1-{\mathbf{x}}_i\right) $$
(1)

Where x0 defines the initial value of the condition,parameterμdenotes the control coefficient of the system, subscript idenotes the number of iterations of the system. Whenμ ∈ (3.57, 4), the system is in chaos, xi + 1 ∈ (0, 1).

2.3 Cyclic redundancy check (CRC)

CRC is the cyclic redundancy check, which is the most commonly used method of checking errors in the communication field. It can perform polynomial calculation on data and attach the obtained result to the back of the frame. The entire process ensures the correctness and completeness of the data transmission.

When this encoding is used, the sender and the receiver must agree in advance to create a multi-pattern whose first and last bits must be ‘1’ at the same time. Any code consisting of a series of binary bits can correspond to multiple styles where the coefficients only take values of ‘0’ and ‘1’. Table 1 lists several CRC versions of commonly used international standards.

Table 1 CRC polynomial of commonly used international standards

The definition is as follows:

$$ \frac{C(x)\times {2}^r}{G(x)}={R}_0(x)+X(x) $$
(2)
$$ CRCcode=\mathrm{C}(x)\times {2}^r+{R}_0(x) $$
(3)

WhereX(x)is quotient. Suppose the information to be transmitted is represented by polynomialC(x), and C(x) is shifted to the left by rbit (can be expressed asC(x) × 2r). Then, r bit is vacated on the right side ofC(x), which is the position of the check code. The modulo 2 division (high-alignment) of C(x) × 2ris performed using the binary number F(x)of the generator polynomial, and the remainder, the redundant bit R0(x), is the check code. For example, the sent information polynomial C(x)is ‘1010001’, the binary numberF(x) corresponding to the polynomial G(x)is ‘10111’. Move C(x) to the left by rbit (the number of bits in F(x)is reduced by 1) to get ‘10100010000’, and then the binary number is used to divide the moved information polynomial, which is equivalent to XOR, and the remainder R0(x) is ‘1101’. Finally, R0(x)will be placed in the position where the information code C(x) is moved, and the complete CRC code can be obtained.

3 Image encryption algorithm

The process of the encryption algorithm is shown in Fig. 2. Each specific process is described as follows.

  1. Step 1:

    Import the plain RGB image P(M × N × 3), whereMandNare the size of row and column. Each component of the RGB is placed based on the same rule of the nine palace map as described in Section 2.1.

  2. Step 2:

    Let the 1D Logistic map iterate (l + m) times, and only keep the latter melements to obtain a new sequencesp = {xl + 1, xl + 2, xl + 3, ..., xl + m}, wherem = 24.

  3. Step 3:

    Obtain three 1D sequences with the length of MNby converting each color component in row-major order,RP={R1,R2,...,RMN},GP={G1,G2,...,GMN} andBP={B1, B2,...,BMN}.

Fig. 2
figure 2

Structure of the proposed encryption algorithm

Each sequence is equally divided into 3 blocks. ri is denoted as the i-th block of RP,gi is denoted as the i-th block of GP,biis denoted as the i-th block of BP, where i = {1, 2, 3}.

  1. Step 4:

    Obtain the matrixrowRGBwith the size of (3 × MN).

$$ \left(\begin{array}{ccc}{r}_1& {r}_2& {r}_3\\ {}{g}_1& {g}_2& {g}_3\\ {}{b}_1& {b}_2& {b}_3\end{array}\right)\to \mathbf{rowRGB}=\left(\begin{array}{ccc}{g}_3& {r}_3& {b}_3\\ {}{g}_1& {r}_1& {b}_1\\ {}{g}_2& {r}_2& {b}_2\end{array}\right) $$
(4)
  1. Step 5:

    Obtain the binary matrix Qwith the size of (3 × 8) × MN by doing bit-level decomposition with each row of elements ofrowRGB, wherenin\( {\mathbf{Q}}_i^n \)represents then-th bit-level.

$$ \mathbf{rowRGB}=\left(\begin{array}{ccc}{g}_3& {r}_3& {b}_3\\ {}{g}_1& {r}_1& {b}_1\\ {}{g}_2& {r}_2& {b}_2\end{array}\right)\to \mathbf{Q}=\left(\begin{array}{lll}{g}_3^1& {r}_3^1& {b}_3^1\\ {}\vdots & \vdots & \vdots \\ {}{g}_3^8& {r}_3^8& {b}_3^8\\ {}{g}_1^1& {r}_1^1& {b}_1^1\\ {}\vdots & \vdots & \vdots \\ {}{g}_1^8& {r}_1^8& {b}_1^8\\ {}{g}_2^1& {r}_2^1& {b}_2^1\\ {}\vdots & \vdots & \vdots \\ {}{g}_2^8& {r}_2^8& {b}_2^8\end{array}\right) $$
(5)
  1. Step 6:

    Obtain a sequence CR according to each row of Q. The pseudo code of the corresponding step is shown in Fig. 3.

for (i = 1; i ≤ 3 × 8; i + +).

{Suppose the vector of the i-th row of QisL. Sum the values of the elements inLby the following equation.

$$ \mathbf{Sum}(i)= sum(L); $$
(6)

Obtain theqby the following.

$$ \mathbf{q}(i)=\mathbf{Sum}(i)+\mathbf{sp}(i)\times {10}^6\operatorname{mod}{2}^8; $$
(7)

Let the binary of q(i)be the information polynomialC(x), which is done modulo-2 division operation byF(x), and the decimal number CR(i) of the CRC code is obtained.

}

  1. Step 7:

    Cross shift

for (i = 1; i ≤ 3 × 8; i + +)// row shift.

$$ \Big\{\mathbf{len}(i)=\operatorname{mod}\left( floor\left(\mathbf{sp}(i)\times {10}^6+\mathbf{CR}(i)\times {10}^2\right), MN\right)+1 $$
(8)

If i is an odd, all elements of the row are cyclic shifted to the.

left by len(i) elements;

Else i is an even, all elements of the row are cyclic shifted to the right by len(i) elements;

}

for (j = 1; i ≤ MN; j + +)// column shift.

$$ \Big\{ leng=\operatorname{mod}\left(j,3\times 8\right)+1 $$
(9)
$$ \mathbf{len}(j)=\operatorname{mod}\left(\mathbf{CR}(leng),3\times 8\right)+1 $$
(10)

If thej-th column of matrix Q is odd, all elements of the column are cyclic shifted to the up by len(j)elements;

Else all elements of the column are cyclic shifted to the down by

len(j) elements;

}

  1. Step 8:

    According to the location sequence ofsort(CR), the rows of the Qare rearranged. Convert 1st~8th bit-rows, 9th~16th bit-rows and 17~24th bit-rows to three scrambled 1D vectors. Reshape them to three matricesIR,IG,IBwith the size of M × N.

  2. Step 9:

    Generate a random key matrix S∈[1255] with the size of M × Nusing the pseudo-random seed generatork. Obtain three matricesCR,CG and CBwith key matrixS.

$$ {\displaystyle \begin{array}{l}{\mathbf{C}}_{\mathbf{R}}={\mathbf{I}}_{\mathbf{R}}\oplus \mathbf{S}\\ {}{\mathbf{C}}_{\mathbf{G}}={\mathbf{I}}_{\mathbf{G}}\oplus \mathbf{S}\\ {}{\mathbf{C}}_{\mathbf{B}}={\mathbf{I}}_{\mathbf{B}}\oplus \mathbf{S}\end{array}} $$
(11)

MatrixCR,CG and CBare combined and the color cipher image is obtained.

The steps of decryption can be seen as the reverse of encryption. As shown in Fig. 4.

Fig. 3
figure 3

Pseudo code for steps 6 and 7 of the encryption algorithm

Fig. 4
figure 4

Structure of the proposed decryption algorithm

4 Simulation results

For the algorithm proposed in this paper, we made various simulation experiments with MatLab R2009a. Except for special statement in the experiment, the size of the tested images is (512× 512 × 3). The initial valuex0=0.4, the control parameter μ=3.6,the key l = M,F(x)=‘11101’ and k=5.

JPEG is a lossy compression format. By removing redundant data, the image can be compressed into a small storage space. Although the visual loss can be difficult to detect, it is easy to cause damage to the image data. Generally, simple encryption algorithms try to remove the spatial redundancy, which will affect the compression ratio and the image quality might be affected as well. Moreover, by observing the images before and after compression, it is found that the data at the bit-level is very different. So, when the encryption algorithm is operated at the bit-level, it is difficult to recover the encrypted image after compression. In Fig. 5 (a), the same image is encrypted. When the encrypted image is stored in PNG format, it can be successfully decrypted as shown in (d); when the encrypted image is stored in JPEG format, the cipher image cannot be successfully decrypted as shown in (e). Therefore, the images in lossless compressed or uncompressed, such as PNG images or TIFF images, fit the algorithm proposed in this paper. The color RGB test images used in the following simulation experiments are all PNG images, and the corresponding encrypted image is saved also in PNG format. Figure 6 shows the simulation results.

Fig. 5
figure 5

Encrypted image saved as PNG and JPEG format. (a) Plain image Baboon, (b) Encrypted image saved as PNG format, (c) Corresponding decrypted (b), (d) Decrypted image saved as JPEG format, (e) Corresponding decrypted (d)

Fig. 6
figure 6

Test results. (a) Plain image Baboon, (b) Baboon after encryption, (c) Corresponding decrypted (b), (d) Plain image Lena, (e) Lena after encryption, (f) Corresponding decrypted (e), (g) Plain image Tiffany, (h) Tiffany after encryption, (i) Corresponding decrypted (h)

4.1 Key space analysis

As we all know, for an algorithm of image encryption, the enough key space has advantages of resisting brute-force attacks. The key space of the encryption algorithm proposed in this paper is closely related to the initial valuex0and parameterμof the Logistic map, the seed of the pseudo-random generatork, the polynomialF(x), the integerl=512. Supposing that the computer precision is 10−16, the number of availablex0andμ is 1016 × 1016 = 1032. Thekis an integer between 0 and 232 -1. So, the number of available is232. As for the polynomialF(x), the available number is 229. Therefore, our key space is 1032 × 232 × 229 × 29 > 296 × 232 × 229 × 29 = 2166, as shown in Table 2. It is large enough to not only provide a high security space, but also resist brute-force attacks.

4.2 Statistical analysis

  1. (1)

    Histogram analysis

The histograms [36] of cipher images generated by the ideal algorithm of encryption are uniform. Figure 7 shows the histograms of the distributions of pixel values corresponding to pre-encrypted and encrypted Baboon image. Observing the histograms in the two states shows that the distribution of pixel values before encryption is regular, but after encryption the pixel values are almost distributed on the same horizontal line, and no information in the image is displayed. It can be concluded that this algorithm can effectively resist attacks based on frequency analysis of pixel values in encrypted images. Table 2.

Fig. 7
figure 7

Histograms analysis for image “Baboon”. (a) R component before encryption, (b) R component after encryption, (c) G component before encryption, (d) G component after encryption, (e) B component before encryption, (f) B component after encryption

Table 2 Comparison of Key space
  1. (2)

    Correlation analysis

The adjacent pixels have similar strength in the digital image and therefore there has a strong correlation. In order to avoid statistical attacks, these strong correlations must be broken. We randomly selectN=5000 pairs of adjacent pixelsxiandyi in the horizontal, vertical and diagonal directions of Baboon image, respectively. And the calculation of the correlation coefficients can be expressed by

$$ {r}_{xy}=\frac{\operatorname{cov}\left(x,y\right)}{\sqrt{D(x)D(y)}} $$
(12)

where

$$ \operatorname{cov}\left(x,y\right)=\frac{1}{N}\sum \limits_{i=1}^N\left({x}_i-E\left[x\right]\right)\left({y}_i-E\left[y\right]\right) $$
(13)
$$ E(x)=\frac{1}{N}\sum \limits_{i=1}^N{x}_i $$
(14)
$$ D(x)=\frac{1}{N}\sum \limits_{i=1}^N{\left({x}_i-E\left[x\right]\right)}^2 $$
(15)

Figure 8 analyzes the horizontal correlation of “Baboon” image before and after encryption. From the six sub-graphs in the Fig. 8, we can see that the distributions of the horizontal pixels of the pre-encrypted and encrypted images are significantly different. The pixel values before encryption are distributed on one diagonal of the sub-graphs with high correlation, while the encrypted pixel values are evenly distributed in the entire gray space with extremely low correlation. Table 3 lists the correlation coefficients of the groups of the test images. Compared to the plain images with the correlation coefficients close to 1, the encrypted images are effectively eliminated the correlation between adjacent pixels by pixel diffusion, and the correlation coefficients of the pixels are almost close to 0 in all three directions. Table 4 compares the algorithm proposed in this paper with the adjacent coefficients of the other algorithms. The encryption algorithm of this paper can resist statistical attacks.

Fig. 8
figure 8

Horizontal correlation of “Baboon” image. (a) The R component of “Baboon” before encryption, (b) The G component of “Baboon” before encryption, (c) The B component of “Baboon” before encryption, (d) The R component of “Baboon” after encryption, (e) The G component of “Baboon” after encryption, (f) The B component of “Baboon” after encryption

Table 3 Correlation coefficients in three directions
Table 4 Comparison of correlation coefficients

4.3 Information entropy analysis

There is no doubt that the information entropy [33] is a significant consideration for measuring the randomness of the pixels in images. The closer to 8 the information entropy is, the more random the image is, which avoids the leakage of the information in the image. Suppose we define the source of the information asm, and the calculation formula for information entropy is as follows:

$$ H(m)=\sum \limits_{i=0}^{M-1}p\left({m}_i\right){\log}_2\frac{1}{p\left({m}_i\right)} $$
(16)

Where M denotes the total number of symbolsmi ∈ m, and p(mi) denotes the proportion of the occurrence of themi.

The information entropy of six different test images is shown in Table 5. By analyzing the data for each set of images, we can conclude that the average value of the information entropy of the cipher images in the R, G and B components is about 7.9993, which is close to the ideal value of 8 and indicates that the algorithm of the encryption is also safe under the entropy attack.

Table 5 Information entropy

Further more, Table 6 shows the information entropy compared with other algorithms. Kadir et al. [9] performed bitwise operations of XOR and left or right cyclic shift inside pixel values, which essentially only changed the pixel values, but the three components were completely isolated in operation. Therefore, the overall pixels were not evenly distributed. Although Teng et al. [28] permuted the pixels at bit-level, the process of integrating three components into one bit-level image was simple, and the diffusion between the three components was insufficient. Similarly, Parvaz and Zarebnia [20] repeatedly used the cyclic shift and XOR operations, but the overall pixels did not reach a state of random distribution. However, the algorithm proposed in this paper strengthens the connection between the three components, and the pixels of each component are better diffused, so that it is evenly distributed over the entire image.

Table 6 Information entropy of Lena image encrypted by different algorithms

The average information entropy of the proposed algorithm is higher, which is 0.0976% higher than [9], 0.0366% higher than [28], 0.0300% higher than [20] and closer to 8, suggesting higher security.

4.4 Key sensitivity analysis

A good cryptographic system needs to have a dependency on the secret keys to be able to resist brute-force attacks [23]. In other words, the decrypted image cannot be recovered normally when the key used in the decryption process is slightly changed. Fig. 6(c) shows the reconstructed image obtained with the correct secret keys mentioned in this paper when decrypting Fig. 6(b). To test whether the encryption algorithm mentioned above is sensitive to the secret keys during the decryption process, only one of the keys is changed slightly at a time. And the remaining keys stay unchanged, and then the cipher image is decrypted.

The test results are shown in Fig. 9 by several different sets of data changes. Fig. 9 (a) shows the decrypted results when k=6; (b) shows the decrypted results whenx0=0.4000001; (c) shows the decrypted results whenF(x)=‘10011’. It can be clearly seen that these decrypted images have not been successfully restored to the plain images, and no useful information is obtained from them. Therefore, we can conclude that the algorithm proposed in this paper has a high dependence on the secret keys.

Fig. 9
figure 9

Decryption with wrong system key

4.5 Robust analysis

  1. (1)

    Noise attack analysis

During transmission through the physical channel, digital images will inevitably experience various noise disturbances. For a cryptographic system with good encryption performance, it should be very resistant to noise attacks. In order to test the anti-noise ability of the algorithm mentioned above, we chose to attack the cipher image with salt & pepper noise and calculate the PSNR [22] of the reconstructed image after noise attack. PSNR is computed as follows

$$ PSNR=10\times {\log}_{10}\left(\frac{MA{X}_I^2}{MSE}\right)=20\times {\log}_{10}\left(\frac{MA{X}_I}{\sqrt{MSE}}\right) $$
(17)

where

$$ MSE=\frac{1}{mn}\sum \limits_{i=0}^{m-1}\sum \limits_{j=0}^{n-1}{\left\Vert I\left(i,j\right)-K\Big(i,j\Big)\right\Vert}^2 $$
(18)

MAXI denotes the maximum possible pixel value of the image,I(i, j)denotes the pixel values of the plain image, K(i, j)denotes the pixel values of the reconstructed image.

The noise of 0.01 density was firstly added to the cipher image and then decrypted according to the correct decryption algorithm. It is observed from Fig. 10 (a) that the decrypted image is substantially unaffected with the PSNR 27.8245 dB. Subsequently, the density of the noise is increased, it can be seen from (b) and (c) that while the quality of the reconstructed images is a little bit affected and PSNRs of those are decreasing from 20.8155 dB to 17.878 dB, the images subjected to noise attack can still be successfully recovered and the important information of the plain image is retained.

Fig. 10
figure 10

The decryption results with salt & pepper noise:(a) 0.01 noise, PSNR = 27.8245 dB, (b) 0.05 noise, PSNR = 20.8155 dB, (c) 0.1 noise, PSNR = 17.8748 dB

  1. (2)

    Cropped attack analysis

In the process of transmission and storage of digital images, data loss occurs sometimes. We chose different degrees of data loss to test the degree of recovery of the encrypted image. As can be seen from the results in Fig. 11, when the size of the missing block of the encrypted image is only 120 × 120, it can be reconstructed according to the correct decryption algorithm with the PSNR 20.3325 dB; when the size of the missing block of the encrypted image is increased by 150 × 512, about 30% of the data of the cipher image is lost, the PSNR is 13.1984 dB, but the decrypted image can still be recognized. Therefore, from the above analysis, the algorithm can resist cropped attack.

Fig. 11
figure 11

Cropped attack: (a) 120 × 120 cropped, (b) 256 × 256 cropped, (c) 150 × 512 cropped, (d) Decrypted result of 120 × 120 cropped, PSNR = 20.3325 dB, (e) Decrypted result of 256 × 256 cropped, PSNR = 13.8291 dB, (f) Decrypted result of 150 × 512 cropped, PSNR = 13.1984 dB

Table 7 shows the MSE and PSNR of the reconstructed images for the encrypted images against noise attacks and cropped attacks. Based on the analysis of the noise attack and the cropped attack, it can be concluded that the algorithm proposed in this paper has strong robustness.

Table 7 MSE and PSNR values against noise attack and cropped attack

4.6 Speed performance

In order to test the time taken by the algorithm mentioned above during the encryption and decryption phases, we run the program in a Lenovo computer with 1.90 GHz AMD A8-4500 M CPU and 4.0 GB RAM on Windows 7 system, and the execution times are listed in Table 8. When encrypting different RGB images with the size of 512 × 512, the encryption program and the decryption program in the computer run not fast, and the main reason is that it takes a lot of time in the process of cross-shifting. This may be a breakthrough point for future work.

Table 8 Speed performance

5 Conclusion

In this paper, based on CRC and the nine palace map, we have proposed an algorithm of the chaos encryption for the color image. The blocks of the plain image input are scrambled, and each component is converted and decomposed into eight binary vectors. Then, based on the elements of the binary vector, the CRC code is obtained, which is used as shift step-length to change the order of elements of the binary vector. Subsequently, the operation of bitwise XOR is applied to the diffuse pixels. The experimental results and security analysis show that the space of the secret keys of the algorithm is very large, that the histogram of the cipher images is evenly distributed, and that the correlation of adjacent pixels of the cipher images is reduced. Further more, the average value of entropy is 7.9993, which is higher than the literature [9, 20, 28], indicating the efficiency for resisting the entropy attack. It proves that the encryption algorithm has a good effect on encryption by noise attack analysis, cropped attack and key sensitivity analysis. Good security makes the proposed algorithm suitable for the encryption of the color image. Today, Network Function Virtualization [35, 39] is a central topic. How to combine encryption technology with it is a future research direction and we will conduct more in-depth research. At the same time, we will further improve the security of the algorithm and research other encryption algorithms with higher security and faster speed.