# An Image Encryption Algorithm Based on the Improved Sine-Tent Map

Authors: Zijing Gao; Zeyu Liu; Lichan Wang
Journal: Discrete Dynamics in Nature and Society
 (2021)

---

## Abstract

This paper makes use of the characteristics of initial sensitivity and randomness of the chaotic map to design an image encryption algorithm based on the sine map and the tent map. The sine map is used to improve the tent map; then, the improved sine-tent map is proposed. The traditional tent map proposed in this paper has an expanded control parameter range and better chaos. In this algorithm, bit rearrangement is adopted to further improve the improved sine-tent map, which can reconstruct the output value and expand the chaotic characteristics of the map. In this algorithm, the image parameters are connected with the algorithm to generate the key. In the encryption step, a method of replacing the most significant bit and scrambling-diffusion algorithm is designed to encrypt the plaintext image. Finally, the algorithm is simulated with the experiment and evaluated with analysis; then, the experimental results are given. The evaluation results show that the ciphertext of the algorithm has high randomness, strong robustness, and better resistance to differential attacks after comparison. The correlation of the ciphertext image pixels is very low, and the algorithm is highly secure as a conclusion.


---

## Body

## 1. Introduction

An algorithm for image encryption is proposed in this paper. As is all known, image is one of the most widespread forms of multimedia, and it plays a really important role in people’s lives. It also has an extensive application requirement in all walks of life. In people’s daily lives, images can easily reveal personal privacy, and images have high confidentiality requirements in some special fields, so it is very important to encrypt images. Today, most images are stored and displayed in the form of digital images, so the encryption method of digital images has also been extensively studied in secure communication [1–6].Digital images are stored in a matrix. Essentially, they are a group of two-dimensional sequences. Encrypting digital images is hiding the information carried in these two-dimensional sequences, so that the attackers cannot read it. However, the image encryption algorithm is different from the traditional encryption algorithm, because image encryption needs to meet high computation efficiency and avoid information loss at the same time. Due to the inherent characteristics of the image, such as high redundancy, large amount of data, strong correlation between adjacent pixels, and real-time transmission, some classic algorithms such as the RSA algorithm will be computationally expensive when encrypting the image. They are difficult to perform image encryption work [7]. In this paper, the algorithm is designed by chaotic systems, and the evaluation results show that it can perfectly solve these problems.Chaos refers to the determinism that appears in nonlinear dynamic systems, similar to random processes. These processes are neither periodic nor convergent and have an extremely sensitive dependence on initial values. In daily life, chaos always appears in casual places. Since R. Matthews proposed an encryption algorithm by chaos in 1989 [8], these encryption algorithms have gradually come into people’s field of vision nowadays. In cryptography, the randomness and initial sensitivity of chaotic maps are mainly used. Nowadays, it shines in the field of information security, and encryption algorithms based on the chaotic map are also constantly being proposed.Literature [9] proposed a bit embedding based on the chaotic tent map as a novel multicore implementation of the steganography algorithm. Literature [10] used the obfuscation phase to scramble the pixel position; the diffusion phase to continuously change the pixel content; the introduction of Arnold’s cat map to perform the obfuscation operation; and a reasonable combination of the sine map, logistic map, and the tent map to realize the principle of diffusion. In addition, exclusive OR (XOR), exchange, and transformation operations are used to improve the efficiency of the diffusion stage. Literature [11] proposed a cellular automaton based on the tent map, which uses different key streams to encrypt a single block. In the subsequent steps, the bytes of the encrypted block thus obtained are further shuffled to make the scheme more distributed. Literature [12] proposed a two-dimensional chaotic system structure based on the sine transformation based on the good nonlinear performance of the sine function, which can generate a variety of chaotic systems. When a digital chaotic system is implemented on hardware with limited computational precision, it will lead to short-period orbits. Although many existing image encryption algorithms state that the average period length of their digital chaotic system is greater than the period length required for image encryption, there are still many periodic tracks whose length is much smaller than the average period length. Literature [13] designed an improved cryptosystem based on a 2D-SCL map. It combined the confusion and diffusion process in one stage to increase the speed of operation. Based on the SHA-1 hash value and chaotic sequence of the plane graph, a pseudorandom sequence is designed, and an antidegradation method is introduced to resist the dynamic degradation of the 2D-SCL graph under limited calculation accuracy. Banu et al. [14] studied an encryption algorithm based on integer wavelet transform (IWT) combined with deoxyribonucleic acid (DNA) and chaos to secure digital medical images. The proposed work will be composed of two phases: a two-stage shuffling phase and a diffusion phase. The first step of shuffling starts with initial block confusion followed by the column and row shuffling of pixels as the second stage. Consequently, the algorithm security is greatly increased.The contributions of this paper are summarized as follows: (i) this paper proposed and improved a chaotic map based on the sine map and the tent map, called the improved sine-tent map. For the traditional tent map, the improved sine-tent map proposed in this paper has an expanded control parameter range. (ii) It designed a bit rearrangement method to improve chaotic system behavior and good properties. (iii) It designed a scrambling-diffusion algorithm, which is suitable for image encryption. The remaining parts of this paper are organized as follows. In Section2, the prerequisite knowledge will be introduced, and the improved sine-tent map will also be proposed. Then, there is a method designed to improve the improved sine-tent map. In Section 3, the specific steps of encryption are designed for the algorithm and we implement them to realize the encryption of the image and prove the feasibility of the technology. Then, Section 4 mainly describes how to put forward the decryption algorithm based on the encryption algorithm. We will verify the technology through experimental simulation, effectiveness, and practicality by calculating a series of indices in Section 5. The remaining section is the conclusion.


## 2. Preliminaries and Proposal of an Improved Chaotic Map

### 2.1. Lyapunov Index

Chaotic systems have many basic characteristics, which are mainly manifested as nonperiodic, randomness, and extreme sensitivity of the system to initial values. The sensitivity of the initial value is mainly manifested as the trajectory produced by the change of two initial values with little difference over time, which is gradually separated exponentially with the passage of control parameters. Among them, the Lyapunov exponent is the parameter used to describe this phenomenon [15]. In other words, it can judge whether the system is chaotic. The important parameters for judging the stability of a system can be visually observed by judging the Lyapunov exponent. Its principle is to measure the state of a system by measuring the rate of convergence or separation of adjacent trajectories, which are expressed as the average rate of divergence or convergence of adjacent trajectories in phase space. The lower the exponent is, the more stable the system is. If the control parameter is at a certain point, the exponent is positive. If the system is chaotic, no matter how small the initial distance between the two trajectories is, the difference will increase exponentially over time to the point of being unpredictable and forming a chaotic phenomenon.The calculation methods of Lyapunov exponents are usually divided into two categories. One is the solution method based on the differential equation, and the other is the calculation method based on the motion trajectory. It has two important parameters: the embedding dimensionm and time lag T. Since there are m spatial dimensions, there are m Lyapunov exponents [16, 17]. The largest exponent can determine the magnitude of local stability. When studying dynamic systems in this paper, bifurcation graphs and Lyapunov exponents will be studied at the same time to analyze the chaotic phenomena of the system. The formula for calculating the Lyapunov exponent is(1)λ=limn⟶∞∑k=0n−1logdSdxxk.Among them,S is a chaotic map. In this paper, the Jacobi matrix method is used to calculate the improved sine-tent map with (2)xn+1=g1xn,yn,yn+1=g2xn,yn.Its Jacobi matrix is(3)J=∂g1∂xn∂g1∂yn∂g2∂xn∂g2∂yn.And then, there are initial valuesx0 and y0, and the small difference is ∂x0 and ∂y0. After n iterations, it can create x0,y0,x1,y1,…,xn,yn. Then, these n Jacobi matrices are expressed as(4)Jn=Jxn,yn.Making QR decomposition of these matrices, getJn,Jn−1,…,J1. Each entry on the diagonal of R is the product of all entries on the diagonal of Ri. In other words, the approximate value of the Lyapunov exponent can be obtained by the following formula:(5)λk=1n∑i=1nlnRik⋅k,k=1,2.


### 2.2. The Sine Map

The sine map is a classic chaotic map derived from the sine function. It converts the input angle into a certain angle and then outputs it. Sine map’s mathematical expression is defined as(6)xn+1=Sx=asinπx.In formula (6), the map is expressed as (x), and a is the control parameter. Its bifurcation graph and Lyapunov exponent graph are shown in Figure 1.Figure 1
Dynamic behavior of the sine map: bifurcation diagram (a) and Lyapunov exponent graph (b) of the sine map.
(a)(b)


### 2.3. The Tent Map

The tent map is a segmented linear map which is widely used in image encryption systems. The tent map appears as a chaotic map within the value range of the control parameters, which has a uniform distribution function and a good correlation. The mathematical model of the tent map is defined as follows:(7)xn+1=Sx=xna,xn=0,a,1−xn1−a,xn=a,1.The tent map’s expression can be transformed into the following formula:(8)xn+1=a−1+axn,a=0,1,xn=−1,1.Among them, (x) is the map, a is the control parameter, and the value range of a is 0 < a < 1. When a = 0.5, the system presents a short-period state. And the initial value cannot be equal to the control parameter; otherwise, let the system present a periodic state [18]. Its bifurcation diagram and Lyapunov exponent plot are shown in Figure 2.Figure 2
Dynamic behavior of the tent map: bifurcation diagram (a) and Lyapunov exponent graph (b) of the tent map.
(a)(b)


### 2.4. The Improved Sine-Tent Map

Through the study of the tent map and the sine map, this paper found that the tent map only produces chaos within the parameter value range, and the control parametera only has a value range of 0 < a < 1, so this paper uses the sine map to perform the tent map. We use the sine map to replace x on the right side of the equation in the tent map to get the following formula:(9)xn+1=a−1+asinπxn.As shown in Figure3, analyzing its dynamic behavior, it is obvious that the map has a large range of chaos, and it can be seen that when the bifurcation phenomenon occurs, the Lyapunov exponent is at the same time. If it is positive, it indicates that the system is indeed chaotic. From the above analysis, it can be known that the map can be used for image encryption, but as can be seen in Figure 3, the map sometimes does not appear chaotic. Therefore, the map needs to be improved.Figure 3
Dynamic behavior of the map: bifurcation diagram (a) and Lyapunov exponent graph (b).
(a)(b)Adjust the map slightly, and multiplyπ by the map:(10)yn+1=b−−1n1+bxn.The improved sine-tent map is as follows:(11)xn+1=a−1+asinyn,yn+1=πb−−1n1+bxn.In this formula,a, b are the control parameters. Compared with the original map, the control parameter b and the initial value y0 are added, which effectively expands the key space. The following gives the control parameter −2 < a < 2, b = 3.21, its bifurcation graph, and Lyapunov exponent graph.As we can see from Figure4, only when the value of a is around −1, the mapped system is relatively stable and does not appear chaotic, compared to the previous map. The value ranges of the control parameter a is further expanded.Figure 4
Dynamic behavior of the improved sine-tent map: bifurcation diagram (a) and Lyapunov exponent graph (b) of the improved sine-tent map.
(a)(b)Then, we will operate on bits in order to further improve the improved sine-tent map. Bit rearrangement has the advantage of being able to improve the chaos of the system and make unpredictable changes to the chaotic value of the output. When there are two points with small differences in the chaotic system, rearranging their bits will make the difference between the two updated points after the rearrangement become more random. After this operation, the rearranged chaotic system has better sensitivity chaotic characteristics, such as dependence and ergodicity, and enhanced chaotic characteristics of chaotic systems.The bit rearrangement method used in this article is to take out the decimals separately. The specific operation steps are as follows: firstly, we convert the decimals into hexadecimal, then scramble each bit of it, and restore it to decimal at last. The operational diagram is as follows.The bit rearrangement used in this article is to convert decimals into 16-bit binary. In the next steps, we will insert the first eight digits into odd digits back to front and insert the last eight digits into even digits from back to forward. Finally, it will be converted into decimal decimals. As shown in Figure5, 0.4321 is converted to binary, and after bit rearrangement, it becomes 0.2477. Bit rearrangement of the improved sine-tent map makes it show better chaos. The dynamic behavior is shown in Figure 6.Figure 5
Schematic diagram of bit rearrangement.Figure 6
Dynamic behavior of the improved sine-tent map after further improvement: bifurcation diagram (a) and Lyapunov exponent graph (b).
(a)(b)


## 2.1. Lyapunov Index

Chaotic systems have many basic characteristics, which are mainly manifested as nonperiodic, randomness, and extreme sensitivity of the system to initial values. The sensitivity of the initial value is mainly manifested as the trajectory produced by the change of two initial values with little difference over time, which is gradually separated exponentially with the passage of control parameters. Among them, the Lyapunov exponent is the parameter used to describe this phenomenon [15]. In other words, it can judge whether the system is chaotic. The important parameters for judging the stability of a system can be visually observed by judging the Lyapunov exponent. Its principle is to measure the state of a system by measuring the rate of convergence or separation of adjacent trajectories, which are expressed as the average rate of divergence or convergence of adjacent trajectories in phase space. The lower the exponent is, the more stable the system is. If the control parameter is at a certain point, the exponent is positive. If the system is chaotic, no matter how small the initial distance between the two trajectories is, the difference will increase exponentially over time to the point of being unpredictable and forming a chaotic phenomenon.The calculation methods of Lyapunov exponents are usually divided into two categories. One is the solution method based on the differential equation, and the other is the calculation method based on the motion trajectory. It has two important parameters: the embedding dimensionm and time lag T. Since there are m spatial dimensions, there are m Lyapunov exponents [16, 17]. The largest exponent can determine the magnitude of local stability. When studying dynamic systems in this paper, bifurcation graphs and Lyapunov exponents will be studied at the same time to analyze the chaotic phenomena of the system. The formula for calculating the Lyapunov exponent is(1)λ=limn⟶∞∑k=0n−1logdSdxxk.Among them,S is a chaotic map. In this paper, the Jacobi matrix method is used to calculate the improved sine-tent map with (2)xn+1=g1xn,yn,yn+1=g2xn,yn.Its Jacobi matrix is(3)J=∂g1∂xn∂g1∂yn∂g2∂xn∂g2∂yn.And then, there are initial valuesx0 and y0, and the small difference is ∂x0 and ∂y0. After n iterations, it can create x0,y0,x1,y1,…,xn,yn. Then, these n Jacobi matrices are expressed as(4)Jn=Jxn,yn.Making QR decomposition of these matrices, getJn,Jn−1,…,J1. Each entry on the diagonal of R is the product of all entries on the diagonal of Ri. In other words, the approximate value of the Lyapunov exponent can be obtained by the following formula:(5)λk=1n∑i=1nlnRik⋅k,k=1,2.


## 2.2. The Sine Map

The sine map is a classic chaotic map derived from the sine function. It converts the input angle into a certain angle and then outputs it. Sine map’s mathematical expression is defined as(6)xn+1=Sx=asinπx.In formula (6), the map is expressed as (x), and a is the control parameter. Its bifurcation graph and Lyapunov exponent graph are shown in Figure 1.Figure 1
Dynamic behavior of the sine map: bifurcation diagram (a) and Lyapunov exponent graph (b) of the sine map.
(a)(b)


## 2.3. The Tent Map

The tent map is a segmented linear map which is widely used in image encryption systems. The tent map appears as a chaotic map within the value range of the control parameters, which has a uniform distribution function and a good correlation. The mathematical model of the tent map is defined as follows:(7)xn+1=Sx=xna,xn=0,a,1−xn1−a,xn=a,1.The tent map’s expression can be transformed into the following formula:(8)xn+1=a−1+axn,a=0,1,xn=−1,1.Among them, (x) is the map, a is the control parameter, and the value range of a is 0 < a < 1. When a = 0.5, the system presents a short-period state. And the initial value cannot be equal to the control parameter; otherwise, let the system present a periodic state [18]. Its bifurcation diagram and Lyapunov exponent plot are shown in Figure 2.Figure 2
Dynamic behavior of the tent map: bifurcation diagram (a) and Lyapunov exponent graph (b) of the tent map.
(a)(b)


## 2.4. The Improved Sine-Tent Map

Through the study of the tent map and the sine map, this paper found that the tent map only produces chaos within the parameter value range, and the control parametera only has a value range of 0 < a < 1, so this paper uses the sine map to perform the tent map. We use the sine map to replace x on the right side of the equation in the tent map to get the following formula:(9)xn+1=a−1+asinπxn.As shown in Figure3, analyzing its dynamic behavior, it is obvious that the map has a large range of chaos, and it can be seen that when the bifurcation phenomenon occurs, the Lyapunov exponent is at the same time. If it is positive, it indicates that the system is indeed chaotic. From the above analysis, it can be known that the map can be used for image encryption, but as can be seen in Figure 3, the map sometimes does not appear chaotic. Therefore, the map needs to be improved.Figure 3
Dynamic behavior of the map: bifurcation diagram (a) and Lyapunov exponent graph (b).
(a)(b)Adjust the map slightly, and multiplyπ by the map:(10)yn+1=b−−1n1+bxn.The improved sine-tent map is as follows:(11)xn+1=a−1+asinyn,yn+1=πb−−1n1+bxn.In this formula,a, b are the control parameters. Compared with the original map, the control parameter b and the initial value y0 are added, which effectively expands the key space. The following gives the control parameter −2 < a < 2, b = 3.21, its bifurcation graph, and Lyapunov exponent graph.As we can see from Figure4, only when the value of a is around −1, the mapped system is relatively stable and does not appear chaotic, compared to the previous map. The value ranges of the control parameter a is further expanded.Figure 4
Dynamic behavior of the improved sine-tent map: bifurcation diagram (a) and Lyapunov exponent graph (b) of the improved sine-tent map.
(a)(b)Then, we will operate on bits in order to further improve the improved sine-tent map. Bit rearrangement has the advantage of being able to improve the chaos of the system and make unpredictable changes to the chaotic value of the output. When there are two points with small differences in the chaotic system, rearranging their bits will make the difference between the two updated points after the rearrangement become more random. After this operation, the rearranged chaotic system has better sensitivity chaotic characteristics, such as dependence and ergodicity, and enhanced chaotic characteristics of chaotic systems.The bit rearrangement method used in this article is to take out the decimals separately. The specific operation steps are as follows: firstly, we convert the decimals into hexadecimal, then scramble each bit of it, and restore it to decimal at last. The operational diagram is as follows.The bit rearrangement used in this article is to convert decimals into 16-bit binary. In the next steps, we will insert the first eight digits into odd digits back to front and insert the last eight digits into even digits from back to forward. Finally, it will be converted into decimal decimals. As shown in Figure5, 0.4321 is converted to binary, and after bit rearrangement, it becomes 0.2477. Bit rearrangement of the improved sine-tent map makes it show better chaos. The dynamic behavior is shown in Figure 6.Figure 5
Schematic diagram of bit rearrangement.Figure 6
Dynamic behavior of the improved sine-tent map after further improvement: bifurcation diagram (a) and Lyapunov exponent graph (b).
(a)(b)


## 3. Encryption Method

The algorithm designed in this paper uses XOR of high-order bits, scrambling, and diffusion to realize image encryption. The specific steps are as follows: we will input a plaintext imageIMN with a size of M×N pixels, record the pixel value of row i and column j as Ii,j, extract the average number of plaintext images x¯, and process to get x0 as the key. The control parameters a,b and the initial value of y0 are also the keys. x0,y0 will be taken as the initial value of the iteration, y0=0.01, the control parameters value for a=1.12345,b=3.21, substituted into the improved sine-tent map. Firstly, we will iterate M times to make the chaotic system skip the chaotic transition state and then output a sequence of length M×N, denoted as e0. Because it is in chaos, we can know that each element in e0 is different. There are formulas for processing e0 to get three sets of sequences:(12)e1=rounde0+1∗1000mod2,e2=rounde0+1∗1000∗M−1modM,e3=rounde0+1∗1000∗255mod256.Sequencee0 and sequence e2 will be used for the scrambling algorithm, sequence e1 will be used for high-order bit masking, and sequence e3 will be used for the diffusion algorithm.


### 3.1. Shielding of High Bit

Bit is the smallest storage unit in the computer. It usually stores as 0 or 1. The experimental image used in this article is a grayscale image. The 8-bit grayscale is used when converted to decimal. The pixel value is between 0 and 255, and the larger the pixel value, the darker the color when represented in the image. In other words, when the pixel value is 0, it is shown as pure black, and when the pixel value is 255, it is shown as pure white.Many information hiding algorithms are also implemented based on bit manipulation, such as the LSB algorithm. The LSB algorithm is a relatively classic information hiding technology, which realizes information hiding by hiding information in the lowest bits of the image [19]. It is based on the principle that the lower the image bit is, the less the impact on the image information after the bit is changed. Therefore, after the ciphertext information is embedded in the lowest bit of the carrier image, although the pixel value has changed, the impact of the carrier image is minimal. It shows that the higher the effective bit changes, the greater the impact of the change on the image information in an image is. So, we will operate on the high-order bits of the plaintext image pixels based on this. This method can effectively change the pixel value of the image according to the chaotic sequence, so the algorithm can also encrypt the solid color image well.In this paper, the plaintext image is converted into an 8-bit binary array, and the highest bit and the second-highest bit are XORed withe1 to shield the high bit and hide the plaintext information. This method can make every pixel value of the plaintext image change unpredictably, which is a preprocessing of the pixel value.


### 3.2. Scrambling Algorithm

Scrambling refers to scramble the information order of the image to transform it into a chaotic image where information cannot be read. If we use the scrambling method to hide the information, the scrambled image is scrambled only at the pixel position, so the value of the pixel has not changed. Generally speaking, after the image scrambling, the result is an image with disordered pixel order. Even if the ciphertext image is obtained, no information can be obtained, which can effectively resist the attack. This technique can greatly improve the robustness of the encryption system [20–22].


#### 3.2.1. Random Emission of Pixels

The way to implement the algorithm in this paper is as follows: at first, the plaintext imageI is transformed into a set of one-dimensional sequence I′. e0 will be sorted in ascending order to generate e0′. When e0 is sorting, the plaintext image I′ sorts synchronously. Since e0 is a chaotic sequence without the same number, there will be no repetition and it is difficult to crack. However, because the amount of pixels is too large, if this scrambling method is used, it will cause too much calculation. So, we have to reduce the calculation efficiency and reduce the time cost. Therefore, e0 is transformed into a two-dimensional number sequence of M×N, denoting it as e0″. The M column of e0″ is denoted as e0M, the N row of e0″ is denoted as e0N. e0M,e0N are arranged in ascending order and scrambled to get the image E; the sorted scrambling index of e0 is recorded to form a two-dimensional array, denoted as D.


#### 3.2.2. Cyclic Shift

This method is also a scrambling algorithm. Random horizontal displacement is performed on each row of pixels to achieve the scrambling effect. The processede1 sequence is a sequence of positive integers with a value range of 0−M. The i row of the scrambling matrix is denoted as Ei, and the i position of e1 is denoted as e1i; shift the pixel in row i of the scrambled image E by e1i to the left to get the scrambled image E′. The schematic diagram is shown in Figure 7.Figure 7
Schematic diagram of cyclic shift operation.


### 3.3. Diffusion Algorithm

Diffusion algorithm is a processing method that allows data and data to interact with each other. The purpose is to make the elements interact with each other through diffusion processing, causing an avalanche effect. When small changes are made to different data or input values, there will be huge differences in the output results finally.Diffusion algorithms have many characteristics, such as rich diffusion establishment methods, natural parallel computing support, abundant diffusion calculation, and elementary organization methods [23]. When the diffusion algorithm is used in image encryption, the diffusion rate needs to reach 100%. The diffusion algorithm with a perfect diffusion rate can better encrypt the image. Parallel computing can also greatly improve computing efficiency, so it has good computing performance. The diffusion algorithm hides the pixel value without changing the pixel position.This paper adopts the addition and subtraction operation for diffusion encryption. The diffusion algorithm used in this paper is as follows:(13)E″n=E″n−1+E′n2+e2mod256,E″n=E″n+1+E′n2+e2mod256.Firstly, the scrambled imageE′ will be converted into a one-dimensional number sequence, and the data type has to be converted to a floating-point type. And then spread backward and forward twice, where E″n is the nth ciphertext image after diffusion pixels, E′(n) is the pixel of the nth scrambled image sequence, and e2 is the chaotic sequence after processing. At last, we will output E″, convert it into a two-dimensional sequence of M × N, convert its data type to uint 8, and output the ciphertext image C, completing the encryption.


### 3.4. Decryption Algorithm and Result

The algorithm is written and implemented based on MATLAB. The images of 512 × 512 pixels are encrypted as plaintext images. The plaintext imageI and the encrypted output ciphertext image C are shown in Figure 8.Figure 8
Comparison of the original images ((a), (c), (e), (g), and (i)) before encryption and the images ((b), (d), (f), (h), and (j)) after encryption.
(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)The encrypted ciphertext image cannot read any information.When the pure white and pure black images are encrypted, the results are shown in Figure9.Figure 9
Ciphertext image of the pure white image (a) and ciphertext image of the pure black image (b).
(a)(b)The results show that the algorithm can also encrypt solid color images.


## 3.1. Shielding of High Bit

Bit is the smallest storage unit in the computer. It usually stores as 0 or 1. The experimental image used in this article is a grayscale image. The 8-bit grayscale is used when converted to decimal. The pixel value is between 0 and 255, and the larger the pixel value, the darker the color when represented in the image. In other words, when the pixel value is 0, it is shown as pure black, and when the pixel value is 255, it is shown as pure white.Many information hiding algorithms are also implemented based on bit manipulation, such as the LSB algorithm. The LSB algorithm is a relatively classic information hiding technology, which realizes information hiding by hiding information in the lowest bits of the image [19]. It is based on the principle that the lower the image bit is, the less the impact on the image information after the bit is changed. Therefore, after the ciphertext information is embedded in the lowest bit of the carrier image, although the pixel value has changed, the impact of the carrier image is minimal. It shows that the higher the effective bit changes, the greater the impact of the change on the image information in an image is. So, we will operate on the high-order bits of the plaintext image pixels based on this. This method can effectively change the pixel value of the image according to the chaotic sequence, so the algorithm can also encrypt the solid color image well.In this paper, the plaintext image is converted into an 8-bit binary array, and the highest bit and the second-highest bit are XORed withe1 to shield the high bit and hide the plaintext information. This method can make every pixel value of the plaintext image change unpredictably, which is a preprocessing of the pixel value.


## 3.2. Scrambling Algorithm

Scrambling refers to scramble the information order of the image to transform it into a chaotic image where information cannot be read. If we use the scrambling method to hide the information, the scrambled image is scrambled only at the pixel position, so the value of the pixel has not changed. Generally speaking, after the image scrambling, the result is an image with disordered pixel order. Even if the ciphertext image is obtained, no information can be obtained, which can effectively resist the attack. This technique can greatly improve the robustness of the encryption system [20–22].


### 3.2.1. Random Emission of Pixels

The way to implement the algorithm in this paper is as follows: at first, the plaintext imageI is transformed into a set of one-dimensional sequence I′. e0 will be sorted in ascending order to generate e0′. When e0 is sorting, the plaintext image I′ sorts synchronously. Since e0 is a chaotic sequence without the same number, there will be no repetition and it is difficult to crack. However, because the amount of pixels is too large, if this scrambling method is used, it will cause too much calculation. So, we have to reduce the calculation efficiency and reduce the time cost. Therefore, e0 is transformed into a two-dimensional number sequence of M×N, denoting it as e0″. The M column of e0″ is denoted as e0M, the N row of e0″ is denoted as e0N. e0M,e0N are arranged in ascending order and scrambled to get the image E; the sorted scrambling index of e0 is recorded to form a two-dimensional array, denoted as D.


### 3.2.2. Cyclic Shift

This method is also a scrambling algorithm. Random horizontal displacement is performed on each row of pixels to achieve the scrambling effect. The processede1 sequence is a sequence of positive integers with a value range of 0−M. The i row of the scrambling matrix is denoted as Ei, and the i position of e1 is denoted as e1i; shift the pixel in row i of the scrambled image E by e1i to the left to get the scrambled image E′. The schematic diagram is shown in Figure 7.Figure 7
Schematic diagram of cyclic shift operation.


## 3.2.1. Random Emission of Pixels

The way to implement the algorithm in this paper is as follows: at first, the plaintext imageI is transformed into a set of one-dimensional sequence I′. e0 will be sorted in ascending order to generate e0′. When e0 is sorting, the plaintext image I′ sorts synchronously. Since e0 is a chaotic sequence without the same number, there will be no repetition and it is difficult to crack. However, because the amount of pixels is too large, if this scrambling method is used, it will cause too much calculation. So, we have to reduce the calculation efficiency and reduce the time cost. Therefore, e0 is transformed into a two-dimensional number sequence of M×N, denoting it as e0″. The M column of e0″ is denoted as e0M, the N row of e0″ is denoted as e0N. e0M,e0N are arranged in ascending order and scrambled to get the image E; the sorted scrambling index of e0 is recorded to form a two-dimensional array, denoted as D.


## 3.2.2. Cyclic Shift

This method is also a scrambling algorithm. Random horizontal displacement is performed on each row of pixels to achieve the scrambling effect. The processede1 sequence is a sequence of positive integers with a value range of 0−M. The i row of the scrambling matrix is denoted as Ei, and the i position of e1 is denoted as e1i; shift the pixel in row i of the scrambled image E by e1i to the left to get the scrambled image E′. The schematic diagram is shown in Figure 7.Figure 7
Schematic diagram of cyclic shift operation.


## 3.3. Diffusion Algorithm

Diffusion algorithm is a processing method that allows data and data to interact with each other. The purpose is to make the elements interact with each other through diffusion processing, causing an avalanche effect. When small changes are made to different data or input values, there will be huge differences in the output results finally.Diffusion algorithms have many characteristics, such as rich diffusion establishment methods, natural parallel computing support, abundant diffusion calculation, and elementary organization methods [23]. When the diffusion algorithm is used in image encryption, the diffusion rate needs to reach 100%. The diffusion algorithm with a perfect diffusion rate can better encrypt the image. Parallel computing can also greatly improve computing efficiency, so it has good computing performance. The diffusion algorithm hides the pixel value without changing the pixel position.This paper adopts the addition and subtraction operation for diffusion encryption. The diffusion algorithm used in this paper is as follows:(13)E″n=E″n−1+E′n2+e2mod256,E″n=E″n+1+E′n2+e2mod256.Firstly, the scrambled imageE′ will be converted into a one-dimensional number sequence, and the data type has to be converted to a floating-point type. And then spread backward and forward twice, where E″n is the nth ciphertext image after diffusion pixels, E′(n) is the pixel of the nth scrambled image sequence, and e2 is the chaotic sequence after processing. At last, we will output E″, convert it into a two-dimensional sequence of M × N, convert its data type to uint 8, and output the ciphertext image C, completing the encryption.


## 3.4. Decryption Algorithm and Result

The algorithm is written and implemented based on MATLAB. The images of 512 × 512 pixels are encrypted as plaintext images. The plaintext imageI and the encrypted output ciphertext image C are shown in Figure 8.Figure 8
Comparison of the original images ((a), (c), (e), (g), and (i)) before encryption and the images ((b), (d), (f), (h), and (j)) after encryption.
(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)The encrypted ciphertext image cannot read any information.When the pure white and pure black images are encrypted, the results are shown in Figure9.Figure 9
Ciphertext image of the pure white image (a) and ciphertext image of the pure black image (b).
(a)(b)The results show that the algorithm can also encrypt solid color images.


## 4. Decryption Method

In terms of the design of the decryption algorithm, actually we do the inverse process of the above steps. The following is the specific operation process of decryption:(1)
Perform diffusion algorithm decryption, once for the forward diffusion and once for the reverse diffusion. The step of diffusion is opposite to that of decryption. The formula used in this step of the decryption algorithm is as follows:(14)E′n=256∗2+Cn−Cn−1−e2mod256,E′n=256∗2+Cn−Cn+1−e2mod256,whereE′ is the image after diffusion and decryption, C is the ciphertext image, and e2 is a sequence value for 1 −255, generated by e0. The ciphertext image C and e2 will be inversely diffused based on the above two formulas twice to get the decrypted image C′.(2)
The cyclic shift encryption algorithm decrypts the ciphertext imageC′. Since the image is cyclically shifted to the left according to the sequence e1 during encryption, in decryption, the ciphertext image C′ is cyclically shifted to the right to obtain the ciphertext image C″.(3)
These pixels will be restored. When performing image pixel scrambling, we can record the indexD. D is a two-dimensional sequence from 1 to M × N. When it is scrambling, D and the plaintext image synchronously scramble, so that the plaintext image can be scrambled and the index of the pixel change is recorded. The index D can restore the image. We will sort D from small to large, and perform the same operation on C″ to restore the pixels of the ciphertext image C″ to the position of the plaintext image.(4)
Bit restoration. There is a XOR operation on the highest and second-highest bits withe1 to restore them. And finally, we restore the restored image to a decimal two-dimensional array of M × N and convert it to the uint 8 type. The decrypted image has been obtained.The decryption result is shown in Figure10.Figure 10
Comparison of ciphertext images ((a), (c), (e), (g), and (i)) and correctly decrypted images ((b), (d), (f), (h), and (j)).
(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)


## 5. Analysis of the Algorithm

### 5.1. Key Space Analysis

The keys for this article arex0, y0, a, b. x0, y0 are the initial values of the iteration, x0 is related to the plaintext image. They are used with the parameters a, b to control the generation of the chaotic sequence e0 and the sequence e1, e2, e3. The control parameter range of the two-dimensional improved sine-tent map is not limited to [0∼1]. Experimenting x0=0.12345678901234567, y0=0.1234567890123456, a = 1.1234567890123456, b = 0.123456789012345678, at this time, when the last decimal place changes, the decryption still fails. We can easily know that the key space of this algorithm is 1017×1016×1016×1018=1066, which is very large. Table 1 shows the comparing results with other documents.Table 1
Comparison of the key space with other documents.
AlgorithmKey spaceLina1066[8]1064[9]1034[24]1060[25]1042


### 5.2. Key Sensitivity Analysis

In an encryption algorithm, the key sensitivity is an important index to measure the security of the encryption system. After the ciphertext image and encryption algorithm are obtained, though the key has undergone very slight changes, it still cannot be decrypted correctly. Security is relatively high. The following is to test the key sensitivity.Setting the control parametera=1.234567890123451, we substitute it into the algorithm for testing before decryption. The experimental results of the test are as follows.As shown in Figure11, it can be seen that when the 16 digits after the decimal point of the parameter are changed, it still cannot be decrypted correctly. So, the key sensitivity of this algorithm achieves the expected effect.Figure 11
Comparison of correctly decrypted images (a) and incorrectly decrypted images (b).
(a)(b)


### 5.3. Classic Attack Analysis

When cracking and analyzing a cryptographic system, it is generally believed that the design and working information of the cryptographic system can be obtained. There are four classic attack methods [24]:(1)
In a pure ciphertext attack: the attacker only has ciphertext information(2)
Attacks with known plaintext: the attacker possesses plaintext and its corresponding ciphertext information(3)
Select plaintext attack: the attacker can construct a part of the ciphertext attack based on the plaintext(4)
Select ciphertext attack: the attacker can construct the corresponding plaintext based on the ciphertextIt can be seen that the selected plaintext attack is the most difficult attack to defend. Therefore, if an encryption system is constructed to completely resist the selected plaintext attack, we can say that this algorithm can resist all the above attacks. In the encryption algorithm constructed in this paper, the modular arithmetic diffusion algorithm uses a combination of scrambled image information and a key to encrypt. The scrambled images produced by different plaintext images are different, and the key stream they generate in the modular arithmetic diffusion algorithm is also different. It can resist selected plaintext attacks; that is, it can resist all the aforementioned attacks.


### 5.4. Antidifferential Attack

The important indicators for evaluating the resistance of an image encryption algorithm to differential attacks are as follows: image pixel change rate (Number of Changing Pixel Rate, NPCR) and normalized average intensity change (Unified Averaged Changed Intensity, UACI) [26]. Among them, the image pixel change rate is an indicator to judge the distortion of the image after decryption, and the normalized average intensity change is an indicator to evaluate the severity of the change in the entire ciphertext image after the pixel changes. The calculation method of image pixel change rate is shown in the following equation:(15)PNPCR=∑i=1M∑j=1NDi,jM×N×100%,Di,j=1,C1i,j≠C2i,j,0,C1i,j=C2i,j.The calculation method of normalized average intensity change is as follows:(16)PUACI=1M×N∑i=1M∑j=1NC1i,j−C2i,j255×100%.The image is a grayscale image of pixelsM × N, C1 is the ciphertext image gained by encrypting the image, C2 is the image encrypted by changing the pixel value of a certain point in the original image. This article will focus on the central pixel of the plaintext image (add 1 to the value of I(256, 256)) to test. After calculating PNPCR=99.5979%, PUACI=33.3695%. Their ideal values are, respectively, 99.6094% and 33.4635%. It can be seen that, in the image, when a very small change occurs at a pixel value, there is a huge change. The above data show that the algorithm can well defend against differential attacks. There is a comparison with other documents in Table 2.Table 2
NPCR and UACI and other literature comparison.
Figure or algorithmNPCR (%)UACI (%)Lina99.597933.3695AirplaneGray99.595633.4827Peppers99.594533.4666Milkdrop99.608233.5004Baboon99.611333.4692[8]99.656733.5543[9]99.6233.39[27]99.589333.3730


### 5.5. Histogram Analysis

It can be known that when the number of pixels at each gray level is closer, the histogram is more stable. It indicates that each pixel value tends to be the same, which indicates higher security. The histogram analysis result is as follows.Figure12 shows that the uneven pixel distribution becomes relatively smooth and even pixel distribution after encryption, which proves that the algorithm is more secure.Figure 12
Pixel histogram of original image Lina (a) and encrypted image (b).
(a)(b)


### 5.6. Correlation Analysis of Adjacent Pixels

The correlation of adjacent pixels is expressed as the degree of correlation between pixels. Normally, the pixels of a plaintext image are strongly correlated with its neighboring pixels. An ideal encryption algorithm can cut down the correlation of the pixels of the image as much as possible and try to be zero correlation [25, 28]. The lower the correlation is, the less likely it is to carry effective information. The following text will use simulation experiments on the pixels of the encrypted image. For the correlation coefficient calculation in three directions, the calculation formula is(17)σxy=∑i=1nxi−x¯yi−y¯∑i=1nxi−x¯2∑i=1nyi−y¯2,where yi is the value of the next pixel in a certain direction of xi, x¯ is the average of all the points that can be taken by the previous pixel, and y¯ is the average of all the points that can be taken by the next pixel value. For example, when calculating the correlation between the horizontally adjacent pixels, xi=Ci,j, yi=Ci⋅j+1, where C is the ciphertext image and i and j are the value ranges of 1<i<N,1<j<M−1.Table3 shows the comparison between the pixel correlation coefficient of plaintext image and ciphertext image in three directions.Table 3
Correlation coefficients of plaintext image and ciphertext image pixels in three directions and comparison with other papers.
Figure or algorithmHorizontal directionVertical directionDiagonal directionPlaintext Lina0.98960.97970.9683Ciphertext Lina0.0012−0.00004−0.0004Ciphertext AirplaneGray−0.00044−0.0011−0.0041Ciphertext Peppers0.00310.0014−0.0035Ciphertext Milkdrop−0.000970.00078−0.0012Ciphertext Baboon0.000970.00078−0.0012[8]0.02410.02220.0169[20]0.00640.0001−0.0029[25]−0.0304−0.00560.0058[29]−0.00030.00110.0013[27]0.0003−0.0011−0.0010The scatter plot of the correlation between the plaintext image and the ciphertext image of a selected row is shown in Figures13 and 14.Figure 13
The horizontal (a), vertical (b), and diagonal (c) pixel correlation scatter plots of the original image Lina.
(a)(b)(c)Figure 14
The horizontal (a), vertical (b), and diagonal (c) pixel correlation scatter plots of the ciphertext image.
(a)(b)(c)


### 5.7. Information Entropy Analysis

Entropy is an important indicator used to describe the complexity of things, and the randomness of information is usually used to measure by information entropy. Generally, we use information entropy to measure the randomness of text or image information. In the criteria for judging the randomness of image encryption algorithms, the ideal grayscale ciphertext image information entropy should be equal to 8. That is to say, in the algorithm of this article, the closer to 8 the information entropy is, the better the ciphertext image randomness is [30, 31]. The calculation method of information entropy used in this paper is as follows:(18)HS=−∑i=0nPSilog2PSi,where Si is the probability of a certain pixel and Si is the value of the pixel. The calculation result is (S) = 7.9993, which proves that the randomness of the algorithm after encryption is close to the ideal state. Table 4 shows the comparison of information entropy.Table 4
Comparison of information entropy.
Figure or algorithmInformation entropyLina7.9993AirplaneGray7.9993Peppers7.9993Milkdrop7.9993Baboon7.9993[8]7.9993[20]7.9971[25]7.9867[27]7.9025[32]7.9500


### 5.8. Time Analysis

Encryption speed is also an important index to measure the encryption algorithm. Table5 shows the comparison between the encryption time required by the algorithm in this paper and the literature.Table 5
Comparison of information entropy.
Figure or algorithmTime (s)Lina0.1035AirplaneGray0.0979[8]0.0259[20]0.0501[27]0.0300


### 5.9. Randomness Test

In order to test the randomness of ciphertext image pixels, the test is carried out based on NIST-SP-800-22 standard [33].For a sample size equaling 10 binary sequences, the minimum pass rate for each statistical test with the exception of the random excursion (variant) test is approximately equaling 8. The minimum pass rate for the random excursion (variant) test is approximately equaling 0 for a sample size equaling 1 binary sequences. Fifteen test results are shown in Table6.Table 6
Result of NIST-SP-800-22 test.
The test itemP valueFrequency0.911413BlockFrequency0.739918CumulativeSums0.534146Runs0.350485LongestRun0.911413Rank0.035174FFT0.122325NonOverlappingTemplate0.911413OverlappingTemplate0.534146Universal0ApproximateEntropy0.739918RandomExcursions—RandomExcursionsVariant—LinearComplexity0.122325Serial0.534146The randomness of ciphertext images passed the test.


## 5.1. Key Space Analysis

The keys for this article arex0, y0, a, b. x0, y0 are the initial values of the iteration, x0 is related to the plaintext image. They are used with the parameters a, b to control the generation of the chaotic sequence e0 and the sequence e1, e2, e3. The control parameter range of the two-dimensional improved sine-tent map is not limited to [0∼1]. Experimenting x0=0.12345678901234567, y0=0.1234567890123456, a = 1.1234567890123456, b = 0.123456789012345678, at this time, when the last decimal place changes, the decryption still fails. We can easily know that the key space of this algorithm is 1017×1016×1016×1018=1066, which is very large. Table 1 shows the comparing results with other documents.Table 1
Comparison of the key space with other documents.
AlgorithmKey spaceLina1066[8]1064[9]1034[24]1060[25]1042


## 5.2. Key Sensitivity Analysis

In an encryption algorithm, the key sensitivity is an important index to measure the security of the encryption system. After the ciphertext image and encryption algorithm are obtained, though the key has undergone very slight changes, it still cannot be decrypted correctly. Security is relatively high. The following is to test the key sensitivity.Setting the control parametera=1.234567890123451, we substitute it into the algorithm for testing before decryption. The experimental results of the test are as follows.As shown in Figure11, it can be seen that when the 16 digits after the decimal point of the parameter are changed, it still cannot be decrypted correctly. So, the key sensitivity of this algorithm achieves the expected effect.Figure 11
Comparison of correctly decrypted images (a) and incorrectly decrypted images (b).
(a)(b)


## 5.3. Classic Attack Analysis

When cracking and analyzing a cryptographic system, it is generally believed that the design and working information of the cryptographic system can be obtained. There are four classic attack methods [24]:(1)
In a pure ciphertext attack: the attacker only has ciphertext information(2)
Attacks with known plaintext: the attacker possesses plaintext and its corresponding ciphertext information(3)
Select plaintext attack: the attacker can construct a part of the ciphertext attack based on the plaintext(4)
Select ciphertext attack: the attacker can construct the corresponding plaintext based on the ciphertextIt can be seen that the selected plaintext attack is the most difficult attack to defend. Therefore, if an encryption system is constructed to completely resist the selected plaintext attack, we can say that this algorithm can resist all the above attacks. In the encryption algorithm constructed in this paper, the modular arithmetic diffusion algorithm uses a combination of scrambled image information and a key to encrypt. The scrambled images produced by different plaintext images are different, and the key stream they generate in the modular arithmetic diffusion algorithm is also different. It can resist selected plaintext attacks; that is, it can resist all the aforementioned attacks.


## 5.4. Antidifferential Attack

The important indicators for evaluating the resistance of an image encryption algorithm to differential attacks are as follows: image pixel change rate (Number of Changing Pixel Rate, NPCR) and normalized average intensity change (Unified Averaged Changed Intensity, UACI) [26]. Among them, the image pixel change rate is an indicator to judge the distortion of the image after decryption, and the normalized average intensity change is an indicator to evaluate the severity of the change in the entire ciphertext image after the pixel changes. The calculation method of image pixel change rate is shown in the following equation:(15)PNPCR=∑i=1M∑j=1NDi,jM×N×100%,Di,j=1,C1i,j≠C2i,j,0,C1i,j=C2i,j.The calculation method of normalized average intensity change is as follows:(16)PUACI=1M×N∑i=1M∑j=1NC1i,j−C2i,j255×100%.The image is a grayscale image of pixelsM × N, C1 is the ciphertext image gained by encrypting the image, C2 is the image encrypted by changing the pixel value of a certain point in the original image. This article will focus on the central pixel of the plaintext image (add 1 to the value of I(256, 256)) to test. After calculating PNPCR=99.5979%, PUACI=33.3695%. Their ideal values are, respectively, 99.6094% and 33.4635%. It can be seen that, in the image, when a very small change occurs at a pixel value, there is a huge change. The above data show that the algorithm can well defend against differential attacks. There is a comparison with other documents in Table 2.Table 2
NPCR and UACI and other literature comparison.
Figure or algorithmNPCR (%)UACI (%)Lina99.597933.3695AirplaneGray99.595633.4827Peppers99.594533.4666Milkdrop99.608233.5004Baboon99.611333.4692[8]99.656733.5543[9]99.6233.39[27]99.589333.3730


## 5.5. Histogram Analysis

It can be known that when the number of pixels at each gray level is closer, the histogram is more stable. It indicates that each pixel value tends to be the same, which indicates higher security. The histogram analysis result is as follows.Figure12 shows that the uneven pixel distribution becomes relatively smooth and even pixel distribution after encryption, which proves that the algorithm is more secure.Figure 12
Pixel histogram of original image Lina (a) and encrypted image (b).
(a)(b)


## 5.6. Correlation Analysis of Adjacent Pixels

The correlation of adjacent pixels is expressed as the degree of correlation between pixels. Normally, the pixels of a plaintext image are strongly correlated with its neighboring pixels. An ideal encryption algorithm can cut down the correlation of the pixels of the image as much as possible and try to be zero correlation [25, 28]. The lower the correlation is, the less likely it is to carry effective information. The following text will use simulation experiments on the pixels of the encrypted image. For the correlation coefficient calculation in three directions, the calculation formula is(17)σxy=∑i=1nxi−x¯yi−y¯∑i=1nxi−x¯2∑i=1nyi−y¯2,where yi is the value of the next pixel in a certain direction of xi, x¯ is the average of all the points that can be taken by the previous pixel, and y¯ is the average of all the points that can be taken by the next pixel value. For example, when calculating the correlation between the horizontally adjacent pixels, xi=Ci,j, yi=Ci⋅j+1, where C is the ciphertext image and i and j are the value ranges of 1<i<N,1<j<M−1.Table3 shows the comparison between the pixel correlation coefficient of plaintext image and ciphertext image in three directions.Table 3
Correlation coefficients of plaintext image and ciphertext image pixels in three directions and comparison with other papers.
Figure or algorithmHorizontal directionVertical directionDiagonal directionPlaintext Lina0.98960.97970.9683Ciphertext Lina0.0012−0.00004−0.0004Ciphertext AirplaneGray−0.00044−0.0011−0.0041Ciphertext Peppers0.00310.0014−0.0035Ciphertext Milkdrop−0.000970.00078−0.0012Ciphertext Baboon0.000970.00078−0.0012[8]0.02410.02220.0169[20]0.00640.0001−0.0029[25]−0.0304−0.00560.0058[29]−0.00030.00110.0013[27]0.0003−0.0011−0.0010The scatter plot of the correlation between the plaintext image and the ciphertext image of a selected row is shown in Figures13 and 14.Figure 13
The horizontal (a), vertical (b), and diagonal (c) pixel correlation scatter plots of the original image Lina.
(a)(b)(c)Figure 14
The horizontal (a), vertical (b), and diagonal (c) pixel correlation scatter plots of the ciphertext image.
(a)(b)(c)


## 5.7. Information Entropy Analysis

Entropy is an important indicator used to describe the complexity of things, and the randomness of information is usually used to measure by information entropy. Generally, we use information entropy to measure the randomness of text or image information. In the criteria for judging the randomness of image encryption algorithms, the ideal grayscale ciphertext image information entropy should be equal to 8. That is to say, in the algorithm of this article, the closer to 8 the information entropy is, the better the ciphertext image randomness is [30, 31]. The calculation method of information entropy used in this paper is as follows:(18)HS=−∑i=0nPSilog2PSi,where Si is the probability of a certain pixel and Si is the value of the pixel. The calculation result is (S) = 7.9993, which proves that the randomness of the algorithm after encryption is close to the ideal state. Table 4 shows the comparison of information entropy.Table 4
Comparison of information entropy.
Figure or algorithmInformation entropyLina7.9993AirplaneGray7.9993Peppers7.9993Milkdrop7.9993Baboon7.9993[8]7.9993[20]7.9971[25]7.9867[27]7.9025[32]7.9500


## 5.8. Time Analysis

Encryption speed is also an important index to measure the encryption algorithm. Table5 shows the comparison between the encryption time required by the algorithm in this paper and the literature.Table 5
Comparison of information entropy.
Figure or algorithmTime (s)Lina0.1035AirplaneGray0.0979[8]0.0259[20]0.0501[27]0.0300


## 5.9. Randomness Test

In order to test the randomness of ciphertext image pixels, the test is carried out based on NIST-SP-800-22 standard [33].For a sample size equaling 10 binary sequences, the minimum pass rate for each statistical test with the exception of the random excursion (variant) test is approximately equaling 8. The minimum pass rate for the random excursion (variant) test is approximately equaling 0 for a sample size equaling 1 binary sequences. Fifteen test results are shown in Table6.Table 6
Result of NIST-SP-800-22 test.
The test itemP valueFrequency0.911413BlockFrequency0.739918CumulativeSums0.534146Runs0.350485LongestRun0.911413Rank0.035174FFT0.122325NonOverlappingTemplate0.911413OverlappingTemplate0.534146Universal0ApproximateEntropy0.739918RandomExcursions—RandomExcursionsVariant—LinearComplexity0.122325Serial0.534146The randomness of ciphertext images passed the test.


## 6. Conclusions

This paper introduces an image encryption algorithm designed around the improved sine-tent map based on the tent map and the sine map. The algorithm skips the chaotic transition state through the improved sine-tent map and iterates out a set of chaotic sequences. This paper uses scrambling and diffusion to encrypt the plaintext image based on the sequence, and the decryption of the image is the inverse steps of the encryption. Finally, the algorithm is performed on the histogram, key space, key sensitivity, ant-differential attack, anticlassical attack, pixel correlation coefficient, information entropy, and so on.The evaluation result shows that, for today's computers, the key space of this algorithm is large enough, the key space of this algorithm is large enough, the antiattack ability is strong, and the robustness is strong. The diffusion algorithm makes use of the pixels in the scrambled image to perform mutual diffusion and greatly improves the ability of antiattack. However, it weakens the algorithm’s ability to perform occlusion attacks. The proposed algorithm meets the requirements of image encryption, achieves the expected goal, and can be used in image encryption.



---

*Source: 9187619-2021-10-13.xml*