1 Introduction

With the development of science and technology, there are more and more electronic products in our life, and the use of smart-phones and computers is increasing day by day. A large amount of user data information is generated and transmitted on the network. Compared with other data formats, the information carried by digital images is transmitted to users through visualization, which is more intuitive and visual, and has become a widely used data format. At the same time, because digital images contain a large amount of predictable information, the security and privacy of image information has attracted much attention. In order to ensure the safe transmission of image information in the network without leakage, it is necessary to encrypt the image and then transmit it. Common traditional encryption methods include Data Encryption Standard (DES), RSA and Advanced Encryption Standard (AES), which are often used for text data encryption. Compared with text data format, image data has large redundancy and high correlation between pixels. Traditional encryption methods, with too long execution time, are not suitable for image encryption [6, 16, 29]. For data security, a text encryption algorithm is proposed using matrix properties [13]. The algorithm converts 26 letters into 1–26 in sequence, and then converts the converted number sequence into a matrix, and inverts the matrix to obtain the encrypted text. If the algorithm is applied to the image, it is the inverse of a large matrix, with high computational complexity and general confusion effect. At present, some new methods are tried to apply to digital image encryption: cellular automata [17, 21], wavelet transform [20], compressed sensing [4], DNA coding [5, 10, 30], neural network [31] and chaotic map [1, 11, 27], watermarking [25], etc.

Due to the randomness, ergodicity, and sensitivity to initial values and control parameters of the chaotic system, the encryption algorithm of the chaotic system can reduce the number of encryption rounds and the complexity of the algorithm while achieving security standards. Compared with other methods, chaotic-based encryption technology is more superior [9]. Zhou et al. used the Chen map of hyper-chaotic system in [19]. The map has four control parameters and four initial values, which greatly increases the key space and makes the algorithm effective against exhaustive attacks. In [7], Cao et al. used a new two-dimensional chaotic system, which is based on the cascade modulation coupling model to achieve the combination of two one-dimensional chaos. The system has good randomness and ergodicity, and the parameter range is larger than two one-dimensional chaotic maps, which is more suitable for image encryption. Taneja et al. [24] proposed a chaotic cryptosystem based on spatial domain. The purpose of this paper is to replace any chaotic system in the displacement and diffusion stage, so as to achieve the savings of resource calculation. The paper takes Cat map and Henon map as examples, and the experimental results show that this algorithm can achieve its goal well. The high-dimensional chaotic system has a large key space and high security, but the computational complexity is high, which takes longer than a one-dimensional chaotic system.

Zhu et al. [32] used Cat map to calculate the new coordinates of each pixel, and completed the permutation process according to the new coordinates. Here, the two control parameters of Cat map are calculated by Logistic map, in order to increase encryption security. Each pair of coordinates requires multiple calculations to get the final result, and the execution time increases significantly when the performance is slightly improved. Zhang et al. proposed non-adjacent coupled map lattices (NCML) in [26]. Compared with Logistic map and coupled map, NCML has more prominent cryptographic characteristics. The generated sequence is the diffusion key can achieve the security of the algorithm very well. Joshua et al. [15] used the enhanced version of logistic map to generate chaotic key. Considering the reasons of discontinuous chaotic range, uneven distribution, small key space and chaotic period of logistic map and other one-dimensional maps, the enhanced logistic map can achieve better security of the encryption system. One dimensional chaotic systems have great advantages over high-dimensional chaotic systems in terms of computational complexity. However, the one-dimensional chaotic map has a small key space and low security. Considering these shortcomings, there are currently existing improved methods: cascaded chaotic systems, pseudo-random disturbances, switching systems, and combined systems based on modular arithmetic.

According to Shannon’s description, a secure encryption system can be constructed by using the permutation-diffusion structure [18]. Dai et al. only used a round of diffusion operation to complete the encryption process in [8]. The diffusion operation is to XOR the original image pixels with the values generated by the Logistic map and Chebyshev map iteration. After all the pixels of the image are traversed, the encryption is completed. Hua et al. used the two permutation-diffusion process in [12]. This method is efficient and robust to some impulsive noise and data loss. Because this method is a bit-level operation, twice permutation-diffusion process will greatly increase the computational complexity. In [2], Alawida et al. first divide the image up and down, obtain the permutation order according to the chaotic map, and then the upper and lower pixels interact with each other to obtain the diffusion key matrix to realize the diffusion process, complete the first permutation-diffusion process, and then divide the left and right to complete the second permutation-diffusion process. Taneja et al. [22] proposed a different encryption method for different regions and carried out A total of two rounds of displacement - XOR diffusion forward and reverse diffusion. The image matrix is divided into blocks, according to the edge detection results to determine whether each block is an important block, important and unimportant blocks are encrypted in two ways, the algorithm well ensures the security at the same time, improve the encryption efficiency. Kohli et al. [14] proposed a multiple encryption technique that optimizes memory/area chip, operational usage, encryption time, etc.

For all cryptographic systems, chaos system is very important for developing encryption algorithms with good randomness. Meanwhile, considering how to realize the permutation and diffusion process and ensure that the algorithm can resist all kinds of attacks is also the key of encryption algorithm. In this paper, a composite chaotic system based on Logistic map and Sine Map is presented. The good performance of the chaotic system can be known by computing Lyapunov index and National Institute of Standards and Technology (NIST) test. On this basis, a new permutation algorithm is proposed, which can be used in diffusion-permutation-diffusion structure to achieve the same encryption process and decryption process. The remainder of this paper is as follows: The new composite chaotic system is presented in Section 2. Section 3 introduces the algorithm process, Section 4 is the simulation experiment, and Section 5 is the summary.

2 Chaotic system

2.1 New-logistic-sine map

In chaotic maps, Logistic, Tent, Sine, and so on are traditional one-dimensional maps. A chaotic system with good pseudo-random sequence and large parameter in image encryption can be obtained by combining them properly. Alawida et al. proposed a new structure of chaotic map [2], as shown in Fig. 1.

Fig. 1
figure 1

The structure diagram of chaotic map proposed in [2]

where +, × represents the addition operation and multiplication operation between floating-point numbers, Mod is the operation of taking modulus of 1, and the value of Ω determines the calculation time and chaos.

According to Fig. 1, the chaotic map can be represented as,

$$ {x}_{n+1}=\left(\left({f}_{main}\left({f}_{seed}\left({x}_n\right)\right)+{f}_{seed}\left({x}_n\right)\right){r}^{\varOmega}\right)\operatorname{mod}1 $$
(1)

where fmain and fseed are traditional one-dimensional chaotic maps.

Logistic map and Sine map can be represented as Eqs. (2) and (3).

$$ \mathrm{Logistic}\ \mathrm{map}:{x}_{n+1}={r}_0{x}_n\left(1-{x}_n\right),{r}_0\in \left(\mathrm{3.55,4}\right] $$
(2)
$$ \mathrm{Sine}\ \mathrm{map}:{x}_{n+1}={r}_1\sin \left(\pi {x}_n\right),{r}_1\in \left[0,1\right] $$
(3)

It can be seen from Fig. 2 that the control parameter range of Logistic map(r0 ∈ (3.569945627, 4]) is very small, and when r0 approaches 4, Logistic map’s Lyapunov exponent is positive. The parameter range of Sine map is discontinuous, when r1 approaches 1, Sine map’s Lyapunov exponent is positive [9]. So, in this paper, taking Logistic map as fmain and Sine map as fseed, we can overcome the shortcomings of two one-dimensional maps and obtain an improved New-Logistic-Sine map(NLS map).

Fig. 2
figure 2

Lyapunov exponent of Logistic map and Sine map

The NLS map as follows,

$$ {x}_{n+1}=\left(\left(\frac{r^2}{4}\sin \left(\pi {x}_n\right)\times \left(1-\frac{r}{4}\sin \left(\pi {x}_n\right)\right)+\frac{r}{4}\sin \left(\pi {x}_n\right)\right){r}^{11}\right)\operatorname{mod}1 $$
(4)

where xn + 1 = ((fmain(fseed(xn)) + fseed(xn))rΩ) mod 1, fmain = rx(1 − x), \( {f}_{\boldsymbol{seed}}=\frac{r}{4}\mathit{\sin}\left(\pi x\right) \), r ∈ [0, 6]. Considering the chaotic characteristics and the computation time, set Ω = 11.

Compared with Tent-Logistic-Tent (TLT) map and Tent-Sine-Tent (TST) map [2], the control parameters of the composite chaotic map have a larger chaotic interval. In this interval, NLS map has larger Lyapunov exponent and complex chaotic behavior. It can increase the key space and improve the performance of encryption system when applied to encryption system.

2.2 Performance analysis of NLS map

In order to show the performance of NLS map, it will be compared and analyzed with TLT map and TST map from three aspects, namely bifurcation diagram, chaotic trajectory and Lyapunov index. And the randomness of sequences generated by NLS maps is proved by NIST test.

2.2.1 Bifurcation diagram

Bifurcation refers to the sudden change of topological structure due to the change of control parameters in dynamic system. After continuous bifurcation, the final state is chaos.

Figure 3 shows the bifurcation diagram of TLT map, TST map and NLS map at initial value x0 = 0.216. Abscissa is the control parameter. Fig. 3a shows the bifurcation diagram of TLT map, which stops bifurcation after r2 = 1.05 and reaches chaotic state, and the value range of r2 is [1.05, 4]; Fig. 3b is the bifurcation diagram of TST map, which stops bifurcation after r3 = 1.05 and reaches chaotic state, and the value range of r3 is [1.05, 4]; Fig. 3c is the bifurcation diagram of NLS map, which stops bifurcation after r = 1.509 and reaches chaotic state, the value range of r is [1.509, 6]. It can be seen from Fig. 3 that the control parameter range of the proposed NLS map is larger, and the key space required for the encryption algorithm is large, which can well resist exhaustive attacks.

Fig. 3
figure 3

Bifurcation diagram

2.2.2 Chaotic trajectory

The trajectory of periodic motion is a closed curve, and the trajectory of chaotic motion will never be closed or repeated theoretically. Therefore, chaotic trajectories usually occupy a certain phase space and can reflect the randomness of the output of chaotic systems. If the chaotic trajectory of a chaotic system occupies a large phase space, it has a good random output.

The control parameters of TLT map, TST map and NLS map are set as r3 = r4 = r = 2.4111, and the initial value is x0 = 0.216. In order to show the actual behavior of chaotic system in stable state, we draw the iteration points from 0 to 2000 in each trajectory. It can be seen from Fig. 4 that the NLS map trajectories occupy almost all the phase planes.

Fig. 4
figure 4

Trajectories

2.2.3 Lyapunov exponents

The sensitivity of initial state is the most obvious characteristic of chaotic behavior. Lyapunov exponents(LE) [3] can quantitatively describe the initial state sensitivity. For two trajectories of a chaotic system starting from two close initial states, LE describes their average separation rates. For the differentiable one-dimensional dynamic system xi + 1 = f(xi), i = 0, 1, 2, …, the LE for 1D maps are given by

$$ \lambda =\underset{N\to +\infty }{\lim}\frac{1}{N}\sum \limits_{n=1}^N\log \mid \frac{d{x}_{n+1}}{d{x}_n}\mid $$
(5)

A positive LE index indicates that the closed trajectory of the dynamic system diverges in unit time and evolves into a completely different trajectory with the increase of time. Therefore, if the LE index of a dynamic system is positive, then the system is chaotic. And a higher value means better performance.

As shown in Fig. 5a, when r ∈ [1.509, 6] occurs, NLS map is in chaotic state, and Lyapunov exponent is close to 24. The Lyapunov exponents of TLT map and TST map are described in Fig. 5b. When r ∈ [1.05, 4] occurs, TLT map and TST map are in chaotic state, and the Lyapunov exponent is close to 17. The chaotic interval of NLS map is greater than TLT map and TST map, meanwhile the value of LE is bigger, so NLS maps have better performance.

Fig. 5
figure 5

Lyapunov exponents

2.2.4 NIST test

In this paper, the pseudo-randomness of sequences generated by NLS Map is verified by NIST test.

In order to obtain more accurate experimental results, we determined the sequence length of the test as n = 100000. In this paper, according to the chaotic trajectory, the initial value and parameter of NLS map are x0 = 0.216, r = 2.4111. We iterate Eq. (4) for n times to get a sequence X = {x1, x2, ⋯, xn} of length n, and then convert it to the binary sequence \( \hat{X}=\left\{{\hat{x}}_1,{\hat{x}}_2,\cdots, {\hat{x}}_n\right\} \), where \( {\hat{x}}_i \) is defined as follows

$$ {\hat{x}}_i=\Big\{{\displaystyle \begin{array}{c}0,0\le {x}_i<\delta \\ {}1,\delta \le {x}_i<1\end{array}} $$
(6)

and \( \delta =\frac{1}{n}{\sum}_{i=0}^n{x}_i \) is the average value of the test sequence X. We get a n bit long binary sequence finally. It is divided into 10 groups, each of which is 10000bit long. The NIST test consists of 15 test elements, as shown in the first column of Table 1. The third column of Table 1 shows the average of the 10 groups of P values in this test. The test results showed that all P values were greater than 0.01, and all 15 tests passed. Therefore, it shows that the chaotic sequences generated by the composite chaotic system are random.

Table 1 NIST test results

3 Analysis and design of encryption and decryption algorithm

The encryption and decryption algorithms proposed in this paper are consistent. The algorithm includes two diffusion processes and one permutation process. After inputting the initial key and the original image, the encryption key is calculated, and the encryption image is obtained through the algorithm; then, if the encryption image and encryption key are used as the input, the original image will be obtained by running the same algorithm.

Assumes that the size of the original image P is M × N, M is the length of the image and N is the width of the image.

3.1 Initial value and parameter generation of chaotic system

The key sequence and key matrix needed in the process of encryption are obtained by iterative chaotic map. In order to improve the sensitivity of the key and the anti-differential attack ability of the algorithm, the chaotic sequence initial values and control parameters are related to the original image. The method is to use SHA256 function to get the hash value of the original image, and then generate the final initial value (x0) and control parameter (r) of NLS map and the initial value (y0) and control parameter (r0) of Logistic map respectively through the initial keys \( {\dot{x}}_0 \), \( \dot{r} \), \( {\dot{y}}_0 \), \( {\dot{r}}_0 \).

  1. Step 1:

    Through the hash function on the original image, getting a 64 bit hexadecimal string H,

    $$ H={h}_1,{h}_2,\dots, {h}_{64} $$
    (7)
  2. Step 2:

    Convert each character of hj (j = 1, 2, …, 64) into a 4-digit binary system, a 64 binary string T,

    $$ T={t}_1,{t}_2,\dots, {t}_{64} $$
    (8)
  3. Step 3:

    According to Eq. (9), divide the string T into 4 parts to calculate K1, K2, K3 and K4 respectively,

    $$ Kl={\sum}_{i=n}^m\left(T\left[i\right]\right) $$
    (9)

    where l = 1, 2, 3, 4, for each part, \( n=\left(l-1\right)\ast \left(\raisebox{1ex}{$64$}\!\left/ \!\raisebox{-1ex}{$4$}\right.\right) \), \( m=n+\raisebox{1ex}{$64$}\!\left/ \!\raisebox{-1ex}{$4$}\right. \).

  4. Step 4:

    With K1, K2, K3, K4 and the initial keys (\( {\dot{x}}_0 \), \( \dot{r} \), \( {\dot{y}}_0 \), \( {\dot{r}}_0 \)). x0, r, y0 and r0 are generated for the first time.

    $$ {x}_0=\left({\dot{x}}_0+K1+K2\right)\mathit{\operatorname{mod}}1 $$
    (10)
    $$ {y}_0=\left({\dot{y}}_0+K3+K4\right)\mathit{\operatorname{mod}}1 $$
    (11)
    $$ r=\left(\dot{r}+K2+K4\right)\mathit{\operatorname{mod}}4.491+1.509 $$
    (12)
    $$ {r}_0=\left({\dot{r}}_0+K1+K3\right)\mathit{\operatorname{mod}}0.43+3.5699 $$
    (13)
  5. Step 5:

    Using the initial keys (\( {\dot{x}}_0 \), \( \dot{r} \), \( {\dot{y}}_0 \), \( {\dot{r}}_0 \)) and the x0, r, y0, r0 generated in Step 4, the initial values and control parameters required for the final chaotic map are obtained by Eqs. (1417).

    $$ {x}_0=\left({\dot{x}}_0+{x}_0+{y}_0+r+{r}_0\right)\mathit{\operatorname{mod}}1 $$
    (14)
    $$ {y}_0=\left({\dot{y}}_0+{x}_0+{y}_0+r+{r}_0\right)\mathit{\operatorname{mod}}1 $$
    (15)
    $$ r=\left(\dot{r}+{x}_0+{y}_0+r+{r}_0\right)\mathit{\operatorname{mod}}4.491+1.509 $$
    (16)
    $$ {r}_0=\left({\dot{r}}_0+{x}_0+{y}_0+r+{r}_0\right)\mathit{\operatorname{mod}}0.43+3.5699 $$
    (17)

3.2 Encryption and decryption algorithm

The control parameters and initial values (\( {\dot{x}}_0 \), \( \dot{r} \), \( {\dot{y}}_0 \), \( {\dot{r}}_0 \)) of NLS map and Logistic map are obtained by using the method in Section 3.1. The permutation key sequence and the diffusion key matrix are generated by iterating the two chaotic maps several times. The diffusion key matrix is used to realize the first diffusion process of P to obtain C1; Next, the permutation key sequence is used to confuse C1 to obtain C2; Finally, C2 is processed through the second diffusion process to obtain the final image C3. The flow chart of the algorithm is shown in Fig. 6.

Fig. 6
figure 6

Proposed image cryptosystem

Using this algorithm, the process of encryption and decryption can be consistent. A detailed diffusion -permutation - diffusion algorithm is given below.

Diffusion algorithm 1:

  1. Step 1:

    Substitute the x0, r into the NLS map(Eq. (4)) for 1000 + MN iterations. In order to obtain the steady-state data, we take the data generated by 1001 iterations to 1000 + MN iterations as valid data to generate sequences List.Substitute the x0, r into the NLS map(Eq. (4)) for 1000 + MN iterations. In order to obtain the steady-state data, we take the data generated by 1001 iterations to 1000 + MN iterations as valid data to generate sequences List.

  2. Step 2:

    According to Eq. (18), all values of the sequence List are converted into integer values between 0 and 255 to obtain the E sequence,

    $$ E\left[i\right]=\left(\boldsymbol{List}\left[i\right]\ast {10}^4\right)\mathit{\operatorname{mod}}256 $$
    (18)
  3. Step 3:

    Transform the E sequence into the key diffusion matrix NE of M × N,

    $$ NE= reshape\left(E,M,N\right) $$
    (19)
  4. Step 4:

    Add NE into Eq. (20) and get C1 from the original image P(M × N),

    $$ C1\left[i,j\right]=P\left[i,j\right]\oplus NE\left[i,j\right] $$
    (20)

    where i = 0, 1, …, M, j = 0, 1, …, N.

 Permutation algorithm:

  1. Step 1:

    Transform C1 into the sequence h _ C1 with length of MN, and calculate the segmentation position L of the upper and lower parts,

    $$ L= math. ceil\left( len\left(h\_C1\right)/2\right) $$
    (21)
  2. Step 2:

    Use the initial value y0 and parameter r0, iterate Logistic map(Eq. (2)) for 2000 + MN − L times, also remove the data of the first 2000 times, take the data from 2001 to 2000 + MN − L times as valid data, and get the sequence X with length of MN − L.

  3. Step 3:

    Obtain the index sequence X1 of sequence X from small to large, and the range of the index sequence X ∈ [0, MN − L − 1],

    $$ X1= np.\mathit{\arg}\boldsymbol{sort}(X) $$
    (22)
  4. Step 4:

    Transform the size range of X1 into X ∈ [L, MN − 1] to obtain the sequence X2,

    $$ X2\left[i\right]={M}^{\ast }N-L+X1\left[i\right] $$
    (23)

    where, i = 0, 1, …, MN − L − 1.

  5. Step 5:

    Traverse i, swap the front and back of h _ C1 according to the sequence X2,

    $$ {\displaystyle \begin{array}{c}c\_C1=h\_C1\left[i\right]\\ {}h\_C1\left[i\right]=h\_C1\left[X2\left[i\right]\right]\\ {}h\_C1\left[X2\left[i\right]\right]=c\_C1\end{array}} $$
    (24)

    where c _ C1 is the intermediate value.

  6. Step 6:

    Reshape the sequence h _ C1 into the matrix C2 of M × N,

    $$ C2=\boldsymbol{reshape}\left(h\_C1,M,N\right) $$
    (25)

    C2 is the permutation result.

 Diffusion algorithm 2:

According to Eq. (26), the permutation result C2 and the diffusion key matrix are XOR operated to obtain the final encrypted image C3

$$ C3\left[i,j\right]=C2\left[i,j\right]\oplus NE\left[i,j\right] $$
(26)

where i = 0, 1, …, Nj = 0, 1, …, N.

4 Simulation results and security analysis

4.1 Simulation results

This section gives the simulation results of the proposed scheme. A large number of experiments were carried out based on four grayscale images (from the USC-SIPI image database and computer vision test images [3]), ordinary images of Lena.jpg (256 × 256), Peppers.jpg (256 × 256), Baboon (256 × 256), Boat (256 × 256). Select \( {\dot{x}}_0=0.4478 \), \( {\dot{y}}_0=0.7643 \), \( \dot{r}=2.8113 \), \( {\dot{r}}_0=3.5699 \) as the initial keys. The encryption results are shown in the Fig. 7.

Fig. 7
figure 7

Simulation results

In the case of meeting safety requirements, operating speed becomes an important factor in practical applications. In order to evaluate the calculation speed, the Lena image, Peppers image, Baboon image, Boat image are encrypted 10 times, and the average execution time is shown in Table 2. It’s obvious from the Table 2 that the encryption speed of the method proposed of our scheme is better than Ref. [5], Ref. [2], and Ref. [28].

Table 2 Algorithm execution time

4.2 Security analysis

4.2.1 Histogram analysis

Histogram is used to describe the distribution quantity of all pixel values in an image. The more uniform the histogram distribution, the lower the readability and the higher the security of the encrypted image. Figure 8 shows the histogram of original images and the histogram for the corresponding encrypted image.

Fig. 8
figure 8

Histograms of the original and encrypted images

It can be seen from Fig. 8 that the histogram distribution after the original image density is uniform. In addition, three criteria are used to reflect the uniform consistency of the histogram, namely, maximum deviation(MD), irregular deviation(ID) and deviation from uniform histogram(DUH) [2]. They are defined respectively as follows,

$$ {\displaystyle \begin{array}{c}{M}_D=\frac{D_0+{D}_{N+1}}{2}+\sum \limits_{i=1}^{N-1}{D}_i\\ {}\end{array}} $$
(27)
$$ {I}_D=\sum \limits_{i=0}^{N-1}\mid {h}_i-{A}_H\mid $$
(28)
$$ DUH=\frac{\sum \limits_{C_i=0}^{255}\mid {H}_{C_i}-{H}_C\mid }{M\times N} $$
(29)

where \( {D}_i=\left|{D}_{C_i}-{D}_{P_i}\right| \) is the absolute value of the difference between the two pixels corresponding to the same position of the encrypted image and the original image; N is the number of grey values with the range of [0,256]; hi is the difference between the encrypted image and the original image in the histogram under the same index i; AH is the average of the histogram; \( {H}_{C_i} \) is the value corresponding to histogram index, \( {H}_C=\frac{M\times N}{256} \)represents the average grayscale value of each pixel.

A large MD indicates that the pixel value of the encrypted image has been greatly changed, which means that the encryption scheme is secure; A smaller ID indicates that the pixel values of encrypted images are distributed evenly, which is a very important feature of encrypted images; The lower the DUH is, the closer the histogram is to the ideal state, and the distribution is uniform.

From the Table 3, according to the average data of the four graphs, the effect of the text in histogram data is comparable to Ref. [28] and better than Ref. [2], Ref. [5].

Table 3 Histogram analysis and Comparison

4.2.2 Correlation coefficient analysis

For any given image, each pixel has a high correlation with its adjacent pixels in the horizontal, vertical, and diagonal directions. A good encryption algorithm can break the correlation of adjacent pixels in an image. In order to measure the correlation between adjacent pixels(x, y), it is necessary to select the adjacent pixels from the image and then calculate their correlation coefficient rxy. The pixel distribution of plaintext image and encrypted image is shown in Fig. 9.

$$ {r}_{xy}=\frac{\operatorname{cov}\left(x,y\right)}{\sqrt{D(x)}\sqrt{D(y)}} $$
(30)
$$ \mathit{\operatorname{cov}}\left(x,y\right)=E\left\{\left(y-E(y)\right)\left(x-E(y)\right)\right\} $$
(31)
$$ E(x)=\frac{1}{N}\sum \limits_{i=1}^N{x}_i,D(x)=\frac{1}{N}\sum \limits_{i=1}^N{\left({x}_i-E(x)\right)}^2 $$
(32)
Fig. 9
figure 9

The distribution of two adjacent pixels in the original image and the cipher image

The closer rxy is to 0, the better. The average correlation of 1000 times was calculated by comparing three references.

As can be seen from the data in Table 4, the correlation between the encryption results obtained by the algorithm in this paper is all less than 0.03, effectively reducing the high correlation between pixels of the original image [5]. According Table 4, the algorithm in this paper is better than Ref. [2] and Ref. [5], and is equivalent to Ref. [28].

Table 4 Correlation coefficients

4.2.3 Information entropy

Information entropy is another standard to evaluate the distribution of image gray value, which reflects the uncertainty of image information. The information entropy of sequence s can be expressed as,

$$ H(s)=\sum \limits_{i=0}^{L-1}P\left({s}_i\right){\log}_2\frac{1}{P\left({s}_i\right)} $$
(33)

where L = 2M, and M is the total number of samples (for images with gray level of 8, M is 8). si is the gray value of the image, P(si) stands for the probability of the element si in the sequence s, and \( \sum \limits_{i=0}^{L-1}P\left({s}_i\right)=1 \). The value of information entropy is close to 8, which indicates that the encryption algorithm makes the image more random and can resist certain statistical analysis.

From the Table 5, it can be seen that for the results of four pictures, the uncertainty of image information in this paper is on average better than Ref. [5], and the effect is similar to Ref. [28].

Table 5 Comparison of information entropy analysis

4.2.4 Analysis of defense against differential attack

Cryptography differential attack is a very common attack. Differential attack as a selective plaintext attack, the attacker tends to change one or more values of pixels of original image, and then use the attacked encryption algorithm encrypt the image. By analyzing the cipher image, attacker can find out some specific relations, thus obtain the correct encryption key or expose some clear information. The diffusion operation of the image encryption algorithm can make the small change of plaintext affect the cipher-text pixel as much as possible. When the two images were completely different, the expected value of the number of pixels change rate(NPCR) was 99.6094%. The expected value of the unified average changing intensity(UACI) is 33.4635%.

From the Table 6, it can be seen that, compared with the four pictures, the algorithm proposed in this paper is better than Ref. [2] and Ref. [28] in differential attack, and the effect is similar to Ref. [5].

Table 6 NPCR and UACI analysis and comparison

4.2.5 Ability to resist noise and cropping attacks

In the actual communication channel, cipher-text image will be disturbed by noise or cropping attacks, so the image encryption algorithm should be able to resist noise interference and data loss to a certain extent. Gaussian noise and pepper and salt noise are two common kinds of noise in image transmission. The mean square error (MSE) and the peak signal-to-noise ratio (NSPR) are used to measure. The smaller the MSE is, the stronger the anti-noise and data loss capability is. The equation is,

$$ MSE=\frac{1}{MN}\sum \limits_{x=1}^M\sum \limits_{y=1}^N{\left[f\left(x,y\right)-{f}^{\prime}\left(x,y\right)\right]}^2 $$
(34)
$$ PSNR=10{\log}_{10}\left({255}^2/ MSE\right) dB $$
(35)

where f (x, y) represents the pixel value at position (x, y), and f(x, y) represents the pixel value after data loss or noise attack at this position.

It can be seen from Figs. 10, 11 and 12 and Table 7 that the method proposed in this paper can well resist noise and data loss attacks.

Fig. 10
figure 10

The decryption effects under different levels of Gaussian noise

Fig. 11
figure 11

The decryption effects under different levels of pepper and salt noise

Fig. 12
figure 12

The decryption effect under different degrees of data loss

Table 7 Test results of resistance to noise and cropping attacks

4.2.6 Edge distortion

After edge detection, the result will expose the boundary and curve mark of the object. A good encryption algorithm needs to disrupt its boundary and can’t get effective information by edge detection of encrypted images. Thus, two new edge-dependent evaluation parameters viz. Edge Ratio(ER) and Edge Differential Ratio(EDR) are introduced in [23]. These are mathematically represented as follows:

$$ ER=\frac{\sum \limits_{i,j=0}^{N,M}\hat{B}\left(i,j\right)}{\sum \limits_{i,j=0}^{N,M}B\left(i,j\right)} $$
(36)
$$ EDR=\frac{\sum \limits_{i,j=0}^{N,M}\mid B\left(i,j\right)-\hat{B}\left(i,j\right)\mid }{\sum \limits_{i,j=0}^{N,M}\left(B\left(i,j\right)+\hat{B}\left(i,j\right)\right)} $$
(37)

where B(i, j) and \( \hat{B}\left(i,j\right) \) denote the bit value in the detected binary matrix for the original and the encrypted image, respectively.

An encrypted image should have fewer number of edges as compared to its original counterpart. In other words, lower ER value reflects better cryptosystem and vice versa. Meanwhile, high EDR values reflect that the left-out edges in the encrypted image have large deviation from the original image edges.

The values obtained for ER and EDR evaluation of the proposed technique is indicated in Table 8. The mean value of ER is less than 0.6, and the mean value of EDR is greater than 0.8, which means that more than 80% of the edge data have been transformed. The algorithm proposed in this paper can scramble the edge pixels well, and the data is better than other references.

Table 8 ER and EDR obtained for various test images and references

4.2.7 Key space and key sensitivity

Key space is too small, easy to be attacked by the hacker exhaustive. In order to avoid the key being broken, the key space needs to be greater than 2100 [9]. The algorithm proposed in this paper requires four key values, and the accuracy of each key value is in 10‐14, so the total key space of this algorithm has 1060, greater than 2100, and it can resist exhaustive attack very well.

Key sensitivity can be divided into encryption key sensitivity and decryption sensitivity. In encryption, two slightly different keys are used to encrypt the same picture. If the two encrypted images obtained are very different, it means that the encryption algorithm is very sensitive; if the decryption key is slightly changed in the decryption stage, If the decrypted image is a disordered image, the sensitivity of decryption is very strong.

To satisfy Kerchoff’s rule, the encryption system’s key needs to be sensitive enough that, knowing the encryption algorithm and not knowing the key, it is still difficult for an attacker to obtain meaningful information. The sensitivity of the key mainly includes the sensitivity of the encryption key and the sensitivity of the decryption key. Encryption image A is obtained by encrypting the original image with the keys presented in this paper, and encryption graph B is obtained after changing the keys. Figure A is decrypted using the changed keys to obtain Figure C. To measure the difference between Figure A and Figure B, and between the original and Figure C, the NPCR and UACI parameters mentioned in Sec.4.2.4 are used here.

The keys change is mainly in that x0 = 0.4478 changes to x0 = 0.44780000000001. From Table 9, we can see that a slight change in the keys will result in a completely different situation of encryption and decryption. It also proves that the algorithm satisfies the security of the key.

Table 9 NPCR and UACI values of images after modification of encryption and decryption keys

5 Conclusion

This paper proposes a unified encryption algorithm. The cryptosystem used New-Logistic-Sine map to generate the key stream for encryption/decryption process and employed the NIST test to show the key stream has good statistical characteristics. In the cryptosystem, the encryption algorithm and the decryption algorithm are the same, which can save half of the hardware and software resources while ensuring secure communication. In the simulation results and security analysis, we can see that the algorithm has a great improvement in the execution time and meets all kinds of security standards. In general, this paper does not have a great advantage in pixel distribution, which will be further studied in the future.