Security issues and privacy issues are serious problems facing today’s society, especially in image security, where privacy protection plays a pivotal role. To improve the security of images, we propose an image encryption algorithm based on optical chaos and Rubik’s cube matrix in this paper. First, optical chaos is generated by constructing an optical device model. Second, in the image encryption algorithm, optical chaos and Rubik’s cube matrix are used to encrypt the image at the bit level for the first time, and a “U” type encryption method is designed, and different “U” type encryption schemes are selected to encrypt the image for the second time. Finally, the “four-way diffusion” algorithm is used to diffuse the encrypted image, which further improves the security of the image. The computer simulations and security analysis results both confirm that ciphertext images can resist various common attack means, such as statistical attacks, differential attacks, and brute force attacks. In this paper, the proposed algorithm of decimal conversion, “U” encryption, and “quadrangle diffusion” makes the pixel value and pixel position change greatly, and the ciphertext image loses the original features of the plaintext image, which shows that the algorithm has good security performance and is suitable for image encryptions.

## I. INTRODUCTION

In recent years, due to the rapid development of the Internet and communication technology, people’s information exchange has become more concentrated on the network, and many criminals are willing to steal personal, corporate, and even national information to seek profits. As an important carrier of information transmission, image security has attracted the attention of many researchers.^{1} Aiming to protect transmitted images from external attacks, a large number of image encryption algorithms have been proposed.^{2}

In 1989, Matthews proposed the chaotic sequence encryption scheme, which has since created a new field in the direction of chaotic encryption.^{3} With the in-depth study of chaos theory and the special properties of chaos, including initial value sensitivity, quasi-randomness, ergodicity, and complex nonlinear dynamic behavior,^{4} chaos has more advantages in image encryption compared with traditional encryption schemes.^{5} However, they also have some disadvantages, such as high implementation cost, complex performance, and low speed.^{6} The study of optical chaos began after the theoretical model of semiconductor laser was established.^{7} When compared with traditional electrical chaos, optical chaos encryption technology has advantages such as excellent computing speed, multi-bit information storage, and parallel processing,^{8} and has been widely used in the field of image security. For example, in 2013, Chen *et al.*^{9} proposed an optical image encryption method using vector synthesis with multi-beam interference. In 2016, Xie *et al.*^{10} proposed the optical chaotic image encryption and transmission system for the first time. Ciphertext images encrypted by optical chaos could be transmitted through a chaotic carrier. In 2018, Fu *et al.*^{11} proposed a fast and secure symmetric image encryption transmission system using semiconductor lasers based on the DNA encryption algorithm and the system containing double chaos and used current-mode logic (CML) chaos to scramble optical chaos, which overcomes the weakness that the mapping period of low-weft chaos is not large. In 2019, Li *et al.*^{12} proposed a color image encryption system for the first time to realize security resource-sharing technology in the cloud and introduced a watermarking method for image privacy authentication in the cloud technology. Although the above scheme combines the advantages of optical chaotic image encryption and has high optical chaotic security, it has few innovations in image encryption algorithms.

The encryption system based on bit-level permutation (BLP), as a new image encryption algorithm,^{13} can effectively eliminate the statistical characteristics of the image. In the encryption process, BLP takes bits as the basic unit of encryption, regards the image as a three-dimensional matrix (width, height, and bit), and carries out scrambling and diffusion operations. In 2021, Li and Zhang^{14} designed the multi-bit arrangement and diffusion determined by the hyperchaotic sequence, proposing that not only 8-bit bits can be used for encryption operations but also more bits of data can be used. In encryption, *n* bits (1–8 bits) are selected as the processing units for scrambling and diffusion, and bits of different lengths are used for encryption. More bit-level data increases the diversity of the encryption unit. Combining the advantages of optical chaos and bit-level arrangement, a bit-level image encryption algorithm based on optical chaos is considered. In 2023, Chen *et al.*^{15} proposed an image encryption algorithm based on optical chaos and DNA Rubik’s cube scrambling, which reduces the amount of encrypted data and further improves the security of image encryption using encryption selection of different DNA encoding modes.

Based on the above analysis and to move beyond, we present a new image encryption transmission algorithm based on optical chaos and Rubik’s cube matrix. The main contributions of this paper are summarized as follows:

In the image encryption algorithm, scrambling encryption can be the change of pixel value or the change of pixel position. One of the innovations of this paper is to incorporate these two scrambling methods to encrypt the image at the bit level and the position, respectively:

Pixel value change: The Rubik’s cube matrix is used for scrambling encryption at the bit level of the image. First, the decimal pixel value of the image is converted into a four-digit quadrilateral pixel value. Second, the four-digit quadrilateral is randomly paired with an encrypted sequence and then converted into the form of coordinates. Third, the corresponding coordinates are found in the Rubik’s cube matrix and converted into decimal, that is, the changed pixel value.

Pixel position change: The “U” type encryption algorithm is proposed to scramble the position of image pixels. The image is divided into several small blocks, and a different “U” type encryption method is selected for each block according to the encryption sequence.

The diffusion algorithm can eliminate the correlation of images very well. In this paper, the “quadrangle diffusion” algorithm is presented to diffuse the four directions of the upper, lower, left, and right of the image, which can mess up the relevance of the image even better. In addition, to strengthen the security of the algorithm, nine selection methods are designed to select

*n*(0–8) bits of the encryption sequence for the XOR algorithm.We have simplified the device for generating light chaos and the proposed device consists of one main laser and two slave lasers. Optical chaos is generated by a light injection method based on one main laser and two secondary lasers, which are used for encrypting the plaintext image and transmitting the ciphertext image.

The remainder of the paper is organized as follows: In Sec. II, we introduce encryption system models and image encryption algorithms in detail. In Sec. III, optical chaos and dynamic performance are analyzed. In Sec. IV, security analyses are presented. Finally, the conclusion of this paper is reported in Sec. V.

## II. ENCRYPTION SYSTEM MODEL AND METHOD

The encryption system model proposed in this paper is shown in Fig. 1 (Test image Pavilion). The light emitted by the main laser (ML) is reflected by the reflector M into the laser cavity, which disturbs the interaction between carriers and photons in the laser and increases the complexity of the system. The optical isolator and neutral density filter then ensure that the ML output light can be one-way injected into the semiconductor lasers (SL1 and SL2), and the beam splitter (splitter1) transmits the ML output light to the two SLs separately. The external crosstalk of the laser can enhance its nonlinear dynamic behavior. When SLs receive the injected optical chaos, more complex optical chaos signals can be generated inside the SLs. Since SL1 and SL2 have the same laser parameters, they have synchronous chaotic signals, which provides technical support for secure communication.

SL1, as the sender of information, is mainly used for information encryption. The chaotic signal generated by SL1 is divided into two parts by splitter2. One part is converted into a digital signal by PD1 to generate an encryption sequence, and the other part carries optical information for transmission. The plaintext image (SHA-512) hash value of the pixels’ sum of the original image alongside the external key is employed to produce the new keys of the second round, then using the new key to change the encryption sequence generated by the optical chaos at the sender end, and combining the encryption algorithm to encrypt the plaintext image, the ciphertext image is obtained. Ciphertext images can be converted into optical signals under SL3 and MZM modulation, combined with a chaos carrier through a chaos mask (CMS), and transmitted to the receiving end in single mode fiber (SMF). In addition, the sender should not only transmit the information of the ciphertext image but also use the optical switch (OS) to transmit the key. When the OS is ON, the key is transmitted; otherwise, the optical information is transmitted.

As the receiver of the decrypted information, SL2 can decrypt the plaintext image according to the decryption algorithm after receiving the encrypted image and key. Therefore, the whole system can achieve secure image encryption and transmission, can encrypt and transmit ciphertext images in the optical communication system, and can successfully decrypt the received images.

### A. Dynamic equation of laser

^{16}the dynamic characteristics of the designed chaotic laser system can be described as

*i*is 1–3, which represents three slave lasers,

*E*

_{M,i}, represents the slow variable field complex amplitude of ML and SL, and

*N*

_{M,i}represents the number of carriers of the main and slave lasers. The internal parameters of the laser are as follows:

*K*

_{f}and

*t*

_{f}represent the feedback intensity and feedback delay of the mirror, respectively;

*K*

_{inj}and τ

_{i}represent the injection intensity and delay, respectively.

*∂*represents the linewidth enhancement factor; $Ei$ is the number of photons; $GNi,\u2009Ei2$ is the gain function;

*g*represents the differential gain of the laser;

*e*is the charge per electron; γ and γ

_{e}represent the photon decay rate and carrier decay rate, respectively;

*w*is the angular frequency of light; ɛ is the dielectric constant of vacuum;

*n*is the refractive index of semiconductor medium;

*G*is the differential gain;

*N*

_{0}is the number of transparent carriers; and

*S*is the saturation coefficient.

### B. Scrambling mode

Image scrambling can be divided into a change in pixel value or a change in pixel position. In this scheme, “decimal conversion” is to use Rubik’s cube matrix to realize the change of image pixel value and the “U” type encryption algorithm is the change of pixel position.

The change in image pixel value in this scheme is as follows:

The decimal pixel value of the plaintext image is transformed into a quaternary pixel value of four digits.

The encryption sequence C5 is used to pair the four quadrilaterals to obtain two sets of data, and the two sets of data are “packaged” into the form of coordinates.

The corresponding coordinate values are obtained in the 4 × 4 Rubik’s cube matrix using their coordinates and converted into hexadecimal.

At last, the obtained two hexadecimal values are merged and converted back to decimal, and the pixel values are obtained as the changed pixel values.

Rubik’s cube matrix: scrambling specific process:

Step 1: Enter the plaintext image P, the Rubik’s cube matrix A, and the systematically generated chaotic sequence C.

Step 2: Change the various pixels of the plaintext image P into the form of a quadruple system {a1, a2, a3, a4}.

Step 3: According to the value of chaotic sequence C, the quartet {a1, a2, a3, a4} random arrangement combination, a total of A44 ways, get the arranged combination {×1, ×2, ×3, ×4}.

Step 4: Combine ×1 and ×2 in the combinations {×1, ×2, ×3, and ×4} into coordinate forms (×1, ×2), find the corresponding matrix values h1 in the cube matrix A, ×3 and ×4 in the equivalent combination find the corresponding matrix values h2 in A in the cube matrix, and convert h1 and h2 into hexadecimal;

Step 5: The h1 and h2 are combined to get m and transform m into decimal form, so the Rubik’s Cube matrix algorithm is encrypted.

The encryption algorithm is as follows (Algorithm 1):

function Pixel image encryption Input: P, C5. The definition of C5 is as apseudo-random sequence. P is a two-dimensional plaintext image with order ⌈(h×w)⌉. |

choose: This is a permutation combination algorithm with four quadruple numbers,with A_{4}^{4} methods. |

imageConvertQuanternary = dec2base(P, n); |

p = str2num(imageConvertQuanternary); |

for i = 1 : h * w |

arrange = choose(mod(C5(i), 24)); |

reP1(i, 1) = A(p(i, arrange(1)) + 1, p(i, arrange(2)) + 1); |

reP2(i, 1) = A(p(i, arrange(3)) + 1, p(i, arrange(4)) + 1); |

end |

imageHex1 = dec2base(reP1, 16); |

imageHex2 = dec2base(reP2, 16); |

scramblingImage1 = [imageHex1, imageHex2]; |

scramblingImage1 = hex2dec(scramblingImage1); |

scramblingImage1 = reshape(scramblingImage1, [h, w]); |

Output:Image scramblingImage1 |

function Pixel image encryption Input: P, C5. The definition of C5 is as apseudo-random sequence. P is a two-dimensional plaintext image with order ⌈(h×w)⌉. |

choose: This is a permutation combination algorithm with four quadruple numbers,with A_{4}^{4} methods. |

imageConvertQuanternary = dec2base(P, n); |

p = str2num(imageConvertQuanternary); |

for i = 1 : h * w |

arrange = choose(mod(C5(i), 24)); |

reP1(i, 1) = A(p(i, arrange(1)) + 1, p(i, arrange(2)) + 1); |

reP2(i, 1) = A(p(i, arrange(3)) + 1, p(i, arrange(4)) + 1); |

end |

imageHex1 = dec2base(reP1, 16); |

imageHex2 = dec2base(reP2, 16); |

scramblingImage1 = [imageHex1, imageHex2]; |

scramblingImage1 = hex2dec(scramblingImage1); |

scramblingImage1 = reshape(scramblingImage1, [h, w]); |

Output:Image scramblingImage1 |

function Pixel image encryption Input:scramblingImage1, C6. The definitionof C6 is as a pseudo-random sequence. scramblingImage1 is an image of size [h,w]; |

uEncryptedmethod1-8: Different u-type encryption algorithms are selectedaccording to the chaotic sequence. |

U = mod(C6, 8); pieceImage = mat2cell(scramblingImage1, dim1Dist, dim1Dist); |

for i = 1 : h |

if(U(i) = = 0) pieceScrambling = uEncryptedmethod1(pieceImage(i)); |

if(U(i) == 1) pieceScrambling = uEncryptedmethod2(pieceImage(i)); |

if(U(i) == 2) pieceScrambling = uEncryptedmethod3(pieceImage(i)); |

if(U(i) == 3) pieceScrambling = uEncryptedmethod4(pieceImage(i)); |

if(U(i) == 4) pieceScrambling = uEncryptedmethod5(pieceImage(i)); |

if(U(i) == 5) pieceScrambling = uEncryptedmethod6(pieceImage(i)); |

if(U(i) == 6) pieceScrambling = uEncryptedmethod7(pieceImage(i)); |

if(U(i) == 7) pieceScrambling = uEncryptedmethod8(pieceImage(i)); |

end |

scramblingImage2 = double(pieceScrambling); |

Output:Image scramblingImage2 |

function Pixel image encryption Input:scramblingImage1, C6. The definitionof C6 is as a pseudo-random sequence. scramblingImage1 is an image of size [h,w]; |

uEncryptedmethod1-8: Different u-type encryption algorithms are selectedaccording to the chaotic sequence. |

U = mod(C6, 8); pieceImage = mat2cell(scramblingImage1, dim1Dist, dim1Dist); |

for i = 1 : h |

if(U(i) = = 0) pieceScrambling = uEncryptedmethod1(pieceImage(i)); |

if(U(i) == 1) pieceScrambling = uEncryptedmethod2(pieceImage(i)); |

if(U(i) == 2) pieceScrambling = uEncryptedmethod3(pieceImage(i)); |

if(U(i) == 3) pieceScrambling = uEncryptedmethod4(pieceImage(i)); |

if(U(i) == 4) pieceScrambling = uEncryptedmethod5(pieceImage(i)); |

if(U(i) == 5) pieceScrambling = uEncryptedmethod6(pieceImage(i)); |

if(U(i) == 6) pieceScrambling = uEncryptedmethod7(pieceImage(i)); |

if(U(i) == 7) pieceScrambling = uEncryptedmethod8(pieceImage(i)); |

end |

scramblingImage2 = double(pieceScrambling); |

Output:Image scramblingImage2 |

As shown in Fig. 2, taking the image pixel value 231 as an example is given below:

Step 1: Change the decimal 231 into the four-digit quaternary 1323.

Step 2: Combine into two coordinates (1, 3) and (2, 3) by H value, then the coordinates are added by 1 (due to the characteristics of MATLAB, the coordinates start from 1), and the coordinates (2, 4) and (3, 4) are obtained.

Step 3: Find the corresponding coordinate value in the Rubik’s cube matrix using its coordinates, and convert it into hexadecimal (7, E).

Step 4: Combine the two hexadecimal numbers and convert them to decimal to get the converted pixel value. It can be seen from the results that there is a big difference between the pixel values before and after the change.

The encryption algorithm is as follows (Algorithm 2):

As shown in Fig. 4, we take one of the “U” type encryption as an example, and select a part of the matrix of a subblock. When U = 5, the subblock is encrypted in the direction of clockwise by Scheme 1, and several sequences obtained by encryption are merged into a long sequence, and the “U” type encryption of this subblock is completed. In the 16 × 16 subblock, the length of the encrypted combination is 256, which is regarded as a column of the encrypted image, and the “U” type encryption algorithm is applied to each subblock to obtain the scrambled encrypted image.

### C. Diffusion mode

In the diffusion stage, pixel values are changed at the bit level of the chaotic sequence to improve the security of the encryption algorithm. Ordinary diffusion algorithms generally only carry out forward diffusion and reverse diffusion in one or two directions. In this paper, a diffusion algorithm in four directions (i.e., up, down, left, and right) is adopted to better disrupt the correlation of images. In addition, nine selection methods are designed to select the (0–8) n bits of the encryption sequence for the XOR algorithm.

The encryption algorithm is as follows (Algorithm 3):

function Pixel image diffusion Input:scramblingImage2, C0-3. Thedefinition of C0-3 is as a pseudo-random sequence. scramblingImage2 isan image of size [h,w]; |

imageForwardDiffusion, imageBackDiffusion, imageLeftDiffusion andimageRightDiffusion is the diffusion algorithm in the forward, reverse, leftand right directions. |

imageForwardDiffusion = quartetDiffusion1(scramblingImage2, C0); |

imageBackDiffusion = quartetDiffusion2(imageForwardDiffusion, C1); |

imageLeftDiffusion = quartetDiffusion3(imageBackDiffusion, C2); |

imageRightDiffusion = quartetDiffusion4(imageLeftDiffusion, C3); |

imageDiffusion = double(imageRightDiffusion); |

Output:Image imageDiffusion |

function Pixel image diffusion Input:scramblingImage2, C0-3. Thedefinition of C0-3 is as a pseudo-random sequence. scramblingImage2 isan image of size [h,w]; |

imageForwardDiffusion, imageBackDiffusion, imageLeftDiffusion andimageRightDiffusion is the diffusion algorithm in the forward, reverse, leftand right directions. |

imageForwardDiffusion = quartetDiffusion1(scramblingImage2, C0); |

imageBackDiffusion = quartetDiffusion2(imageForwardDiffusion, C1); |

imageLeftDiffusion = quartetDiffusion3(imageBackDiffusion, C2); |

imageRightDiffusion = quartetDiffusion4(imageLeftDiffusion, C3); |

imageDiffusion = double(imageRightDiffusion); |

Output:Image imageDiffusion |

Taking Fig. 5 as an example, the “quadrilateral diffusion” algorithm is carried out for pixel point 134 in the four directions of pixel values, respectively.

### D. Encryption procedure

The specific encryption steps are as follows:

**Step 1**: First, chaotic sequence C0 is generated by optical injection. After the hash value, key1 of the external key is XOR with the hash value H1 of the cleartext image, which is combined with C0 to obtain a new chaotic sequence C by the algorithm. C1, C2, C3, C4, and C5 are the encryption sequences of M × N length extracted from C, and C6 is the encryption sequence of M length:(6)$C=bitxorC0,keymod(C0,64)+1.$**Step 2:**The encryption sequence C5 is used to encrypt the plaintext image for the first time:(7)$p=dec2baseP,n,$(8)$z=choosemod(C5,24)+1,$where P is the plaintext image, p is the quaternary image after P conversion, n is 4,(9)$x=dec2baseApi,z1+1,pi,z2+1,16y=dec2baseApi,z3+1,pi,\u2009z4+1,16p1=hex2dec(x,y),$*i*is from 1 to 256 × 256, A stands for Rubik’s Cube matrix, and z (*i*) has 24 permutations and combinations. As shown in Fig. 6, taking z (1) as an example, it can be the first, second, third, or last value of the quaternary system, and z (*i*) is determined by the encryption sequence C5; p1 is the scrambled image for the first time.**Step 3**: Divide p1 into several blocks of the same size. In this scheme, 256 × 256 images are divided into 16 × 16 blocks, and the size of each block is 16 × 16.**Step 4**: Use C6 as the encryption sequence of “U” type encryption, and carry out the “U” type encryption algorithm for each block, then the scrambling is completed. Each block (length of 256) is used as a column of the scrambled image to obtain the second scrambled encrypted image.**Step 5:**Perform the quadrilateral diffusion algorithm on the obtained encrypted image, as shown below:where(10)$a=modAj\u22121i+Aj\u22121i\xb11+Cji,256b=bitgetCji,modCji,9A\u2032j=bitXORa,b,$*j*is from 1 to 4,*A*_{j}is the image of*j*th diffuses, C_{j}is several encrypted sequences generated by chaos, and*i*is 256 × 256. Finally, the ciphertext image is obtained.

### E. Decryption

In our system, encryption and decryption are symmetric. Thus, the decryption process is the inverse of encryption. So the decrypted image can be obtained by inverting the encryption algorithm.

## III. NUMERICAL SIMULATION AND ANALYSIS

### A. Laser chaos

To study the complexity of chaos and chaos synchronization, the fourth-order Runge–Kutta algorithm^{17} is used to solve Eqs. (1)–(4). The internal parameters of the laser are shown in Table I.

Parameters . | Value . | Parameters . | Value . |
---|---|---|---|

∂ | 3 | g | 1.2 × 10^{−5} |

K_{f} | 30 | N_{0} | 1.25 × 10^{8} |

τ_{f} | 1.2 | S | 5 × 10^{−7} |

K_{inj} | 50 | γ | 496 |

e | 1.6 × 10^{−19} | C | 3 × 10^{8} |

γ_{e} | 0.65 | τ_{1} | 3 |

ɛ | 1 | τ_{2} | 3 |

Parameters . | Value . | Parameters . | Value . |
---|---|---|---|

∂ | 3 | g | 1.2 × 10^{−5} |

K_{f} | 30 | N_{0} | 1.25 × 10^{8} |

τ_{f} | 1.2 | S | 5 × 10^{−7} |

K_{inj} | 50 | γ | 496 |

e | 1.6 × 10^{−19} | C | 3 × 10^{8} |

γ_{e} | 0.65 | τ_{1} | 3 |

ɛ | 1 | τ_{2} | 3 |

Figures 7(a) and 7(b) show the time series of SL1 and SL2, and it can be seen that the two lasers are operating in a chaotic state. Figures 7(c) and 7(d) show the power spectrum of SL1 and SL2. Based on these graphs, we can notice that they exhibit global stability and local instability, and the one-to-many features indicate that the signal is unpredictable.

### B. Chaos synchronization

^{18}as follows:

*x*

_{1}(

*t*) and

*y*

_{1}(

*t*) are the corresponding transmitting end chaos and receiving end chaos, respectively, and ⟨

*x*

_{1}(

*t*)⟩ and ⟨

*y*

_{1}(

*t*)⟩ represents the average value. The value of C ranges from 0 to 1. The closer the value of C is to 1, the better the quality of chaos synchronization. Ideally, C is equal to 1 when

*t*is equal to 0.

Figure 8 shows the cross-correlation function between SL1 and SL2. It can be seen from the figure that when *t* is 0, the cross-correlation function is almost 1, indicating that the system achieves high-quality chaotic synchronization.

## IV. SECURITY ANALYSIS

To verify the feasibility and security of the proposed encryption algorithm, various common security attacks, such as statistical attacks, differential attacks, and brute force attacks, are discussed and analyzed in this section. Experimental simulation was carried out on MATLAB. 256 × 256 gray test images, and the encryption effect is shown in Fig. 9.

### A. Key space analysis

The key is one of the most important parts of the encryption scheme, and the key space is equal to the number of all the available keys in the algorithm. A good encryption algorithm needs a large key space to resist brute force attacks, and the size of the key space directly affects the security of the encryption algorithm. Generally speaking, when the encryption algorithm of the key space is >2^{100}, the key space of the algorithm is relatively secure. The external key to the proposed scheme is a 64-bit hexadecimal sequence, while the internal key is widely used. It can be seen that the key space of this paper is >2^{100}, that is, it can effectively resist all types of brute force attacks.

### B. Key sensitivity analysis

To ensure the security of the encryption algorithm, the algorithm should have a strong sensitivity to the key; even a slight change in the key will produce incorrect results. In this part, we investigate the sensitivity of key changes to encryption and decryption algorithms.

The original external key is

“CDBA7C7154D4D6B4E1B4E1BF43403FF48A4A8A4A2A2761DC239A399A3960D0E6.”

When changing an external key, keys to

“ADBA7C7154D4D6B4E1B4E1BF43403FF48A4A8A4A2A2761DC239A399A3960D0E6.”

Next, we will observe whether these two keys can complete the encryption and decryption of the image. Figure 10 shows both the decryption image under the correct key and the decryption image obtained by changing the key. It can be seen that the key sensitivity of this scheme is high enough to resist brute force attacks.

### C. Histogram statistics

*σ*

_{i}is the frequency of gray value

*i*, and e

_{i}is the expected frequency of gray value

*i*.

When χ^{2} is <293.25, the histogram can be considered uniformly distributed. In this paper, three images of Gate, Flower, and Pavilion were tested and compared with other algorithms. As can be seen from the results in Table II, the chi-square value of the ciphertext value is significantly lower than that of the plaintext chi-square value, which can well hide the statistical characteristics of images.

Different images . | $\chi test2$ . | Results . |
---|---|---|

Plaintext Gate | 26 185.9453 | Unsuccessful |

Ciphertext Gate | 253.4844 | Successful |

Plaintext Flower | 35 353.9453 | Unsuccessful |

Ciphertext Flower | 280.8125 | Successful |

Plaintext Pavilion | 21 809.3171 | Unsuccessful |

Ciphertext Pavilion | 229.8281 | Successful |

Different images . | $\chi test2$ . | Results . |
---|---|---|

Plaintext Gate | 26 185.9453 | Unsuccessful |

Ciphertext Gate | 253.4844 | Successful |

Plaintext Flower | 35 353.9453 | Unsuccessful |

Ciphertext Flower | 280.8125 | Successful |

Plaintext Pavilion | 21 809.3171 | Unsuccessful |

Ciphertext Pavilion | 229.8281 | Successful |

### D. Correlation analysis

*E*(

*u*) represents the covariance of variable

*u*,

*D*(

*u*) represents the variance of

*u*,

*u*and

*v*represent the gray values of two adjacent pixels, and

*N*is the 10 000 pairs of pixels selected from the image.

To analyze the correlation between adjacent pixels in plaintext images and ciphertext images, Flower and Pavilion images are taken as examples, and 10 000 pixels are randomly selected in plaintext images and ciphertext images to test adjacent pixels. Figure 12 reflects the horizontal, vertical, and diagonal correlations of their adjacent pixels. It can be seen from them that the distribution of adjacent pixels in the plaintext image is highly concentrated, so the correlation between adjacent pixels in the plaintext image is very high. The distribution of adjacent pixels in the ciphertext image is random, that is, after encryption, the correlation between adjacent pixels in the ciphertext image is low.

The correlation analysis of the different algorithms is given in Table III. The results of the proposed algorithm are also satisfactory in comparison with the other three encryption methods. Through the correlation with plaintext images, it can be seen that the correlation coefficient of ciphertext images almost approaches 0, which proves that the image encryption algorithm of this system can eliminate the correlation of adjacent pixels of plaintext images, and the results are satisfactory.

Algorithm . | Horizontal . | Vertical . | Diagonal . |
---|---|---|---|

Plaintext Pavilion | 0.810 3 | 0.814 4 | 0.761 0 |

Ciphertext Pavilion | −0.002 0 | −0.018 6 | −0.007 1 |

Reference 19 | 0.000 57 | 0.002 8 | −0.001 4 |

Reference 20 | 0.001 7 | 0.000 92 | 0.001 1 |

Reference 21 | 0.005 2 | −0.000 11 | −0.002 2 |

Reference 22 | 0.000 43 | 0.004 8 | −0.004 0 |

Reference 23 | 0.000 12 | 0.000 11 | 0.001 78 |

Reference 24 | −0.001 5 | 0.001 8 | 0.001 8 |

Algorithm . | Horizontal . | Vertical . | Diagonal . |
---|---|---|---|

Plaintext Pavilion | 0.810 3 | 0.814 4 | 0.761 0 |

Ciphertext Pavilion | −0.002 0 | −0.018 6 | −0.007 1 |

Reference 19 | 0.000 57 | 0.002 8 | −0.001 4 |

Reference 20 | 0.001 7 | 0.000 92 | 0.001 1 |

Reference 21 | 0.005 2 | −0.000 11 | −0.002 2 |

Reference 22 | 0.000 43 | 0.004 8 | −0.004 0 |

Reference 23 | 0.000 12 | 0.000 11 | 0.001 78 |

Reference 24 | −0.001 5 | 0.001 8 | 0.001 8 |

### E. Differential attack analysis

To verify whether the encryption algorithm can resist differential attacks, we take the Pavilion image as an example and randomly change the value of a pixel in the plaintext image. Table IV shows the test results of NPCR and UACI under different algorithms. As can be seen from Table IV, NPCR is about 99.61 and UACI is about 33.46. Therefore, it can be interpreted that there is a big difference between plaintext and ciphertext. The encryption algorithm of the proposed system is very sensitive even when only one pixel changes, and it is difficult for the attacker to obtain plaintext information from ciphertext information. Compared with other algorithms, the effect of this system may be slightly worse in UACI but NPCR has a clear advantage, and it indicates that the encryption algorithm of this system has a strong ability to resist differential attacks.

Algorithms . | NPCR . | UACI . |
---|---|---|

Proposed | 99.6109 | 33.4688 |

Reference 25 | 99.5144 | 32.7495 |

Reference 26 | 99.6114 | 33.5499 |

Reference 27 | 99.6101 | 33.4583 |

Reference 28 | 99.6140 | 33.5463 |

Reference 29 | 99.646 52 | 33.462 89 |

### F. Information entropy

*L*is the number of gray value levels in the image and

*p*(

*i*) represents the probability of gray value

*i*appearing.

In the information entropy test, we calculate the information entropy of the ciphertext image compared with the plaintext image. In addition, the information entropy comparison between our proposed scheme and other schemes is shown in Table V. It can be seen that in our proposed scheme, the information entropy of different ciphertext images is higher than that of plaintext images, which is closer to the theoretical value of 8. The ciphertext images of this scheme have greater information entropy than the ciphertext images of other schemes. Therefore, it is proven that the performance of this scheme is better than that of other schemes in avoiding information entropy attacks.

Algorithm . | Plaintext image . | Ciphertext image . |
---|---|---|

Proposed (Pavilion) | 7.2563 | 7.9975 |

Reference 30 | 7.3814 | 7.9564 |

Reference 31 | 7.4425 | 7.9975 |

Reference 32 | 7.445 57 | 7.999 35 |

Reference 33 | 7.445 077 | 7.999 33 |

Reference 34 | 7.5827 | 7.9995 |

### G. Cut attack analysis

In the process of image transmission or image encryption, it may encounter packet loss or be affected by external factors. A qualified image encryption system should be able to deal with certain data loss and certain noise effects. To detect the robustness of the system, the ciphertext image is tested and divided into blocks using a light and dark attack, and the attribute information of the plaintext image can be recovered by the decrypted image, so as to prove the robustness of the image encryption algorithm of the system and its ability to resist data loss.

In this subsection, the lost ciphertext image is simulated and analyzed to test whether the ciphertext images with lost data can restore the characteristics of the plaintext images.

As shown in Fig. 13, the image Pavilion has been cut to varying degrees. Despite the expansion of the cut area, the decrypted image can still see the characteristics of the plaintext image. It shows that the encryption algorithm can effectively resist the cutting attack and restore the plaintext image when losing part of the information.

## V. CONCLUSION

In this paper, an image encryption and transmission scheme based on optical chaos is proposed by introducing the bit-level arrangement algorithm. The “decimal conversion” and “U” encryption algorithms designed in this scheme greatly change the pixel value and pixel position of the plaintext image, while the “quadrangular diffusion” algorithm effectively eliminates the correlation between adjacent pixels in the image. The results of security analysis show that each index of ciphertext image is close to the ideal value, and the algorithm can effectively resist statistical attacks, differential attacks, and brute force attacks, which have high security and certain practicability. However, due to various practical factors, the synchronization performance of chaos may not reach the ideal state, which limits the decryption of ciphertext images, resulting in the inability to complete the decryption of images. In our future work, we can not only stay at the level of simulation experiments but also need to consider the impact of various environmental factors in detail.

## ACKNOWLEDGMENTS

Primary Research and Development Plan of Zhejiang Province (Grant No. 2023C03014) and Key Research and Development Program of Zhejiang Province (Grant No. 2022C03037).

## AUTHOR DECLARATIONS

### Conflict of Interest

The authors have no conflicts to disclose.

### Author Contributions

**Xuefang Zhou**: Conceptualization; Funding acquisition (equal); Writing – review & editing (equal). **Le Sun**: Investigation (equal); Project administration (equal); Writing – original draft (equal). **Ning Zheng**: Formal analysis (equal); Methodology (equal). **Weihao Chen**: Conceptualization (equal); Validation (equal).

## DATA AVAILABILITY

The data that support the findings of this study are available from the corresponding authors upon reasonable request.