Secure image encryption algorithm using chaos-based block permutation and weighted bit planes chain diffusion

Summary Aiming at the problem of insufficient security of image encryption technology, a secure image encryption algorithm using chaos-based block permutation and weighted bit planes chain diffusion is proposed, which is based on a variant structure of classical permutation-diffusion. During the permutation phase, the encryption operations of dividing an image into sub-block, block scrambling, block rotation and block inversion, negative-positive transformation, color component shuffling are performed sequentially with chaotic sequences of plaintext association. In the chain diffusion stage, different encryption strategies are adopted for the high and low 4-bit planes according to the weight of image information. Theoretical analyses and empirical results substantiate that the algorithm conforms to the cryptographic requirements of confusion, diffusion, and avalanche effects, while possessing excellent numerical statistical properties with a large cryptographic space. Therefore, the cryptanalysis-propelled security enhancement mechanism proposed in this paper effectively amplifies the aptitude of the algorithm to withstand cryptographic attacks.


Highlights
The proposed encryption algorithm can effectively resist the chosen-plaintext attack Bit level is used as the basic unit of image encryption to ensure higher level of security

Chaos-based dynamic block permutation achieves good confusion with low complexity
The receiver can decrypt the message without transmitting additional plaintext related keys

INTRODUCTION
Today, a variety of emerging information technologies are developing by leaps and bounds.As individuals revel in the dividends of information technologies, latent security concerns are progressively unveiled.2][3] In the era of big data, the secure transmission of digital images has emerged as a pivotal concern, garnering substantial academic attention.5][6] However, due to the distinctiveness of digital images, [7][8][9] such as high correlation of adjacent pixel points, scattering distribution of critical information, and high information redundancy, cryptographic protection using traditional text encryption algorithms struggles to meet real-time performance requirements.][20][21] Throughout the international research status, [22][23][24][25] exploration of chaotic image encryption algorithms [26][27][28][29] has been going through more than 20 years.In as early as 1998, Fridrich 30 firstly reported the use of chaotic system to encrypt digital images.2][33] Various new mechanisms and methods are introduced into chaotic image encryption to enhance the security of the algorithm and elevate the performance of secure transmission.Zheng et al. 34 in 2022 outlined an image encryption technique that uses cascaded chaotic maps and an extended zigzag transform.The simulation results demonstrate that the algorithm provides fast encryption, high security, and effective protection to withstand a broad spectrum of attacks.In 2023, Jiang et al. 35 introduced an image encryption algorithm based on a two-dimensional Chebyshev logistic infinite collapse map.][54][55] a.The existing image encryption algorithms are not structured rationally enough, which leads to their insufficient security against plaintext-type attacks.For this reason, this color image encryption algorithm proposes a plaintext and intermediate ciphertext association mechanism and also adopts chain diffusion to effectively enhance the resistance to cryptographic attacks.b.Pixel-level image encryption is so coarse in granularity that it is not secure enough, and traditional bit-level encryption is too complex to meet the efficiency requirements.To cope with these challenges, this paper proposes a new strategy.We adopt an elastic processing unit in the weighted bit plane, which effectively balances the tension between security and efficiency.c.Different from the traditional permutation methods, this paper designs a new block permutation based on several algebraic operations.Since each module adopted in the permutation is all low-complexity units that are easily implemented by computers, they have good confusion characteristics.The experimental results also effectively support the feasibility of the block permutation method in this paper.d.In image encryption using plaintext correlation, extra channels must be communicated to transmit the feature values of the plaintext.In contrast, we embed the feature values associated with the plaintext and the intermediate ciphertext into the cipher image, and the receiver can achieve normal decryption without additional key exchange, which ensures the usability in practical applications.
The remaining sections of this paper are organized as follows.Section Related theory briefly outlines the relevant theory behind the proposed algorithm.Section Proposed encryption algorithm explains the precise details of our encryption algorithm.Section Experimental results and analysis discussion presents experimental results and analysis discussion.The final section concludes the study.

Related theory
The used chaotic system 2D logistic-sine-coupling map.The chaos 62 utilized in this research is sourced from two established one-dimensional chaotic maps, namely the logistic map and the sine map.By coupling the logistic map and the sine map, we can acquire a new chaotic map of considerable complexity, namely the 2D-LSCM, which can be determined as follows: where q ˛½0; 1 is the control parameter.As the definition suggests, the 2D-LSCM is generated by coupling the logistic and sine maps; the results are further subjected to sine transformation and expanding from one dimension to two.Through this process, the intricacies of the logistic map and the sine map are intertwined, resulting in a complex chaotic behavior.
NIST test results of chaos.A collection of 16 unique test sets is provided by the NIST-800-22 test suite, with the aim of assessing binary sequences generated by cryptographic or pseudo-random number generators that depend on random values and lengths.Notably, all sequences intended for encryption have passed this test correctly, and some of the results are presented in the Table 1.
0-1 Test results of chaos.The 0-1 Gottwald Melbourne test is a tool that calculates parameters very close to 0 or 1 to accurately distinguish between regular and chaotic motion.Our team used the 0-1 Gottwald Melbourne test to obtain 10,000 results, which reflect the average value of 0.9979, exhibiting the remarkable performance of the chaotic system.The test results are illustrated in the following Figure 1.

Bit planes decomposition
A digital image is created by converting an analog image into a digital format, where the pixels serve as the basic element that can be stored and processed by a digital computer or circuit.In computing, a bit is a unit of information and the smallest unit of measurement for bits and information within a binary number.The range of pixel values in an image is ½2 0 À 1; 2 8 À 1. Bit plane decomposition involves converting the pixel values of a digital image into binary form and then dividing the binary representation into eight-bit planes.Taking a digital image P as an example, the bit planes decomposition can be expressed as 2 kÀ 1 P k = P 1 + 2P 2 + 2 2 P 3 + 2 3 P 4 + 2 4 P 5 + 2 5 P 6 + 2 6 P 7 + 2 7 P 8 (Equation 2) where P k denotes the k À th bit plane, k = ½1; 2; 3; .; 8, Pði; jÞ ˛Z256 , P k ði; jÞ ˛Z2 ; P 8 denotes the highest bit planes, and P 1 denotes the lowests bit planes.Taking the grayscale image of ''Lena'' as an example, the bit planes decomposition diagram is shown in Figure 2.

Block permutation
Standard scrambling algorithms, which simply rearrange the pixel positions within the primitive image, can be easily deciphered and are susceptible to chosen-plaintext attacks.To address this problem, this paper introduces a new scrambling algorithm that uses chaotic sequences based on the plaintext feedback mechanism, as shown in Figure 3. Firstly, the image feature values are extracted as chaotic keys to generate an initial pseudo-random sequence.Then, the original image and initial chaotic sequence are preprocessed.Finally, different encryption rules can be selected according to the preprocessed sequences, and the generated cipher images can be obtained by block scrambling, block rotation and block inversion, negative-positive transformation, and color component shuffling.The empirical data demonstrate that the permutation mechanism proposed in this manuscript significantly enhances the algorithm's resilience against attacks.

Proposed encryption algorithm
The proposed encryption algorithm is specified based on the following four sections: the first part, key generation and initial value scrambling; the second part, an explanation of the user-defined ''chain function''; the third part, the process of image encryption; and the fourth part, the key 1 = hð1Þ4hð5Þ4hð9Þ4hð13Þ4hð17Þ4hð21Þ4hð25Þ4hð29Þ + 0:1 ðaÞ key 2 = hð2Þ4hð6Þ4hð10Þ4hð14Þ4hð18Þ4hð22Þ4hð26Þ4hð30Þ + 0:1 ðbÞ key 3 = hð3Þ4hð7Þ4hð11Þ4hð15Þ4hð31Þ4hð23Þ4hð27Þ4hð31Þ + 0:1 ðcÞ key 4 = hð4Þ4hð8Þ4hð12Þ4hð16Þ4hð20Þ4hð24Þ4hð28Þ4hð32Þ + 0:1 ðdÞ (Equation 3) where 4 denotes the XOR operator; key 1 ; key 2 ; key 3 ; key 4 denote the scrambled keys.

Chain function
Chain encryption function.For ease of description, we define the details of the operation for each plane as a self-named function C = Chain encryptðP;keyÞ, where P represents the plain image, key denotes the initial value utilized to generate the chaotic sequence for encrypting the image plane, and C denotes the cipher image.The function contains two parts: sequence preprocessing and permutation-diffusion encryption.Take the example of encrypting an image with size H3W as described below: Step 1: preprocess chaotic sequence For the chain encryption module, a total of two chaotic sequences are required.Key is introduced into the 2D-LSCM chaotic system, and the initial chaotic sequences R 1 and R 2 are obtained after iterating H3W times.The corresponding sorted indexes indexH and indexW can be described as 4) where sortð $Þ function represents the sorting of each sequence value in the input sequence from lowest to highest, S 1 and S 2 indicate the result of reordering the sequences, and indexH and indexW indicate sorted indexes.
Step 2: permutation and diffusion encryption  5) where m = ½1; 2; .;H and n = ½1; 2; .;W. C denotes the image that is waiting to be decrypted, and key denotes the initial key to generate the desired chaotic sequences.

Chain decryption function.
After putting the key into the chaotic system, it iterates H3W times to obtain two chaotic sequences R 0 1 and R 0 2 .Substituted into the Equation 4, the sorted index sequence indexH 0 ðmÞ and indexW 0 ðnÞ can be obtained, respectively.The decryption process is shown in Equation 6.

Encryption process
In this section, an original image P of size H3W will be used as an example to illustrate the encryption process.The first encryption is a block permutation operation after chunking the original image.In this article, we choose to divide the image into small blocks with a length of 8, and the process is as follows.
Step 1: preprocess image and sequence Initially, the plaintext image P is divided into segments and transformed into a matrix format, ensuring that the matrix dimensions are multiples of 8 for both rows and columns.If there are not enough elements in the matrix, the zeroes are filled.Then, the hash eigenvalues of the image P are read and key 1 ; key 2 ; key 3 ; key 4 are obtained as chaotic initial values according to Equation 3. The four initial values are iterated by the 2D-LSCM system to obtain four pseudo-random sequences S 1 ;S 2 ;S 3 ;S 4 .And they are preprocessed according to the Equation 7 to obtain sequences S 0 1 ; S 0 2 ; S 0 3 ; S 0 4 that can be used for block scrambling operation.The pretreatment Equation 7 is described as 7) where P: $R indicates rounding down, and modð $Þ represents modulo operation.
Step 2: block scrambling The specific diagram of block scrambling is shown in Figure 5.The operation of block scrambling is as follows: (Equation 8) where x = ½1; 2;.;H, y = ½1; 2;.;W, i = ½1; 2;.;H 3 W =8 2 , z signifies the dimension of the matrix, t indicates the intermediate variable, and B represents the matrix after block scrambling.
Step 3: block rotation and block inversion Based on the sequence S 0 2 , block rotation and block inversion are performed on the data in the sub-block.Taking the matrix after block scrambling encryption as an example, the matrix after inverse encryption is obtained by using the method constructed in Algorithm 1, and the schematic of block rotation and inversion is shown in Figure 6.
Step 5: color component shuffling Based on the sequence S 0 4 , the corresponding RGB color transformation is applied to the processed matrix using Algorithm 2. The specific color component shuffling schematic is shown in Figure 7.
The matrix after block encryption is merged to get block permutated image BCðBlockCipherÞ.
Next, it will be subjected to a random order substitution operation.
Step 6: random order substitution The key 1 and key 2 are substituted into the chaotic system iteration to obtain the sequences S and S 0 .The index matrix I is achieved by arranging the sequence S 0 .Random order substitution of cipher images is carried out using index matrix I with sequence S. The random order substitution can be explained as follows: BC I i;j ;j + BC I H;W ;W + j 2 32 3 S I i;j ;j k mod 256 for i = 1;j = 1 BC I i;j ;j + BC I iÀ 1;W ;W + j 2 32 3 S I i;j ;j k mod 256 for i = 2 $W ; j = 1 BC I i;j ;j + BC I i;jÀ 1 ;jÀ 1 + j 2 32 3 S I i;j ;j k mod 256 for i = 1 $W ; j = 2 $W (Equation 10) After obtaining image Q, it will be subjected to bit-layered and chained encryption.
Step 7: bit planes decomposition After reading the image Q and splitting it according to the three channels, three grayscale images Q R , Q G , and Q B are obtained, which are bit planes decomposition, respectively.It can be expressed as

<
: 11) where function bitgetðA; bitÞ denotes the bit value at position k in A is returned, Q Rk , Q Gk , and Q Bk denote the images obtained by layering Q R , Q G , and Q B , and k denotes the k À th bit plane, k = ½1; 2; 3; 4; 5; 6; 7; 8. Taking R channel as an example, the other two channels are the same.Specifically, the obtained 8 layered images are Step 8: hide original image feature values in the first bit plane In order to facilitate the decryption operation by the recipient, the hash value of the original image needs to be stored in the first line of layered image Q R1 .It is worth noting that, as shown by the analysis in Section Bit planes decomposition, the first layer of the bit plane contains very little information.Taking a 256 3 256 size image as an example, the proportion of the feature value in the original image is only 0.000586%.Even if the decrypted image is enlarged, it is difficult to observe the difference with the naked eye.
Step 9: encrypt Q R5 with key 1 12) Step 10: chain encrypt Q R6 ; Q R7 ; Q R8 After the fifth layer cipher image C R5 is obtained, the hash eigenvalue is read and substituted into the Equation 3 (a), and the chaotic initial value key 5 used to encrypt the next layer is obtained.The encryption of the sixth layer bit plane is given below: 13) The encryption method for the images Q R7 ; Q R8 is the same as earlier and can be expressed by the Equation 14. 14) Step 11: chain encrypt For the low-order bit plane, only a small amount of image information is contained, so the same chaotic sequence will be used to encrypt the four layers of Q R1 ;Q R2 ;Q R3 ;Q R4 .Similarly, after reading the eigenvalues of C R8 and performing the processing as in Equation 3 (a), the key 8 is obtained, and the encryption of these four layers can be expressed as 8 > > < > > : 15) Step 12: compound bit planes The encrypted images 16) where C R denotes the final cipher image of the R channel after reduction.Similarly, we can get the cipher image C G ; C B after the chain encryption of G channel and B channel, and the resulting cipher image C is obtained after the reduction of three channels.

Decryption process
Decryption is the reverse process of encryption.The flow chart of decryption is shown in Figure 8.For simplicity, a brief description of the decryption process is as follows.
Step  The recipient extracts the eigenvalues of the original image stored in the first line of C R5 and obtains the key 1 according to the Equation 3 (a).The decrypted image Q R5 of the fifth layer plane can be obtained.The specific operation is described as 17) Step 3: chain decryption of the remaining bit planes decomposition 18) Step 4: recovery bit planes decomposition 19) So far, we get the image Q R of R channel after chain decryption.Similarly, the decrypted image Q G ; Q B of the remaining two channels can be obtained, and the image Q is obtained after compounding the three channels.
Step 5: decrypt random order substitution After substituting the extracted hash eigenvalue of the original image into the formula Eq. (3)(b), the key 2 can be obtained.After substituting the key 1 and key 2 into the chaotic system, two chaotic sequences S and S 0 can be obtained, respectively.The index matrix I is obtained after S 0 is sorted by the sort($) function.The random order substitution decryption formula is given as follows: 32 3 S I i;j ;j k mod 256 for i = 2 $W ; j = 1 Q I i;j ;j À Q I H;W ;W + j 2 32 3 S I i;j ;j k mod 256 for i = 1; j = 1 (Equation 20) So far, the decrypted image BC can be obtained, which is the cipher image only encrypted by block permutation.
Step 6: decrypt block permutation Deblock permutation is the inverse operation of block permutation encryption.Firstly, pseudo-random sequences are generated through 2D-LSCM chaotic system using the key, followed by the image being segmented into blocks, and then block the image BC.According to the generated sequence, the decryption operations of color component scrambling, positive-negative transformation, block rotation and block inversion, and block permutation are performed in turn.Finally, the decrypted images are combined to obtain the final decrypted image P.

Experimental environment
We utilized a personal computer (PC) equipped with MATLAB R2023a software as our experimental platform.The system was powered by an AMD Ryzen 9 5950X central processing unit (CPU), featuring a clock frequency of 3.88 GHz.The device had 32 GB of memory and a 4TB hard drive, operating on the Windows 10 operating system.USC-SIPI image database was used in the experimental data selection.
Experimental results and analysis Histogram analysis.Figure 9 displays the 3D visualization of the pixel distribution prior to and following the encryption of three channels, enabling an observation of the cross-plane encryption effect.This visualization serves as a simple yet effective demonstration of the algorithm's ability to achieve high-performance encryption.Meanwhile, we selected five other images of different types and encrypted them.The renderings and histograms are presented in Figure 10.The original image shows a certain statistical law, while the statistical characteristics of the encrypted image histograms show a noise-like distribution, which well hides the gray value information of the images.This measure strengthens the resilience against statistical analysis attacks.
Adjacent pixel correlation analysis.Ordinary images are typically composed of pixels that have a high degree of neighborhood correlation.However, when using a robust encryption algorithm, the encrypted image should ideally have no association between individual pixels and their nearby counterparts.Therefore, a reliable encryption scheme should transform a regular image into an encrypted image with minimal correlation among neighboring pixels.
To evaluate the correlation between adjacent pixels in both plaintext and cipher images, we took the following measures.First, we randomly selected 3,000 pairs of neighboring pixel points from both the plaintext and cipher images.Secondly, we computed the correlation coefficients of the neighboring pixels in diverse orientations such as horizontal, vertical, diagonal, and anti-diagonal directions individually.In accordance with Equation 21, the correlation coefficients are calculated as follows: 21) where x i and y i form the first pair of horizontal/vertical/diagonal/anti-diagonal adjacent pixels and M is the total number of horizontal/vertical/ diagonal/anti-diagonal adjacent pixels.The correlation between adjacent pixels data of the encrypted image is shown in Figure 11. Figure 11 shows the adjacent pixel distribution of the RGB channels before and after "Lena" image encryption.Experimental data indicate a pronounced contrast in the correlation coefficients between typical images and their encrypted counterparts.In particular, the correlation coefficient for a normal image has a value close to 1, while that for an encrypted image is approximately equal to 0. This highlights the ability of the proposed encryption scheme to generate images with uncorrelated neighboring pixels, emphasizing its resistance to statistical attacks.Therefore, the scheme presented in this study can be considered as highly secure.
Differential statistical analysis.Two standards are typically used to measure the dissimilarity between the source image and its encrypted version: the number of pixel change rate (NPCR) and the uniform average change intensity (UACI).In standard disparate attacks, attackers tend to make subtle modifications to the source image and then encrypt the original image using the proposed algorithm.This approach allows them to reveal the underlying relationship between the original and encrypted images.NPCR and UACI criteria are commonly used to evaluate the resistance of an encryption scheme to disparate attacks.The equations for calculating NPCR and UACI are as follows: (Equation 22) where H3W represents the size of the image, and v 1 ; v 2 is the cipher image before and after changing one pixel of the plaintext image.D can be defined by the Equation 23.Tables 2 and 3 show the algorithm's outcomes as computed per Equation 22.These tables reveal that NPCR and UACI align closely with their expected values of 99.6094% and 33.4635%, respectively.Our algorithm has been further compared with classical algorithms 63,64 and other algorithms, 65 with the comparative results presented in both Figures 12 and 13.The results obtained indicate that the proposed encryption scheme exhibits sensitivity to variations in the source image, allowing the generation of two unique encrypted images even in the presence of a single difference bit.This substantiates the effectuality and robustness of the presented cryptosystem to changes in the input image, increasing its overall reliability and viability for various real-world applications.

Information entropy analysis
The degree of randomness in a system is typically assessed by using the entropy of the information as a standard metric.For an information source m, the information entropy HðmÞ is given by   24) where L represents the total number of pixels.The probability of m i is denoted by pðm i Þ.
Suppose the source sends 256 symbols and we can get the theoretical value HðmÞ = 8 using Equation 24.The closer it is to 8, the less likely it is that an attacker will be able to successfully decode the encrypted image.The Lena image is used as the experimental image of information entropy (size: 256 3 256, type: color).Table 4 compares the entropy values and shows that the experimental results are close to 8.This indicates that the proposed algorithm has good entropy properties.

Image quality analysis
In the realm of image processing, peak signal to noise ratio (PSNR) and structural similarity (SSIM) are served as standard metrics for assessing the quality of encryption.The mean square error (MSE) is part of the PSNR, defined as   25) where MSE represents the mean square error between the plaintext image X and the cipher image Y.The vertical extent of the image is represented by H, and the horizontal dimension of the image is denoted by W. The pixel level of the image is denoted by Q. SSIM is a measure of the similarity between two images, explained as 26) where the mean values of image X is denoted by m X and the mean values of image Y is denoted by m Y .The standard deviation of image X is denoted by s X , the standard deviation of image Y is represented by s Y , and L indicates the dynamic amplitude of pixel values.
As shown in the Table 5, the values of MSE, PSNR, and SSIM can be determined using mathematical Equations 25 and 26.Ideally, the PSNR of an encrypted image should be around 10 dB, while the SSIM should be between À1 and 1.An absolute SSIM value close to 1 indicates excellent similarity between the images being compared.Therefore, after encryption, variations in SSIM should fluctuate around 0.

Key space
The key space denotes the encompassing set of all conceivable keys that can be utilized for key generation.The magnitude of the key space is contingent upon the length of secure keys and serves as a critical determinant of the strength of a cryptosystem.It is one of the most important parameters in the overall assessment of the robustness and reliability of a cryptographic system.The image encryption  algorithm proposed in this paper utilizes a 2D discrete chaotic system, and the expression of its key space can be given as S ˛fa; b; q; MD5g, where a; b; q are the key parameters with precision 10 À 16 and MD5 are the hash value introduced to enhance the key space, which can generate a 128-bit hash.The approximate estimation of the key space size for this encryption scheme is 10 3316 3 2 128 z2 287 .By analyzing Table 6, it becomes evident that our proposed encryption scheme not only demonstrates a notable advantage in terms of the key space over existing schemes but also contributes to the enhanced resilience of our encryption algorithm against various types of attacks.

Sensitivity analysis
This section analyses the performance sensitivity of the algorithm separately for both key and plaintext.It is essential that security algorithms have a high level of sensitivity.This implies that even minute alterations in the encryption or decryption process, such as modifications to the key or variations in the plaintext information, will result in incorrect outcomes.
Key sensitivity analysis.Key sensitivity analysis is performed by comparing the resulting ciphertexts when the identical image is encrypted using two comparable keys.Our study examines the difference in the resulting ciphertext obtained from encrypting with the actual key and encryption using an additional key that contains slight perturbations.The difference between these two results is then evaluated using NPCR and UACI, as calculated via Equation 22, with the consequences presented in Table 7.Interestingly, the consequences express that, even when the key is subjected to slight perturbations, the resulting NPCR and UACI values of the commensurating ciphertext are close to the

This Article
Ref. 71 72 Ref. 73 Ref. 74 287 128 166 154 224 ideal values of 99.6094% and 33.4635%, respectively.Figure 14 shows the statistical results of NPCR and UACI under different disturbance parameters.In addition, it can be clearly seen from Figure 14 that NPCR and UACI are very close to the ideal values, indicating that the proposed algorithm has good key sensitivity, so it can effectively resist differential attacks and chosen-plaintext attacks.
Plaintext sensitivity analysis.Plaintext sensitivity refers to the degree of change in the resulting ciphertext when the plaintext pixels are changed.If an algorithm ignores plaintext sensitivity, it becomes vulnerable to attacks that exploit the comparison between plaintext and ciphertext pairs.Consequently, the measure of plaintext sensitivity is a crucial element in determining the robustness of the algorithm against plaintext attacks.In this section, we analyze the sensitivity of the proposed algorithm to ordinary images by adding 1 to the pixel values of ordinary images at ðH=3; W=3Þ, ðH=3; 2 3 W=3Þ, ð2 3 H=3; W=3Þ, and ð2 3H=3; 2 3W=3Þ to calculate the NPCR and UACI.The results are presented in Table 8, and the comparison images are shown in Figure 15; the dotted line in the figure is the average value of NPCR and UACI for the corresponding color.As indicated in Table 8, when the pixel values at the selected locations are varied by 1, the corresponding encrypted images exhibit a remarkable average NPCR score of 99.6101% compared to the original ciphertext, which is close to the ideal value of 99.6094%.Additionally, an average UACI score of 33.4743% is observed, which is also close to the desirable UACI value of 33.4635%.Based on the results, we can observe that the proposed algorithm makes the cryptographic images susceptible to significant modification, making it insurmountable for attackers to compromise the system by comparing the ciphertexts.Consequently, the proposed algorithm is sufficiently equipped to withstand various types of plaintext attacks.

The complexity and execution time analysis
We gauge the complexity of the proposed algorithm by measuring the computational time required for encryption and assess its suitability for real-time applications.In this encryption scheme, the most critical four steps are chaotic sequence generation, image scrambling, replacement, and bit-level chain diffusion.Their complexity is Oð7 3 H 3 W + 3 =8 3 H 3 WÞ, Oð7 =8 3 H 3 WÞ, OðH 3 WÞ, and Oð8 3 H 3 WÞ, respectively.Thus, the total complexity is Oð8 3 H 3 WÞ.Table 9 provides a comparison of encryption times between our proposed algorithm and corresponding algorithms in the literature.It is noteworthy that the encryption time data in Table 9 were using computers with varying processing capabilities and memory configurations to comprehensively evaluate algorithm performance.Such comparisons aid in determining which encryption algorithm is best suited to meet security and performance requirements under specific hardware and environmental conditions.

Robustness analysis
Robustness is an important index in the evaluation of image encryption algorithm.It measures whether the encryption algorithm can effectively protect the content of the image from damage or leakage in the face of various interference noises.In the real world, images may be affected by a variety of disturbances.Therefore, it is very important to analyze and evaluate the anti-interference ability of image encryption algorithm.In this section, salt and pepper noise and occlusion attack are selected for analysis.
Salt and pepper noise analysis.

Conclusion
This paper presents a comprehensive encryption algorithm for enhancing image security by combining chaos-based block permutation and bit planes chain diffusion.Our approach aims to improve the security of image encryption, enhance its ability to withstand cryptographic attacks in existing computing environments, and ensure secure communication of digital images in networked environments.To begin, we propose a novel block permutation encryption algorithm that employs chaotic sequences to perform various operations on the plaintext image, such as block scrambling, rotation, inversion, positive/negative transformation, and color component transformation.These operations generate an intermediate cipher image, effectively safeguarding the confidentiality of the image.We introduce the random order substitution method, which further increases the difficulty for the attacker to crack the ciphertext.Last but not least, we utilize the hierarchical structure of the bit plane and chain diffusion to generate the final ciphertext.By incorporating these mechanisms, the avalanche effect is enhanced, thus increasing the security of the encryption.Experimental results demonstrate that our proposed algorithm has high security and robustness, making it highly resistant to various cryptographic attacks.Therefore, the image encryption algorithm reported in this paper is a preferred secure communication technology solution, which has a broad application prospect in the secure transmission of multimedia information in big data environments, etc.

Limitations of the study
There may be some possible limitations in this study.In robustness analysis, there is a very small probability of damaging the original hidden key, resulting in the ciphertext not being able to be restored.

STAR+METHODS
Detailed methods are provided in the online version of this paper and include the following:

Information entropy analysis
The degree of randomness in a system is typically assessed by using the entropy of the information as a standard metric.For an information source m, the information entropy HðmÞ is given by: where L represents the total number of pixels.The probability of m i is denoted by pðm i Þ.

Image quality analysis
In the realm of image processing, Peak Signal to Noise Ratio (PSNR) and Structural Similarity (SSIM) are served as standard metrics for assessing the quality of encryption.The Mean Square Error (MSE) is part of the PSNR, defined as:

Figure 4 .
Figure 4. Diagram depicting the procedural flow of the proposed encryption algorithm

Figure 5 .
Figure 5. Diagram illustrating block scrambling 1: bit planes decomposition After dividing the cipher image C into RGB three channels, we get C R ;C G ;C B .Take the R channel as an example; the remaining two channels are the same.According to Equation 11, 8-bit planes C R1 ; C R2 ; C R3 ; C R4 ; C R5 ; C R6 ; C R7 ; C R8 are obtained.

Figure 8 .
Figure 8.The flow chart of decryption

Figure 9 .
Figure 9. Images before and after encryption and their 3D histograms (A) Plain image and cipher image.(B) Red channel.(C) Green channel.(D) Blue channel.

Figure 10 .
Figure 10.The images before and after encryption and their 2D histogram (A) Plain images.(B) Histogram of (A).(C) Cipher images.(D) Histogram of (C).

Figure 11 .
Figure 11.Analysis results of adjacent pixels of plain and cipher images (A) Red channel.(B) Green channel.(C) Blue channel.

Figure 12 .
Figure 12. Results of NPCR visualization across different algorithms for comparison

Figure 13 .
Figure 13.Comparison results of UACI visualization with different algorithms

Figure 16 .
Figure 16.The cipher and decryption image after adding salt and pepper noise (A) Add 5% salt and pepper noise.(B) Add 10% salt and pepper noise.(C) Add 20% salt and pepper noise.

W 2 where
ðXði; jÞ À Y ði; jÞÞ 2 PSNR = 10 3 log 10 Q 2 MSE !where MSE represents the mean square error between the plaintext image X and the ciphertext image Y.The vertical extent of the image is represented by H, the horizontal dimension of the image is denoted by W. The pixel level of the image is denoted by Q. SSIM is a measure of the similarity between two images, explained as: SSIMðX; Y Þ = 2m X m Y +ð0:01LÞ 2 2s XY +ð0:03LÞ 2 the mean values of image X is denoted by m X , the mean values of image Y is denoted by m Y .The standard deviation of image X is denoted by s X , the standard deviation of image Y is represented by s Y and L indicates the dynamic amplitude of pixel values.

Table 2 .
NPCR values of the matching cipher images by distinct algorithms

Table 3 .
UACI values of the matching cipher images by distinct algorithms

Table 4 .
The results of information entropy analysis for distinct algorithms

Table 6 .
Table of key space comparisons

Table 7 .
Comparison of average encryption times Respectively add occlusion noise, whose sizes are 56 3 56, 81 3 81, and 114 3 114, into cipher image, and we can see from Figure 17 that the image adding noise can still have effective recognizable image information after decryption.
â ; 4 GB Figure 14.Comparison conclusions of NPCR and UACI presentation with various levels of disturbance Occlusion attack analysis.

Table 9 .
Plaintext sensitivity test results H3W represents the size of the image, v 1 ; v 2 is the cipher image before and after changing one pixel of the plaintext image.D can be defined: if v 1 ði; jÞ = v 2 ði; jÞ 1; if v 0 ði; jÞsv 2 ði; jÞ where