Abstract

To realize the safe transmission of images, a chaotic image encryption algorithm based on Latin square and random shift is proposed. The algorithm consists of four parts: key generation, pixel scrambling, pixel replacement, and bit scrambling. Firstly, the key is generated from the plain image to improve the sensitivity of the encryption method. Secondly, each pixel in each row of the image matrix is moved cyclically to the right, in turn, to change the position of the image pixel and realize pixel position scrambling. Then, a 256-order Latin square matrix composed of a chaotic sequence is used as a lookup table, and the replacement coordinates are calculated based on the image pixel value and the chaotic sequence value, replacing the corresponding coordinate elements in the image matrix. Finally, decompose the bitplane of the image matrix and combine it into two-bit matrices, scramble the two bit matrices, respectively, with the Latin square matrix, recombine the scrambled two-bit matrices, and convert them into decimal to obtain the ciphertext image. In the proposed encryption method, all the Latin square matrices used are generated by chaotic sequences, further enhancing the complexity of the generated Latin square matrix and improving the algorithm’s security. Experimental results and security analysis show that the proposed algorithm has good security performance and is suitable for image encryption.

1. Introduction

With the rapid development of modern communication technology, more and more digital images are transmitted on social networks. These images carry personal information. Therefore, how to protect this private information has become a research hotspot [1]. Due to the inherent characteristics of strong correlation and high redundancy between adjacent pixels of an image, some traditional encryption methods such as Data Encryption Standard (DES) or Advanced Encryption Standard (AES) are not suitable for performing digital images encryption because traditional encryption algorithms have the disadvantage of low efficiency when encrypting digital images [2].

Because some characteristics of the chaotic system are very suitable for the development of image encryption algorithms, such as sensitivity to initial conditions, unpredictability, and ergodicity, among the currently proposed image encryption methods, chaos systems have been widely used [35]. Wang [6] proposed an image encryption method based on a one-dimensional chaotic system, which improved the structure of control parameters and the sensitivity of one-dimensional chaotic mapping and improved its ability to resist differential attacks. Zhou [7] combined two existing one-dimensional chaotic maps and proposed a new one-dimensional chaotic map, which improved the performance against various attacks. However, some inherent shortcomings of one-dimensional chaotic mapping, such as relatively simple structure and small keyspace, are difficult to eliminate. In contrast, high-dimensional chaotic systems have more complex dynamics and high ergodicity, so people apply high-dimensional chaotic systems to image encryption [810]. Gan [11] proposed a color image encryption algorithm based on high-dimensional chaos and three-dimensional bit-plane arrangement, which can effectively resist known plaintext attacks and selected plaintext attacks. Zhang [12] proposed a new 3D bit matrix replacement algorithm, and the encryption method developed a new replacement method based on the Chen system to improve the randomness of the scrambling process. However, the encryption scheme is vulnerable to attack by the selected plaintext. Image encryption algorithms based on high-dimensional chaos often scramble the pixels of the image by obtaining the index vector of the chaotic sequence. The security of these scrambling methods only depends on the index vector because the attacker may analyze the difference between the cipher image and the plain image. The relationship to obtain the index vector causes the scrambling operation to be invalid.

In recent years, due to the excellent performance of the Latin square in image encryption methods, it has received extensive attention from researchers. The Latin square is a special square matrix with uniformity. Shannon first pointed out the relationship between the Latin square and cryptography [13]. Latin squares have some good features that are very suitable for image encryption: the number of Latin squares is huge, and the number of Latin squares of the 10th order is about 1037, so its keyspace is large and can prevent brute force attacks. The Latin square has a unified histogram, which means that using the Latin square for image encryption can effectively resist statistical analysis. Because of the good characteristics of the Latin square, Wu [14] proposed a symmetric encryption algorithm and designed a new loom-like 2D substitution-permutation network. This network maintains good confusion and diffusion characteristics while also with additional fault tolerance. Panduranga [15] used a chaotic system and Latin square to construct an image encryption method, which was later cracked by Ahmad M. and Ahmad F. [16].

Aiming at the characteristics of chaotic system and Latin square matrix, an image encryption algorithm (LSRS) based on Latin square and random shift is designed. The algorithm is divided into four parts: key generation, pixel scrambling, pixel replacement, and bit scrambling. Latin squares are all produced by chaotic sequences, which further enhances the complexity of Latin squares. In the pixel scrambling part, the cyclic shift step length of the pixel is controlled by the chaotic sequence, which makes the pixel distribution more random. The histogram of the 256-order Latin square matrix is evenly distributed; using it as a lookup table to replace the pixels can effectively increase the Shannon entropy of the cipher image. At the same time, the image pixel value and the rounded chaotic sequence jointly calculate the coordinates of the replaced pixels, which effectively improves the randomness of the algorithm, through the Latin square matrix to scramble the bit plane of the image matrix to enhance the security of the algorithm. The security analysis of the encrypted cipher image shows that the LSRS algorithm has good security performance and is suitable for practical applications.

The rest of this article is organized as follows: in Section 2, the related concepts of Latin squares and chaotic systems are introduced. Section 3 gives the detailed scheme of the LSRS method. Section 4 analyzes the safety of the proposed method. Finally, the conclusions are given in Section 5.

2.1. Latin Square

The famous mathematician and physicist Euler used the Latin alphabet as the symbol of the elements in the Latin square, and the Latin square got its name. For an N × N matrix with only N different elements and each element appears only once in any row or column, the matrix is called a Latin square matrix. The application of the Latin square matrix is to double control the row vector and column vector of the image matrix to promote the uniform distribution of pixels and improve the balance of pixels in the matrix. Figure 1 shows examples of Latin squares with different symbol sets.

2.2. Hyperchaotic Lorenz System

The hyperchaotic Lorenz system has multiple positive Lyapunov exponents, has a high keyspace, and can improve the confidentiality performance of the encryption algorithm [17]. The dynamic formula of hyperchaotic Lorenz iswhere a, b, c, and r are all control parameters, and when a = 10, b = 8/3, c = 28, and −1.52 ≤ r ≤ −0.06, formula (1) is in a hyperchaotic state. When r = −1, the four Lyapunov exponents in formula (1) are, respectively, λ1 = 0.3381, λ2 = 0.1586, λ3 = 0, λ4 = −15.1752, as shown in Figure 2 for the phase of the hyperchaotic Lorenz in the hyperchaotic state.

3. Encryption Scheme

In the encryption algorithm, P represents a plain image with a size of N × N, and C represents the corresponding cipher image. The frame diagram of the encryption scheme is shown in Figure 3.

3.1. Generate Key

The plain image to generate the key can associate the plain image with the cipher image and enhance the sensitivity of the key. The method of generating the key in this paper is as follows: divide the input image matrix P into four blocks; calculate the sum of the elements in each matrix; and obtain LL1, LL2, LL3, and LL4 to generate keys x0, y0, z0, and . The method of its generation iswhere LL = mod (x, y) returns the remainder after dividing x by y, x is the dividend, y is the divisor, and floor (x) means rounding the elements of x to the negative infinity. The key generation method iswhere bitxor represents the bitwise exclusive or between two values and represents rounding of x. Input the generated keys x0, y0, z0, and into the chaotic system, and iterate 3M × M times (when N < 256, M = 256; when N ≥ 256, M = N); the chaotic sequence X, Y, Z, and W used for pixel scrambling, pixel replacement, and bit scrambling is obtained.

3.2. The Generation of Latin Square Matrix

Given two sequences Q1 and Q2 of equal length and sorting them respectively, the corresponding index sequences Qseed and Qshift are obtained. According to Algorithm 1 [18], generate Latin square matrix L.

Input: Q1 and Q2 are two sequences of equal length
 Output: Latin matrix with order equal to the length of the input sequence
[∼, Qseed] = Sort (Q1);
[∼, Qshift] = Sort (Q2);
for i = 0 : 1: length (Qshift)-1
   L = Rowshift (Qseed, Qshift (i))
end
where Sort (x) is a sorting function, which can sort the sequence x in ascending order and return the sorted sequence and its position index sequence in the original sequence. Qseed and Qshift are the position index sequences obtained after sorting the sequences Q1 and Q2, length (x) represents the length of the sequence x, and Rowshift (x, y) means to move the sequence Qseed loop to the left by y positions.
3.3. Pixel Scrambling

Pixel scrambling can effectively break the correlation between adjacent pixels and improve the security of encryption algorithms. In this paper, adaptive shifting is used to realize pixel position scrambling, and each pixel in each row (column) is cyclically moved to the right in order from left to right. The step length of each pixel shift in the same row (column) is controlled by the element value of the chaotic sequence, and it is also affected by the previous pixels. This method can increase the complexity of scrambling; even if a chaotic sequence of a certain length is deciphered, it is difficult to restore the image pixels after scrambling correctly. The N×N elements before the chaotic sequence X and Y are, respectively, intercepted, and two equal sequences Qr1 and Qr2 are obtained. The preprocessing is performed according to formula (4) to get the sequences Qu1 and Qu2, and they are, respectively, converted into N × N. The matrix Qrow and the matrix Qcol are used for row scrambling and column scrambling of the input image matrix:where k = 1, 2, 3, ..., N.

First, use the matrix Qrow to scramble each row of the image matrix to obtain the matrix , and then use the matrix Qcol to scramble each column of the matrix to get the scrambled matrix Ps. Figure 4 shows an example of the scrambling process of the image matrix . To better explain this scrambling method, the first row of the image matrix and the first row of the matrix Qrow shown in Figure 4 are taken as an example to introduce the adaptive scrambling process in detail, where the adaptive shifting process of the remaining rows (columns) of the image matrix is similar to the scrambling process of the first row of adaptive shifting and will not be described in detail. The scrambling method is as follows:(1)The sequence of the first row of the image matrix is sequence T = [101, 33, 44, 55, 12], and the sequence of the first row of the matrix Qrow used to shift the pixels is sequence U = [2, 0, 4, 2, 3];(2)The first element in the sequence T is 101, and its first element in the corresponding pixel shift sequence U is 2; then, the first element 101 in the sequence T is cyclically moved two positions to the right, getting sequence T1 = [33, 44, 101, 55, 12];(3)The second element in sequence T1 is 44, and its second element in the corresponding pixel shift sequence U is 0; then, the second element 44 in sequence T1 is cyclically moved zeros positions to the right, getting sequence T2 = [ 33, 44, 101, 55, 12];(4)The third element in sequence T2 is 101, and its third element in the corresponding pixel shift sequence U is 4; then, the third element 101 in sequence T2 is cyclically moved four positions to the right, getting sequence T3 = [ 33, 101, 44, 55, 12];(5)The fourth element in sequence T3 is 55, and its fourth element in the corresponding pixel shift sequence U is 2; then, the fourth element 55 in sequence T3 is cyclically moved two positions to the right, getting sequence T4 = [55, 33, 101, 44, 12];(6)The fifth element in sequence T4 is 12, and its fifth element in the corresponding pixel shift sequence U is 3; then, the fifth element 12 in sequence T4 is cyclically moved three positions to the right, getting sequence T5 = [55, 33, 12, 101, 44];(7)Repeat the scrambling processes (1)–(6) to the remaining rows of the image matrix , until each row is scrambled to obtain the matrix .(8)Similar to processes (1)–(7), use matrix Qcol to scramble each column of matrix to obtain the scrambled matrix .

3.4. Pixel Replacement

In the encryption algorithm, replacing the pixels of the plain image can effectively hide the original information of the plain image. However, some encryption algorithms use the replacement method of addition, subtraction, and xor, which is too simple to protect the image information effectively. To solve this defect, generate a 256-order Latin square matrix, and use the elements in this Latin square matrix to replace the pixels of the image. The number of Latin squares of order 256 is about 256! ≈ 21684, so its keyspace is large enough, and its histogram is evenly distributed, which is difficult to crack using statistical attack analysis.

Given two sequences Qt1 and Qt2 of length 256, generate a Latin square matrix Ltable as a lookup table. According to formula (5), get Qs1 and Qs2 and respectively converted into N × N matrices Lc and Lr:where Z[a: b] means to intercept the elements whose index values are between a and b from the sequence Z (including the elements corresponding to the index values a and b). Through the matrix Lc and the corresponding coordinate element of the image matrix to be replaced to do the addition operation, take the remainder so that the elements in the resulting remainder matrix are between 0 and 255. Using as the row coordinate index matrix and the matrix Lr as the column coordinate index matrix, from the lookup table, search the corresponding element for replacement, and get the pixel replacement matrix Pr. The replacement method is Pr (i, j) = Ltable ( (i, j), Lr (i, j)), where (i, j) indicates the row index and Lr (i, j) indicates the column index. Algorithm 2 is the Latin square replacement process.

Input: Plain image P, Lc, Lr, and Ltable.
Output: Image Pr after pixel replacement.
for i = 0 : 1: N−1 do
  for j = 0:1: N−1 do
      Pr (i, j) = Ltable ( (i, j), Lr (i, j))
  end
end
where bitget (P, i) (i = 1, 2, …, 8) represents obtaining the ith bit plane of the plain image P.
3.5. Bit Scrambling

The pixel value of grayscale images ranges from 0 to 255, and an 8-bit binary sequence can represent each pixel. Therefore, the grayscale image can be decomposed into eight bit-planes, where the ith bit plane is composed of the ith bit of all pixels (i = 1, 2, ..., 8). The high bit-plane contains the visual information of the plain image, and the low-bit plane contains the detailed information of the plain image [19]. Mixing the bits in the high-bit plane and the low-bit plane of the plain image can hide the information of the plain image and improve the security of the algorithm.

To better scramble the bits of the image, we decompose the image into eight bit-planes and then recombine and scramble them. First, the image matrix P is decomposed into eight bit-planes P (1)–P (8). Secondly, the four bit-planes P (1), P (3), P (5), and P (7) of the image matrix P combine into a 2N × 2N bit matrix PA, and the four bit-planes P (2), P (4), P (6), and P (8) of the image matrix P are combined into a 2N × 2N bit matrix PB. Then, intercept 8N elements from the chaotic sequence and divide them into four equal sequences QD1, QD2, QD3, and QD4. Finally, use the sequences QD1 and QD2 to generate the Latin square matrix LH1, and use the sequences QD3 and QD4 to generate the Latin square matrix LH2, LH1, and LH2, respectively used for bit scrambling of matrix PA and matrix PB. Figure 5 shows the bit plane of the image matrix P is scrambled. Decompose the image matrix P into eight bit-planes, and the bit plane P (1) as shown in Figure 5(a). Arrange according to the method shown in Figure 5(b) to obtain a bit matrix PA and a bit matrix PB. Use the matrix LH1 to perform row scrambling on the bit matrix PA to get , use LH2 to perform column scrambling on the bit matrix PB to obtain , as shown in Algorithm 3, the scrambling process. The bit matrix and bit matrix as shown in Figure 5(c) are obtained. Finally, through the bit matrix and bit matrix recombined into eight bit-planes and converted to decimal, the resulting image matrix Pd is shown in Figure 5(d).

Input: Image matrix P, LH1, and LH2.
Output: The image Pd after scrambling.
PA = [bitget (P, 1), bitget (P, 3); bitget (P, 5), bitget (P, 7)]
PB = [bitget (P, 2), bitget (P, 4); bitget (P, 6), bitget (P, 8)]
for i = 1: N
  A = PA (i, :)
  B = PB (:, i)
   (i, :) = A (Lh1 (i, :))
   (:, i) = B (Lh2 (:, i))
end
for i = 0 : 1: 3 do
  Pd (i) =  (i + 1: N × (i + 1))
  Pd (2i+ 1) =  (i + 1: N × (i + 1))
end
3.6. Image Encryption Process

The LSRS algorithm proposed in this paper consists of four parts: key generation, pixel scrambling, pixel replacement, and bit scrambling. The steps of the encryption algorithm are described as follows:

Step 1. Through the image matrix P of size N × N, generate the initial parameters x0, y0, z0, and of the keys. Input the generated keys parameters x0, y0, z0, and into the hyperchaotic Lorenz system, iterate 999 + 3M × M times (when N< 256, M= 256, when N 256, M=N), and discard the first 999 times; the chaotic sequence X, Y, Z, W was obtained.

Step 2. Intercept the first N × N elements of the chaotic sequence X and Y, respectively, as the sequences Qr1 and Qr2; preprocess them according to formula (4); convert them, respectively, into N × N matrix Qrow and matrix Qcol; and perform row scrambling and column scrambling of matrix P on the image to obtain the scrambling image matrix Ps.

Step 3. Intercept the first 512 elements of the chaotic sequence Z, divide them into two equal sequences Qt1 and Qt2, and use them to generate a Latin square matrix Qtable as a lookup table. According to formula (5) to obtain Qs1 and Qs2, respectively convert into N × N matrices Lc and Lr. Through the matrix Lc and the corresponding coordinate element of the image matrix to be replaced to do the addition operation, take the remainder so that the elements in the resulting remainder matrix are between 0 and 255. The matrix and the matrix Lr form a two-dimensional index matrix, and the index matrix is used to select elements from the corresponding coordinates in the matrix Qtable and replace the elements in the matrix Ps to obtain the pixel replacement matrix Pr.

Step 4. Intercept 8N elements from the chaotic sequence , divide them into four sequences QD1, QD2, QD3, and QD4 of equal length. Use QD1 and QD2 to generate Latin square matrix LH1, QD3, and QD4 to generate Latin square matrix LH2. Divide the matrix Pr into eight bit-planes P (1)–P (8), where the four bit-planes P (1), P (3), P (5), and P (7) are combined into a 2N× 2N bit matrix PA, and P (2), P (4), P (6), and P (8) four bit-planes are combined into a 2N× 2N bit matrix PB. Through matrix LH1 to scramble the rows of matrix PA, LH2 performs column scrambling on the matrix PB. The scrambled matrix and matrix are, respectively, divided into four bit-planes, and the resulting bit planes are combined into a bit plane matrix . Convert the elements in the bit plane matrix to decimal data and finally obtained the cipher image C.
The reverse process of the encryption algorithm is the decryption process, which will not be repeated.

3.7. Simulation Results

In order to study the confidentiality performance of the LSDR method, use MATLAB 2019a to simulate the encryption algorithm. The configuration environment of the computer is Windows 10, 8.00 GB RAM, Intel (R) Core (TM) i7-4510 CPU @ 2.00 GHz. Figure 6 shows the plain image, cipher image, and decrypted image of Lena, Boat, Hill, and Peppers. By directly observing the cipher image, no valid information can be identified, so the algorithm is feasible.

4. Experimental Results and Performance Analysis

4.1. Keyspace

The key is the most critical part of the encryption scheme. The larger the keyspace, the stronger the ability to resist brute force attacks, so the key should have enough space to resist brute force attacks. In theory, when the keyspace reaches 2100, it is enough to resist the brute force attacks that currently exist. The algorithm proposed has four parameters x0, y0, z0, and . The calculation accuracy of these four parameters is 10−15, and the keyspace can reach 1060 ≈ 2190, which is much larger than 2100. Therefore, the keyspace of the LSRS algorithm is large enough to protect the security of the image.

4.2. Differential Attack Analysis

Differential attack refers to studying the influence of the difference between plain images on their cipher image and establishing a relationship between the plain image and its corresponding cipher image, thereby cracking the encryption method. The number of Pixel Change Rate (NPCR) and Unified Pixel Average Change Intensity (UACI) are two methods to test whether the encryption method can resist differential attacks [23]. NPCR reflects the ratio of the number of unequal pixels in the same position of two images to the number of all pixels in the image. UACI is the overall average change density, which represents the average change intensity of the planar image. The ideal values of NPCR and UACI are, respectively, 99.6094% and 33.4635%. Assuming that P1 and P2 are two cipher images and their plain images only have a one-bit difference, their NPCR and UACI values are calculated as shown in the following formula:where P1 (i, j) ≠ P2 (i, j), D (i, j) = 1; otherwise, D (i, j) = 1.

Taking Lena image as an example, Table 1 compares the test results of NPCR and UACI under different algorithms. It can be seen that the encryption method we propose can resist differential attacks more effectively.

4.3. Key Sensitivity Analysis

To ensure the security of the encryption algorithm, the encryption algorithm should be highly sensitive to the input key. When the wrong key is entered to decrypt the cipher image, the output is an image that cannot identify any information. The LSDR algorithm proposed in this paper uses the Lena image as a test. First, input the image into the LSDR algorithm to obtain the keys = [x0, y0, z0, ] and the cipher image. The element x0 in the keys is slightly modified by adding 1 to the 15th digit after the decimal point and then using the modified  = [x0 + 10−15, y0, z0, ] to decrypt. Figure 7 shows the decrypted image under the correct key and the decrypted image obtained after modifying the key parameters x0, y0, z0, and , respectively. It can be seen that even if the decryption key changes slightly, the correct decrypted image cannot be obtained. Therefore, the key sensitivity in the LSDR algorithm is high enough to resist all types of brute force attacks.

4.4. Histogram Analysis

The histogram can intuitively reveal the distribution of pixel values in the image. Cipher image has a unified histogram, which can effectively resist statistical analysis, making it difficult for an attacker to obtain valuable information. The more even the pixel distribution in the cipher image, the more ideal the encryption algorithm. As shown in Figure 8, the plain image is input to the LSRS algorithm for encryption, and the histogram of the cipher image obtained is evenly distributed. In addition, the flatness of the histogram can be quantified numerically. The standard method is the chi-square test [24], which is defined aswhere , M × N is the size of the image, and Vi and Vo, respectively, represent the actual and expected frequency of each gray level. Set the significance level as α = 0.05. If is less than  = 293.25 [25], the histogram can be considered to be uniformly distributed. In this paper, test the three images of Lena, Boat, and Hill. From the results in Table 2, it can be seen that the proposed method is lower than the theoretical value of 293.25. Therefore, it can be considered that the program passed the chi-square test.

4.5. Correlation Analysis

The adjacent pixels of the plain image have a high correlation in the horizontal, vertical, and diagonal directions. The ideal encryption algorithm can reduce the correlation of adjacent pixels in the cipher image, thereby effectively resisting statistical attacks. The correlation coefficient calculation formula iswhere x and y are pixel values, cov (x, y) is the covariance, D (x) is the variance, E (x) is the mean, and is the correlation coefficient.

To analyze the correlation between adjacent pixels in the plain image and the cipher image, take Lena image as an example, randomly select 2000 pairs of adjacent pixels in the plain image and the cipher image to test. As shown in Table 3, the distribution of adjacent pixels in the plain image of Lena is highly concentrated, so the correlation between adjacent pixels of the plain image is very high. The distribution of adjacent pixels in the cipher image of Lena is random, which means that after encryption, the correlation between adjacent pixels of the cipher image of Lena is low. By comparing with the other three encryption methods, the results of the LSDR algorithm are also satisfactory.

4.6. Global Shannon Entropy and Local Shannon Entropy

Global Shannon Entropy (GSE) is a disordered statistical measure that reflects the randomness of information. The calculation formula of GSE [26] iswhere Q is the gray level of the image. For 8-bit grayscale images, Q = 255. mi is the ith gray value on the image, and is the probability of mi. In an entirely randomly generated image, the ideal value of GSE is 8. The closer the GSE of the image is to 8, the more random the image information.

Local Shannon Entropy (LSE) is proposed by Wu [27] to measure the randomness of encrypted images. For image P, randomly select k nonoverlapping image blocks S1, S2,…, Sk and TB pixels, and LSE is defined aswhere H (Si) is the Shannon entropy of the image block Si. This article selects (k, TB) = (30, 1936) to test the cipher image. If the value of LSE is in the interval, it means that the randomness is passed inspection; it can be considered that the cipher image has high randomness. Tested by encrypting the images in the USC-S IPI image database, the test results are shown in Table 4. It can be seen from Table 4 that after LSRS algorithm encryption, the GSE of the cipher image is very close to the ideal value, and most of the cipher images have passed the LSE critical value test. It can be considered that the generated cipher images have high randomness.

4.7. Antinoise Attack Analysis and Cropping Attack Analysis

Digital images may lose data or be disturbed by noise due to various reasons during the transmission process. An effective image encryption method can reconstruct an identifiable decrypted image in the case of noise interference or data loss. Add 1%, 5%, and 10% salt and pepper noise to cipher image of Lena, and then decrypt it. As shown in Figure 9, even if a certain salt and pepper noise is added to the cipher image, the information of the decrypted image can still be identified. As shown in Figure 10, cipher images of Lena images are cropped 1/64, 1/16, and 1/4, respectively, and then decrypted, which can identify the information of the decrypted image, so the algorithm can resist the analysis of cropping attacks.

4.8. Efficiency Analysis

The efficiency of image encryption is also one of the important indicators to measure the quality of image encryption methods. The main time-consuming parts of the LSRS algorithm are the iteration of the chaotic sequence, Latin square scrambling, Latin square replacement, and Latin square diffusion. In the simulation, take Lena as an example, we compared the encryption time of four different algorithms. Table 5 lists the running time of each algorithm, and the simulation result shows that the encryption efficiency of the LSRS algorithm is higher.

5. Conclusion

This paper proposes a novel chaotic image encryption algorithm based on Latin square and random shift. The LSRS algorithm adopts the structure of pixel scrambling-replacement-bit scrambling. The generation of Latin squares in the encryption process is related to the chaotic sequence, which improves the security of the entire encryption system. Since the histogram of the Latin square is evenly distributed, use the elements in the Latin square lookup table to replace pixels, and the algorithm can effectively resist differential attacks. Each cipher image corresponds to a Latin square lookup table, which increases the difficulty of the algorithm to decipher. The simulation results prove the safety and effectiveness of the LSRS algorithm.

Data Availability

The data used to support the findings of this study are included within the article.

Conflicts of Interest

The authors declare that they have no conflicts of interest.

Acknowledgments

This work was supported by the National Natural Science Foundation of China, under Grants 62072417, 62102374, 62073299, and U1804262 and the Key Research and Development Program of Henan Province, under Grants 212102210028 and 202102210177.