# An Image-Encryption Algorithm Based on Stage-Merging Bit Scrambling
## 1 Introduction  
With the advancement of technology and society, people's demand for information has exploded, and the channel of information exchange also tends to be transmitted through the internet. As one of the main carriers of information transmission, digital images are frequently used in sensitive fields such as personal life, medical care, and military affairs. Due to the virtual and open nature of the internet, there is a risk of theft or tampering during the transmission of digital images. Bit scrambling is an image-encryption method that changes the pixel value by scrambling the bits of the pixel value. It has been paid growing attention by scholars in recent years. In 2014, [PERSON] et al. [1] proposed an image-encryption algorithm with dual scrambling of the pixel position and bit. The algorithm first scrambles the pixel position, then extracts the eight decimal places of the chaotic value to generate a sorting index sequence, and scrambles the 8 bits of each pixel value in turn. Since the algorithm uses the sum of the pixel values as the connection between the chaotic sequence and the plain image, the correlation is not strong. In 2016, [PERSON] et al. [2] proposed a different bit-scrambling algorithm. After the pixel position is scrambled, the pixel bits are scrambled by comparing the size of two adjacent numbers in the chaotic sequence. If the former is greater than the latter, the first 4 bits and the last 4 bits of the current pixel value are exchanged; otherwise, the odd and even bits are exchanged in turn. The algorithm uses three chaotic sequences, but only one is associated with the sum of the pixel values of the plain image, while the other two sequences are generated independently of the plain image, and the diffusion process only uses forward diffusion, which is not secure. It has been deciphered in [3]. In 2018, the authors of [4, 5] proposed different position-scrambling methods, and the binary cycle shift for each pixel value to achieve bit scrambling. The difference between them lies in the addition of DNA coding, DNA replacement operations, and DNA decoding before positivediffusion. In 2020, [PERSON] et al. [6] proposed a new multi-chaotic image-encryption algorithm based on cyclic shift, which designed a new position-scrambling process and replaced pixels by an index matrix obtained by chaotic sequence sorting. After that, a cyclic shift and forward diffusion were carried out. Since the generation of the chaotic sequence of the algorithm has no relationship with the plain image, the ability to resist differential attack is weak. The bit-scrambling algorithms mentioned above are different from each other, but have a common point, that is, they all perform bit scrambling for a single pixel. In the above algorithm, the proportion of 0 bit and 1 bit of a single pixel does not change before and after bit scrambling, which also causes the bit-scrambling stage to be insensitive to the chaotic sequences used. During decryption, except the bit-scrambling stage, the rough outline of the plain image can be recognized from the decrypted image. In response to this problem, [PERSON] et al. [7] designed an image-encryption algorithm based on adjacent-pixel bit scrambling in 2020. The algorithm first converts the image into a one-dimensional sequence and performs global position scrambling, and then iterates through the sequence, swapping the specific bits of adjacent pixels. It designs two exchange methods, selects with a chaotic value of 0.5 as the threshold, and finally diffuses the pixel value in both directions. The bit-scrambling stage of the algorithm is sensitive to chaotic sequences, but the information entropy of the intermediate cipher image obtained by bit scrambling is not ideal. In 2022, [PERSON] et al. [8] proposed another adjacent-pixel bit scrambling method, which uses a newly-designed fill curve to complete the position scrambling, and uses an improved Joseph traversal to scramble the adjacent four pixels. The scrambling effect is favorable, but the scrambling speed is slow.