1 Introduction

In the era of rapidly increasing information, people are paying increasing attention to the privacy and security of information. The senders and the receivers of the information transmission do not want the information to be accessed by unauthorized third parties; thus, two most obvious solutions are provided to protect information privacy: encryption [3, 16, 26, 31, 38,39,40] and steganography [1, 2]. Encrypting information transforms the information to a noise-like data which is observable but difficult to recover for the attackers. The main problem of encryption is that the result is a noise-like data, telling the attackers almost directly that there is important information here. The steganography technology conceals the existence of secret information by hiding in mundane communication that does not attract unwelcome snooping. In the digital steganography, the secret information is hidden in an ordinary carrier without changing the appearance of the carrier, resulting in other people cannot find which carrier the secret information is hidden in. That is to say, it should be impossible to tell whether a secret message has been added to a carrier by senses or by computer analysis. The general problems of steganography that need to be addressed are: the quality of the steganography, message detectability, payload capacity, and the robustness of the steganography against distortion attacks [2]. In this paper, we consider about the information encryption.

Information is widely divided into text, image, and video information. Among them, the image information is widely used and intuitive and vivid. Chaotic systems are widely used in the field of cryptography because of their inherent ergodicity, randomness, and extreme sensitivity to initial values, which are highly consistent with the requirements of cryptographic systems, especially in image encryption. Various image encryption algorithms are based on chaotic maps, such as the encryption algorithm that combines chaos with DNA coding [22, 32], cellular automata [25, 30], and wavelet transform [5, 7] and the chaotic encryption algorithm [26, 38,39,40]. However, in practical applications, chaotic systems running on devices with finite precision would eventually enter a cycle after multiple iterations due to the effects of truncation and rounding errors, which subsequentially affect the security of encryption algorithms. This is usually called as dynamical degradation of digital chaotic map. The suppression of the dynamic degradation of chaotic systems therefore received extensive attention.

So far, there are many cryptographers proposed different solutions to inhibit such dynamic degradation, which can be divided into the following categories. (1) Using higher precision equipment [12, 31]. This method is the fastest, simplest, and most direct among the proposed approaches. However, even without considering the cost, the precision of the equipment cannot be improved indefinitely. In addition, this method has inherent limitations that cannot be resolved in short term. (2) Disturbing the map [17, 18, 21, 36]. The parameters or state variables of maps can be disturbed to prolong the period and increase the randomness of the generated chaotic sequence. The disturbance source can be selected as a fixed constant, a variable, or a chaotic map. The choice of disturbance source and object is based on the cost constraint and desired effect. However, the effect of the improvement is limited. (3) Switching/ Cascading multiple maps [9, 19, 23]. This method mainly relies on the superiority of the switch or cascading strategy. However, this method does not consider the internal influence that multiple different mappings may cause; and (4) Feedback mechanism [8, 11, 15, 34]. This method uses the state function to control the state variables of the digital chaotic map, which destroys the original state space. However, without the assistance of other methods, this method cannot significantly improve the performance of the digital chaotic map.

The above-mentioned methods have their own advantages and disadvantages. The improvement method proposed in this study is based on the third and fourth methods. We combined two different initial values into the same map to generate two different sequences. Subsequently, we used a nonlinear function to control the difference between the two sequences using state feedback, which enhanced the randomness and complexity of the generated chaotic sequence and suppressed the dynamic degradation of the digital chaotic map.

1D chaotic maps are widely used because of their simple structure, easy implementation, and low cost. We used this kind of maps in the experiment to confirm the effectiveness of the proposed method. The improved methods based on 1D maps could be divided as follows: (1) directly modifying the existing 1D chaotic map to generate a new chaotic sequence; (2) generating a new chaotic sequence using the sum or difference of the output sequences of two 1D sequence chaotic sequences; (3) combining two 1D chaotic maps into a 2D chaotic map; (4) taking the sequence of the 1D chaotic map as the initial values of another 1D chaotic map; and (5) switching among multiple 1D chaotic maps based on the parameters. This paper, we adopted the second improvement method. By bringing two different initial values into the 1D chaotic map, the difference of the sequence would be used as the intermediate output sequence, and then a feedback function would be used to control the intermediate output sequence to obtain the final sequence. 1D Logistic map and x-dimensional of 2D Baker maps are taken as examples. The experimental results show that this method suppressed the dynamic degradation of digital chaotic maps effectively under the condition of limited precision, and the improved maps display good performance.

The remarkable advantages of the improved method are elaborated as follows. (1) The improvement model is universal to all digital chaotic maps. When the map is one dimensional, directly adopt this model. And if the map is high dimensional, apply the model to each dimensional of the HD chaotic map. (2) No additional interference sources are introduced, the map is improved by introducing two different initial values into the same map, and a nonlinear function is used for state feedback control without excessive cost input. (3) The improved map exhibits a good effect and competitiveness with other improved schemes.

A good image encryption algorithm must be able to resist the known/selected plaintext attack. To strengthen the connection between the plaintext and encryption system, most image encryption algorithms calculate the sum of the pixel values of the plaintext image and subsequently update the initial value of the chaotic map using the calculated one [26, 35, 38]. However, this approach is not secure because the attackers can use images with the same sum of pixel values to attack the encryption system. Thus, we also designed a novel key selection method. In the method, a part information of a plain-text image would be selected by a sequence generated by 1D traditional Logistic map. Then use this information to calculate the special value p. Based on the special value, a new encryption algorithm was designed, the p value is used throughout the entire encryption algorithm, such as in updating the initial value of the chaotic map, determining the size of the rectangle for the image preprocess, and calculating the parameter in the row and column permutations. This value is also used to update the initial value of the chaotic map.

The significant advantages of the p value are summarized as follows. (1) On the basis of the sequence generated by the chaotic map, some pixels in the image are randomly selected, and the degree of randomness is high. (2) Using the p value is more secure than just using the pixel sum of the image. (3) For the same image, subtle differences in keys can result in different p values. Hence, cracking the algorithm, without clearly knowing the key is difficult for an unauthorized third party, thereby enhancing the security of the algorithm.

The remainder of this paper is organized as follows. Section 2 introduces the proposed improved model and lists the comparison results of various aspects of the 1D logistic map and x-dimensional of 2D baker map before and after improvements. In Section 3, we proposed a new image encryption scheme that uses part of images as seeds to generate a special value. The performances of the novel image encryption algorithm are discussed in Section 4. The conclusions are provided in Section 5.

2 Proposed model and improved map

This section introduces an improved model to suppress the dynamic degradation of digital chaos. The digital logistic map is used to prove the effectiveness of this method.

2.1 Improvement model

This model is mainly composed of the difference between two maps with the same type but different initial values, x0, y0. The tangent function is used to control the state of digital chaotic map to enhance the randomness and inhibit the degradation of the chaotic dynamics. The mathematical equation is expressed as

$$ x\left(i+1\right)={F}_{chaos}\left(u,{x}_i\right) $$
(1)
$$ y\left(i+1\right)={F}_{chaos}\left(u,{y}_i\right) $$
(2)
$$ z\left(i+1\right)=\frac{\mid \left\lceil x\left(i+1\right)\times {2}^n\right\rceil -y\left(i+1\right)\times {2}^n\mid }{2^n}+k\times \tan \left( PI\times z(i)\right)\kern0.40em \operatorname{mod}\kern0.50em 1 $$
(3)

where Fchaos(∙) represents any one chaotic map, z is the final chaotic sequence generated by the model. And the initial value of sequence z is equal to x0, which means z0 = x0. The tangent function was used to be a feedback function, then the final chaotic sequence z could be obtained by mixing the function values and difference between the maps. The function ⌈x⌉ means the largest integer not greater than (x + 1), and PI = 3.1415926, n is the current computing precision of the equipment, u is the system parameter of the chaotic map, which ranges within [3.6,4), and k is a positive real number, whose value is selected based on the experiment. The concept of this model is universal to all 1D digital chaotic maps or anyone dimension of a HD (higher-dimensional) chaotic map, with minor form modifications. It is also possible to improve each dimension of the HD chaotic map to form a new HD chaotic map.

To better illustrate the effectiveness of this model, we used the 1D Logistic map and x-dimension of 2D Baker map as examples, respectively.

2.2 Improved logistic map

The traditional Logistic map is defined as

$$ x\left(i+1\right)={F}_{chaos}\left(u,{x}_i\right)= ux(i)\left(1-x(i)\right) $$
(4)

Where x(i) ∈ (0, 1) is the state variable after i iterations, and u ∈ (3.6, 4) is the system parameter. And the modified Logistic map after applying the proposed approach is then defined as

$$ \Big\{{\displaystyle \begin{array}{c}x\left(i+1\right)= ux(i)\left(1-x(i)\right)\\ {}y\left(i+1\right)= uy(i)\left(1-y(i)\right)\\ {}z\left(i+1\right)=\frac{\mid \left\lceil x\left(i+1\right)\times {2}^n\right\rceil -y\left(i+1\right)\times {2}^n\mid }{2^n}+k\times \tan \left( PI\times z(i)\right)\kern0.4em \operatorname{mod}\kern0.5em 1\end{array}} $$
(5)

where k value is selected according to the experimental result, there set k = e2.

The parameters are set as follows: n = 15, u = 3.99, the initial values are x0 = z0 = 0.3312, and y0 = 0.5845. If no additional instructions are given, leave these settings unchanged. Several properties of the improved and original 1D Logistic maps are analyzed to evaluate the improvement effect, including the trajectory and phase space, autocorrelation function, sensitivity to initial value, approximate entropy (ApEn), permutation entropy (PE), and iteration steps before entering the period.

2.2.1 Trajectory and phase diagrams

The trajectory of the theoretical chaotic maps does not enter the period, regardless of the number of iterations, and such maps have satisfactory ergodicity in the phase space. However, the result of running on finite precision equipment is not satisfactory. The value remains the same if no special emphasis is present. Figure 1(a) and (b) show the trajectories of the original and improved Logistic maps, respectively. The figures show that the original Logistic map iterates less than 200 times before entering a period. The sequence generated by the improved chaotic map did not enter a cycle despite iterating more than 5000 times. These results indicate that the improvement method does effectively delay the entry of the map into the cycle. Figure 2(a) and (b) show that the phase diagrams of the original and improved maps, respectively. The phase diagram of the original map is a fixed upside-down U with an extremely low density that does not traverse the entire diagram space, whereas that of the improved one has no fixed shape and is much denser than the original. In conclusion, the improved map has better performance, higher security and better randomness than the original one. In addition, the dynamical degradation in the former is inhibited.

Fig. 1
figure 1

Trajectories of the (a) original and (b) improved Logistic maps

Fig. 2
figure 2

Phase diagrams of the (a) original and (b) improved Logistic maps

2.2.2 Autocorrelation analysis

Auto-correlation functions describe the correlation between any two values in a sequence. The autocorrelation of an ideal chaotic map rapidly decays along with the interval in one sequence. Thus, the diagram of the autocorrelation function is similar to that of the δ function. The comparison results when the computing precision n = 16 are showed in Fig. 3. Figure 3(a) displays the auto correlation function of the original map, which decreases with the increase or decrease in the interval and suddenly increases in particular intervals. Figure 3(b) shows the autocorrelation function of the improved map. When the current interval is not zero, the value of the curve is stable and close to zero. The correlation sharply increases when the interval value is zero. The shape of the curve is identical to that of the δ function, which indicates that the improved chaotic map is close to the ideal one.

Fig. 3
figure 3

Autocorrelation function of the (a) original and (b) improved Logistic maps

2.2.3 Period analysis

One of the main manifestations of the dynamic degradation of digital chaotic systems is the entrance of the sequences to a cycle after a certain number of iterations. In this section, we focused on period length and the number of iterations before entering the cycle. Compare the change of period length and iteration steps of 1D Logistic map before and after improvement under different precisions to verify whether the improved map is better than the original one, thus proving the effectiveness of the improvement method. We take the same parameters under different accuracy conditions, generate sequences with length of 500,000, and calculate the num of iteration times before entering the cycle and their period length. The results are showed in the Table 1. These results only come from one experiment under a certain parameter and initial value, rather than the average result brought by many experiments, which cannot represent the overall trend of the whole map. From the table, the effectiveness of the improved method was illustrated.

Table 1 Period length and step length before entering the cycle (Logistic map)

2.2.4 Sensitivity to initial conditions

A good chaotic map is extremely sensitive to subtle changes in initial conditions. The initial conditions include initial values and system parameters. Any small change in these values or parameters will result in a huge difference in the generated sequence. By applying minor modifications to the initial values and parameters, we generated two sequences and compared their trajectories to verify that the improved chaotic map has a good performance and extreme sensitivity to the initial conditions. Figure 4 shows the experimental results under a precision of 2−15. The blue lines in Fig. 4(a)(d) represent the trajectory of the improved chaotic mapping within 50 iterations under certain conditions; Fig. 4(a)(d) show the comparison of the sequence curve after the slight modification of u, x and y, and the sequence curve before the parameter change. The results show that even a slight alteration can cause a complete change in the sequences.

Fig. 4
figure 4

Sensitivity analysis of the initial condition (a) curve at u = 3.99, x = 0.3312, y = 0.5845; (b) curves at u = 3.99 and u = 3.99 + 2−15; (c) curves at x = 0.3312 and x = 0.3312 + 2−15; (d) curves at y = 0.5845 and y = 0.5845 + 2−15

2.2.5 Complexity analysis

ApEn and PE are scalars that are commonly used when evaluating the complexity of a chaotic map. ApEn measures the probability of the new pattern generated in the sequences using growing embedding dimensions [28]; the larger the probability, the more complex the sequence. PE [4], compares the sizes of several consecutive values in the sequence and adds the different order types. Shannon’s entropy is then used to measure the uncertainty of these orders. The PE of an ideal random sequence should be close to 1. Set the initial values are x0 = z0 = 0.4312, and y0 = 0.5845, and the test result diagrams shown in Figs. 5 and 6 are used for the analysis. From the figures, it’s obvious that the ApEn and PE values of the improved map are greater than those of the original one. And the ApEn value of the improved map after stabilization is much higher than that of the original map. The PE value of the improved map closer to ideal value 1.

Fig. 5
figure 5

Approximate Entropy analysis under different precisions

Fig. 6
figure 6

PE analysis under different precisions

2.3 Improved baker map

As one of the common 2D digital chaotic maps, Baker map is expressed as follows:

$$ \left({x}_{i+1},{y}_{i+1}\right)=\Big\{{\displaystyle \begin{array}{c}\left(\frac{x_i}{p},p{y}_i\right),\kern0.96em 0<{x}_i\le p\\ {}\left(\frac{x_i-p}{1-p},\left(1-p\right){y}_i+p\right),\kern0.48em p<{x}_i\le 1\end{array}} $$
(6)

Where p ∈ (0, 1) is the system parameter. We selected x-dimensional of Baker chaotic map as example to prove the effectiveness of the improvement method and the generality in all 1D maps or one dimension of a HD map. The x-dimensional of Baker chaotic map could be described as:

$$ {x}_{i+1}=\Big\{{\displaystyle \begin{array}{c}\frac{x_i}{p},\kern1.2em 0<{x}_i\le p\;\\ {}\frac{x_i-p}{1-p},\kern0.6em p<{x}_i\le 1\end{array}} $$
(7)

Thus, the modified x-dimensional of Baker map would be expressed as.

$$ {\displaystyle \begin{array}{c}x\left(i+1\right)=\Big\{\begin{array}{c}\frac{x(i)}{a},\kern0.84em 0<x(i)\le a\\ {}\frac{x(i)-a}{1-a},a<x(i)\le 1\end{array}\\ {}y\left(i+1\right)=\Big\{\begin{array}{c}\frac{y(i)}{a},\kern0.84em 0<y(i)\le a\\ {}\frac{y(i)-a}{1-a},a<y(i)\le 1\end{array}\\ {}z\left(i+1\right)=\frac{\mid \left\lceil x\left(i+1\right)\times {2}^n\right\rceil -y\left(i+1\right)\times {2}^n\mid }{2^n}+k\times \tan \left( PI\times z(i)\right)\kern0.4em \operatorname{mod}\kern0.5em 1\end{array}} $$
(8)

where a ∈ (0, 1) is the system parameter, and PI = 3.1415926, and set k = 6. The same experimental methods as in Section 2.2 is used to compare the classical and modified x-dimensional of Baker map. The parameters are set as follows: n = 12, a = 0.6, the initial values are x0 = z0 = 0.3312, and y0 = 0.5845. If no additional instructions are given, leave these settings unchanged. In this experiment, we only analyze the x-dimensional of Baker map.

Figure 7 (a) and (b) showed the trajectories of the classical and modified map. From the figure, it’s clear that the improvement method does extend the time for the generated sequence to enter the cycle. The phase diagram analysis is showed in Fig. 8 (a) and (b). In this experiment, we plot by using xi and xi + 1 to depict the attractor complexities. As shown in Fig. 8 (a) and (b), the modified map has more complicated attractor than its classical counterpart. After the improvement, the phase diagram points of the map are discretized and the density is higher. These results fully demonstrate the effectiveness of our improved method.

Fig. 7
figure 7

Trajectories of the (a) original and (b) improved x-dimensional of Baker maps

Fig. 8
figure 8

Phase diagram analysis of the (a) original and (b) improved x-dimensional of Baker maps

Next, we calculate the num of iteration times before entering the cycle and their period length. Set x0 = z0 = 0.4312. The results are showed in the Table 2. From the table, we can conclude that the improvement method does extend the period length and the iteration times before entering a cycle. What’s more, when the accuracy exceeds 2−12, the x-dimension of the improved Baker map cannot measure the period. Again, the results of this experiment are derived from the experimental data under a certain parameter condition, which can only represent a certain situation. And the results could only be used to prove that the improved method is effective and the improved map has a longer cycle and iteration times than that before the improvement.

Table 2 Period length and step length before entering the cycle (x-dimensional of Baker map)

The ApEn and the PE analysis for two maps are plotted as Figs. 9 and 10, respectively. From the two figures, it’s clear that under the same computing precision the ApEn and PE values of improved x-dimensional of Baker map are much larger than the original ones. And the PE value of improved map are closer to ideal value, 1. These proved that the capability of the proposed approach in enhancing the complexity of the classical x-dimensional of Baker map on a finite precision machine. As Fig. 11 showed, the improved map remains the sensitivity to initial conditions. Under the computing precision of 2−12, the initial condition is only 2−12 apart, resulting in a complete separation of the two curves.

Fig. 9
figure 9

Approximate Entropy analysis of the (a) original and (b) improved x-dimensional of Baker maps

Fig. 10
figure 10

Permutation Entropy analysis of the (a) original and (b) improved x-dimensional of Baker maps

Fig. 11
figure 11

Sensitivity analysis of the initial condition (a) curve at u = 3.99, x = 0.3312, y = 0.5845; (b) curves at u = 3.99 and u = 3.99 + 2−12; (c) curves at x = 0.3312 and x = 0.3312 + 2−12; (d) curves at y = 0.5845 and y = 0.5845 + 2−12

All the above results not only prove the effectiveness of the improved method, but also prove its universality to digital chaotic maps. And then we designed a new encryption algorithm based on the improved digital logistic map and a new key selection method.

3 New cryptosystem based on the improved digital logistic map

We proposed a new image encryption algorithm with partial plaintext images as the seed information based on the improved map. This algorithm is applicable to grayscale and colored images. For the convenience of description, the encryption of the grayscale image is considered as an example here. If it is a colored image, it only needs to be divided into three channels. After encrypting each channel, the final colored ciphertext image can be obtained through the XOR operation.

3.1 Secret key structure and the key selection method

As shown in Fig. 12, the secret key of the proposed cryptosystem comprises four parts, namely, system parameter u∈(3.6,4), initial values x and y∈(0,1), and the special value of the image p∈(0,1). The special value, p, is derived from plaintext image, which strengthens the correlation between cipher text system and plaintext image. Moreover, this method is more effective than simply calculating the average pixel value of the plaintext image. Only by calculating the average pixel value of the plaintext image to enhance the ability to resist plaintext attacks is not secure. Because it could be attacked by different images of the same pixel sum, thus cracking the encryption algorithm. However, our method relies on chaotic map to randomly select some pixels of the image, and even a slight difference in the secret key will result in different points being selected from the plaintext image. So only if you have the correct key and special value can you get a plaintext image correctly.

Fig. 12
figure 12

Secret key structure of the image

Next, the steps to generate the special value p are described in detail. Assume the plain image is represented by P and its size is set as M × N.

First, the original 1D Logistic map is used to generate two sequences of length a, {pxi} and {pyi}, where i = 1,2,3, …, a. a = round(min (M, N)/5), function min(M, N) represents the smaller value between M and N, and round(∙) means round to get an integer. The initial values are px(0) = x and py(0) = y.

$$ {\displaystyle \begin{array}{c} px\left(i+1\right)=u\times px(i)\times \left(1- px(i)\right)\\ {} py\left(i+1\right)=u\times py(i)\times \left(1- py(i)\right)\end{array}} $$
(9)

Second, the two sequences {pxi} and {pyi} are converted into integer sequences {pXi} and {pYi}, respectively. Where n represents the current computing precision.

$$ {\displaystyle \begin{array}{c}p{X}_i= ceil\left( px\left(i+1\right)\times {2}^n\right)\kern0.8000001em \operatorname{mod}\kern0.8000001em M\\ {}p{Y}_i= ceil\left( py\left(i+1\right)\times {2}^n\right)\kern1.2em \operatorname{mod}\kern0.8000001em N\end{array}} $$
(10)

Third, the two integer sequences are processed to form a sequence {Z} = {(pX1, pY1), (pX2, pY2), …, (pXi, pYi), …, (pXa, pYa)}. The corresponding points in image P of each pair of values in this sequence (coordinates) are obtained and the total value SUM is obtained through summation.

$$ SUM=P\left(p{X}_1,p{Y}_1\right)+P\left(p{X}_2,p{Y}_2\right)+\dots +P\left(p{X}_a,p{Y}_a\right) $$
(11)

Fourth, the value of sequence {zi| i = 1, 2, …, a} is calculated. Before this calculation, the value of SUM is used to obtain the dire value, which was used to select corresponding computational equation.

$$ {\displaystyle \begin{array}{c} dire= SUM\operatorname{mod}3\kern0.6em +\kern0.6em 1\\ {}z(i)=\Big\{\begin{array}{c}P\left(p{X}_i,p{Y}_i\right)\kern0.7em \oplus \kern0.6em P\left(p{X}_i+1,p{Y}_i\right),\kern1.66em if\kern0.4em dire=1\\ {}P\left(p{X}_i,p{Y}_i\right)\kern0.7em \oplus \kern0.6em P\left(p{X}_i,p{Y}_i+1\right),\kern1.66em if\kern0.4em dire=2\\ {}P\left(p{X}_i,p{Y}_i\right)\kern0.9000001em \oplus \kern0.6em P\left(p{X}_i+1,p{Y}_i+1\right),\kern1.32em if\kern0.4em dire=3\end{array}\\ {}\end{array}} $$
(12)

Finally, the special value p of the image P is obtained as

$$ p=\frac{\sum \limits_{i=1}^az(i)}{a}\operatorname{mod}1 $$
(13)

where sum(•) represents the cumulative sum of this sequence. The above expression is the calculation for the p value, which is then used as a part of the secret key.

3.2 Image encryption and decryption algorithms

P is a plain grayscale image with a size of M × N. The reasons for using grayscale images have already been discussed in a previous section and will not be repeated here. For the plain image P, we first calculated the p value using the method described in Section 3.1. Subsequently, we started the encryption algorithm step and used the grayscale Lena image as an example.

  • Step 1: Preprocessed plain-text image P. Using the p value, a rectangle with a size of L1 × L2 is selected from the plaintext image for processing. Obtain L1, L2 value by using p value, the equation could be described as follow:

$$ {\displaystyle \begin{array}{c}L1=\Big\{\begin{array}{c} round\left(p\times M\right),\kern1.2em 0<p<0.5\\ {} round\left(\left(1-p\right)\times M\right),\kern0.48em 0.5<p<1\end{array}\\ {}L2= round\left(p\times N\right)\end{array}} $$
(14)

In the rectangle, each element in the ith row is XORed with the corresponding element in the (i + L1)th row, and the preprocessed image is obtained. Put it in mathematical form as follow:

$$ P\left(i,j\right)=P\left(i,j\right)\oplus P\left(i+L1,j\right)\kern0.90em 1\le i<L1,1\le j<L2 $$
(15)

The rectangle can be taken from anywhere in the image, but for simplicity, the rectangle is extracted from the upper left corner. Finally, the preprocessed image A would be obtained. For example, the images before and after the preprocessing are shown in Figs. 13 (a) and (b).

Fig. 13
figure 13

Images (a) before and (b) after preprocessing

  • Step 2: The p value is also used to update the initial value x and y.

$$ {\displaystyle \begin{array}{c}x=\left(x+p\right)\operatorname{mod}1\\ {}y=\left(y+p\right)\operatorname{mod}1\end{array}} $$
(16)

The initial conditions u, the updated value x and y are introduced to the improved chaotic map to generate a chaotic sequence {s} = {s1, s2, s3, …, sM × N}. Obtain sorted sequence {sorder} by ranking the sequence from smallest to largest, keeping the index the same.

The processed image A is scanned from top to bottom and from left to right to obtain a 1D sequence {A}. And then the index order {r1, r2, …, rM × N} of sequence {sorder} is used to scramble the sequence {A}, which was described as follow:

$$ \left\{{s}_{order}\right\}=\left\{{s}_{r1},{s}_{r2},{s}_{r3},\dots, {s}_{rM\times N}\right\} $$
(17)
$$ \left\{{A}_{order}\right\}=\left\{{A}_{r1},{A}_{r2},{A}_{r3},\dots, {A}_{rM\ast N}\right\} $$
(18)
  • Step 3: The sorted sequence {Aorder} is transformed from top to bottom and left to right into a 2D matrix Aorder.

  • Step 4: Sequence {s} is also used to calculate the parameters as

$$ {D}_{rx}(i)= round\left(s(i)\ast p\ast {10}^6\right)\kern0.40em \operatorname{mod}\kern0.30em 255+1,1\le i\le M $$
(19)
$$ {D}_r(i)= round\left(s(i)\ast p\ast {10}^6\right)\kern0.40em \operatorname{mod}\kern0.30em N,1\le i\le M $$
(20)
$$ {D}_{cy}(j)= round\left(s\left(M+j\right)\ast p\ast {10}^6\right)\kern0.40em \operatorname{mod}\kern0.30em 255+1,1\le j\le N $$
(21)
$$ {D}_c(j)= round\left(s\left(M+j\right)\ast p\ast {10}^6\right)\kern0.40em \operatorname{mod}\kern0.30em M,1\le j\le N $$
(22)

Where Drx(i) ∈ [1, 255], Dr(i) ∈ [0, N − 1] are used for row substitution and row shift, respectively, and then Dcy(j) ∈ [1, 255], Dc(j) ∈ [0, M − 1] are used to perform column substitution and column shift, respectively.

  • Step5: Perform row substitution and row shift with Drx(i) and Dr(i). XOR operation is conducted on the ith row pixels Aorder(i,:) and the encrypted row pixels are determined as

$$ B\left(i,:\right)={A}_{order}\left(i,:\right)\oplus {D}_{rx}(i),1\le i\le M $$
(23)

Subsequently, Dr is used to perform the circular shift, which represents the number of steps moved. If the number is odd, the ith encrypted B(i,:) is shifted toward the left; otherwise, the shift is directed toward the right.

  • Step 6: For i = i + 1, step 5 would be repeated in a loop until i > M; matrix B represents the image after the row permutation.

  • Step7: Perform column substitution and column shift with Dcy(j), Dc(j). XOR operation is conducted on jth column pixels B(:, j), and the encrypted column pixels are determined as

$$ C\left(:,j\right)=B\left(:,j\right)\oplus {D}_{cy}(j) $$
(24)

Dc(j) is used to perform the circular shift. If the number is odd, circular the j-th encrypted C(:, j) is shifted upward; otherwise it is shifted downward.

  • Step 8: For j = j + 1, step 7 would be performed in a loop until j > N.

  • Step 9: The encrypted image C is obtained after the row and column permutation. We transformed the sequence {s} to the 2D matrix S. Then, XOR operation is conducted and the final encrypted image E is obtained as

$$ E=S\oplus C $$
(25)

The flow chart of the entire encryption process is illustrated in Fig. 14.

Fig. 14
figure 14

Flowchart of the encryption process

The decryption process is the reverse of the encryption process. The value of p is passed to the recipient as part of the secret keys. The flowchart of the decryption process is shown in the Fig. 15.

Fig. 15
figure 15

Flowchart of the decryption process

3.3 Simulation results

In order to illustrate the universality and practicability of this encryption algorithm, we used 10 different images for experiments. However, due to space limitation, we only show the results of three images here. The precision is set to as 15 and the initial conditions are established as follows: u = 3.99, x = 0.3312, and y = 0.5845. The p value of each figures is calculated respectively and the encryption steps are subsequently performed to encrypt the plaintext images. Figure 16 shows the simulation results.

Fig. 16
figure 16

(a) plain-text image (b) encrypted image (c) decrypted image of Lena image; (d) plain-text image (e) encrypted image (f) decrypted image of Rice image; (g) plain-text image (h) encrypted image (i) decrypted image of Cameraman image

From Fig. 16, it’s obvious that the encrypted image no longer provides information on the plain image, and the correct decrypted image is the same as the plain image.

4 Performance analysis and comparison

4.1 Key space

The size of the key space of the encryption algorithm directly affects the ability of the algorithm to resist brute force attacks. Under similar conditions, the larger the key space, the stronger the ability of the encryption algorithm to resist brute force attacks and the more secure the algorithm will be. The keys in the proposed method are divided into four parts (u, x, y, p), where u ∈ (3.6, 4), x, y, p ∈ (0, 1). In general, the key space of a secure encryption algorithm should be larger than 2128. The proposed key space is 0.4 × 1015 × (1 × 1015)3 = 0.4 × 1060 ≈ 0.4 × 2189.7 > > 2128, with an accuracy of 15. This space is larger than those obtained in previous studies (i.e., 1056 [13], 1045 [33], 1057 [14], and 1053 [37]). In conclusion, the proposed algorithm can effectively resist brute force attacks.

4.2 Histogram analysis

The histogram shows the distribution of the pixel intensity values of the images. The image with an uneven distribution of histogram can be easily cracked by statistical attacks. A good encryption algorithm has an encrypted image that does not show any information and a uniformly distributed histogram. In addition, the histogram of the decrypted image should be consistent with that of the original image. The experiment results are showed as Figs. 17, 18 and 19. The results show that the histogram distribution of the original image is extremely uneven, thereby exposing the information distribution of the image. Conversely, the histogram distribution of the ciphertext image is uniformly distributed, which cannot be easily cracked by statistical attacks. The histogram of the decrypted image is consistent with that of the original image. As previously established, the proposed algorithm satisfies the requirements of a good encryption algorithm.

Fig. 17
figure 17

Histogram diagrams of the (a) plain, (b) encrypted, and (c) decrypted Lena images

Fig. 18
figure 18

Histogram diagrams of the (a) plain (b) encrypted and (c) decrypted Rice images

Fig. 19
figure 19

Histogram diagrams of the (a) plain (b) encrypted and (c) decrypted Cameraman images

4.3 Correlation analysis

The most challenging aspect of image encryption is the strong correlation between adjacent pixels. If this problem is not solved, the security of the encryption algorithm will be greatly reduced. The correlation of two adjacent pixels is defined as

$$ {\rho}_{xy}=\frac{\sum_{i=1}^G\left({x}_i-E(x)\right)\left({y}_i-E(y)\right)}{\sqrt{\sum_{i=1}^G{\left({x}_i-E(x)\right)}^2{\sum}_{i=1}^G{\left({y}_i-E(y)\right)}^2}} $$
(26)

where x and y are two adjacent pixel points, G is the sample counts, \( E(x)=\frac{1}{N}{\sum}_{i=1}^G{x}_i \), and \( E(y)=\frac{1}{N}{\sum}_{i=1}^G{y}_i \). A total of 10,000 pairs of adjacent pixels were taken from the horizontal, vertical, and diagonal directions of the images before and after encryption, and the correlation among them was calculated. The correlation between the adjacent pixels of the Lean image is strong in any of the three directions (Fig. 20(a)- (c)). However, Fig. 20(d)- (f) show that the correlation between the adjacent pixels of the ciphertext image broken and exhibits a discrete distribution. The experimental results of other two example images (Rice image and Cameraman image) are the same. However, due to the space limitation of the paper, we only show the adjacent pixel distribution of the encrypted image here (Figs. 21 and 22).

Fig. 20
figure 20

Distribution of the adjacent pixels: (a) horizontal (b) vertical (c) diagonal directions of the plain Lena image and (d) horizontal (e) vertical (f) diagonal directions of the encrypted Lena image

Fig. 21
figure 21

Distribution of the adjacent pixels: (a) horizontal (b) vertical (c) diagonal directions of the encrypted Rice image

Fig. 22
figure 22

Distribution of the adjacent pixels: (a) horizontal (b) vertical (c) diagonal directions of the encrypted Cameraman image

Table 3 presents the comparison of the correlation coefficients of the proposed encryption algorithm with those of other algorithms. The comparison results show that the proposed algorithm is competitive.

Table 3 Correlation coefficients of different algorithms

4.4 Key sensitivity

Key sensitivity is the degree of the changes in the result when the key is slightly changed during the encryption process. A small change in the keys can result in a completely different encrypted image. The satisfactory image encryption algorithm should demonstrate outstanding key sensitivity. To investigate the key sensitivity of the proposed algorithm, we slightly modified u, x, and y and then calculated the mean square error (MSE) between the ciphertext image generated by the modified key and the original ciphertext image.

$$ MSE=\frac{1}{R}{\sum}_{i=1}^R{\left({y}_i-{x}_i\right)}^2 $$
(27)

where R = M × N. The ciphertext image generated by the modified key is compared with each element of the original ciphertext image. The calculated MSE value of Lena image is shown in Fig. 23. Except for the difference value of 0, in other cases, the MSE value of the changed and original ciphertext images is extremely large regardless if the change is applied to u, x, or y. The results of other two sample images show the same trend, which are not shown here due to space limitations. This finding implies that the proposed encryption algorithm is extremely sensitive to the key.

Fig. 23
figure 23

MSE of (a) u, (b) x, and (c) y

4.5 Information entropy analysis

Information entropy is used to measure the randomness of information. The greater the information randomness, the greater the entropy and the more information is needed for clarification. The maximum information entropy for a 256 × 256 grayscale image is 8.

$$ H(u)={\sum}_{i=1}^Wp\left({u}_i\right)\log \frac{1}{p\left({u}_i\right)} $$
(28)

where u represents a message source, W is the total number of symbols, and p(ui) is the probability of symbol ui [10]. The results of the different algorithms are listed in Table 4. The results reveal that the information entropy of the proposed method is extremely close to the ideal value 8, compared with other methods, which indicates that the proposed algorithm is competitive.

Table 4 Information entropy of different algorithms

4.6 Analysis of the resistance to differential attacks

A differential attack is an effective and the most common mode of attack. In general, the values of the number of pixel change rate (NPCR) and unified average changed intensity (UACI) are used to evaluate the ability of an encryption algorithm to resist differential attacks. The calculation formula of NPCR and UACI are expressed as

$$ NPCR\left(C1,C2\right)={\sum}_{i=1}^M{\sum}_{j=1}^N\frac{\mid \mathit{\operatorname{sign}}\left(C1\left(i,j\right)-C2\left(i,j\right)\right)\mid }{MN} $$
(29)
$$ UACI\left(C1,C2\right)={\sum}_{i=1}^M{\sum}_{j=1}^N\frac{\mid C1\left(i,j\right)-C2\left(i,j\right)\mid }{MNF} $$
(30)

where M and N are the length and width of the image, respectively, C1 and C2 represent two different images with the same size, F is the largest allowed pixel value in the images, and sign(∙) is the symbol function. If C1(i,  j) = C2(i,  j), then |sign(∙)∣ = 0; otherwise, |sign(∙)∣ = 1. In addition, M = N = 256 and F = 255. The ideal values of NPCR and UACI are 0.9961 and 0.3346, respectively. In this experiment, the difference between the two images is only one pixel, and the value of this pixel only differs by 1.

Table 5 presents the NPCR and UACI values of different algorithms for the sample image. The values of the proposed method are close to the ideal ones. Therefore, the proposed algorithm is competitive compared with the other ones.

Table 5 NPCR and UACI values of different algorithms

4.7 Robustness analysis against data-loss and noise attacks

The encrypted image must be transmitted to the receiver. The image information is extremely vulnerable to various attacks or influences during the transmission process, which results in partial loss of data or overlaying of noise on the image. An ideal encryption algorithm can decrypt the ciphertext image to the correct image when former is affected. The decrypted image may not be perfect, but it must have the ability to see the general information of the original image. The test results of data-loss attack are shown in Figs. 24 and 25. The ciphertext images can be correctly decrypted despite the different levels of data loss attacks. And Figs. 26 and 27 shows the three images experimental results under different kinds of noise attacks. Most parts of the original image can be seen despite the slight flaws, which proves the ability of the proposed encryption algorithm to resist robust attacks.

Fig. 24
figure 24

Robustness against occlusion attacks: encrypted Lena image with (a) 0.01 data loss, (b) 0.1 data loss, and (c) 0.2 data loss; decrypted Lena image with (d) 0.01 data loss, (e) 0.1 data loss, and (f) 0.2 data loss

Fig. 25
figure 25

Robustness against occlusion attacks: decrypted Rice image with (a) 0.01 data loss, (b) 0.1 data loss, and (c) 0.2 data loss; decrypted Cameraman image with (d) 0.01 data loss, (e) 0.1 data loss, and (f) 0.2 data loss

Fig. 26
figure 26

Robustness against noise attacks: encrypted Lena image with (a) 0.2 salt and pepper noise, (b) 0.02 speckle noise, and (c) 0.02 Gaussian noise; decrypted Lena image with (d) 0.2 salt and pepper noise, (e) 0.02 speckle noise, and (f) 0.02 Gaussian noise

Fig. 27
figure 27

Robustness against noise attacks: decrypted Rice image with (a) 0.2 salt and pepper noise, (b) 0.02 speckle noise, and (c) 0.02 Gaussian noise; decrypted Cameraman image with (d) 0.2 salt and pepper noise, (e) 0.02 speckle noise, and (f) 0.02 Gaussian noise

4.8 Speed analysis

A good encryption algorithm must not only have good performance, but also have a fast enough encryption speed to be practical. There some studies claim that traditional encryption is faster than chaotic encryption for images, such as [29]. Thus, we take the speed analysis here. The encryption speeds of different schemes are shown in Table 6. These results indicate that our algorithm is competitive for practical use.

Table 6 Speed analysis of different algorithms

5 Conclusion

In this study, a novel improvement model is proposed to suppress the dynamical degradation of digital chaotic map and a new image encryption scheme is designed. Two chaotic maps with the same type but different initial values are used as the difference, and a nonlinear function is used as feedback function to affect the previously obtained difference, then degradation of the chaotic dynamics was suppressed. A 1D Logistic map and x-dimensional of 2D Baker map are taken as examples to improve the effectiveness of the proposed improvement model. What’s more, a new key selection method is proposed. In the method, part information of plain-text image would be selected by the sequence generated by a chaotic map, which resulting in the randomness of the selection of the part information. The special value p would be obtained by using the selected pixels. A slight change in the key will result in different selected pixels, resulting in different special values. Then based on this selection method, a new image encryption was proposed. The p value was used to update the initial value of the encryption algorithm. What’s more, the p value is applied throughout the entire encryption algorithm, which increase the correlation between plain-text image and encryption algorithm, resulting in high resistance to plain-text attacks. For the same image, determining the correct p value is difficult if the key is unknown. Consequently, cracking the encryption algorithm is challenging, which signifies that the security of the algorithm is improved. The effectiveness of the model and encryption algorithm is verified by comparing the sequences produced by the improved and original maps and testing the ciphertext image generated by the encryption algorithm. All results show that the improved model and the proposed encryption algorithm exhibit good performance in all aspects, as well as certain competitiveness compared with other algorithms, especially when the precision is low. In future, it may be considered to introduce neural network to perturb the improved model so as to greatly improve the effect of suppressing the dynamical degradation of digital chaotic map or introducing the Hopfield chaotic neural network to generate the self-diffusion chaotic matrix so as to increase the security of image encryption algorithm.