A New Digital Image Encryption Algorithm Based on Improved Logistic Mapping and Josephus Circle

Digital image encryption based on Joseph circle and Chaotic system has become a hot spot in the research of image encryption. An encryption algorithm based on improved Josephus loop and logistic mapping is proposed to scrambling blocks in this paper. At first, the original image is scrambled by using logistic mapping to obtain the encrypted image, and then the encrypted image is divided into many blocks. Finally, the position of the blocked image is scrambled by using the improved Josephus ring to get the encrypted image. According to the experiments, the information entropy of the encrypted image reaches 7.99 and the adjacent correlations in three directions are within ±0.1. The experimental results show that the proposed algorithm has advantages of large key space, high key sensitivity and can effectively resist the attacks of statistical analysis and gray value analysis. It has good encryption effect on digital image encryption.


Introduction
With the rapid development of the application of multimedia technology on the Internet, more and more images are transmitted in the network, such as malicious serial image information, interception and so on, which brings convenience to users and causes a series of potential safety problems.Therefore, it is very important to ensure the security of image information in the process of network transmission.Among the technologies of guarantee image security [1], image encryption [1] is a more intuitive method and the essence of image encryption is pixel scrambling [2].
In 1998, Fridrich proposed an image encryption algorithm based on permutation and confusion structure in [1].[2] [3] discussed the use of Arnold mapping for pixel replacement, in which [3] also incorporates discrete Chen mapping of pixel values for permutation confusion; [4] [5] [6] [7] used the randomness of one-dimensional chaotic sequence to scramble the pixel position of the image to realize encryption; [8] proposed an image bit encryption algorithm based on Joseph's ergodic and generalized Henon mapping.The security image to be encrypted Hash Algorithm 1 (SHA-1) summary and user-selected encryption parameters are combined as the key to drive Generalized Henon Mapping to randomly disturb the starting position, the reported number of intervals and the reported direction of the improved Josephus traversal map, so that different encrypted images and encryption parameters correspond substantially to different site replacement processes and added a site obfuscation process to improve the security of site replacement.[9] proposed an image pixels scrambling by Tent chaotic mapping and then using S-box permutation of color image encryption algorithm at the bit; [8]- [14] introduced a bit-based encryption algorithm; [15] proposed improved the Logistic map by using scale transformation, constructing robust system and composite mapping respectively.[16] proposed an image encryption with chaotically coupled chaotic maps.[17] proposed an image encryption algorithm based on Brownian motion and image, and introduced a new one-dimensional chaotic system.[18] analyzed the security of image encryption algorithm based on the incorrect fractional-order chaotic system.In [19], a data invariant encryption algorithm based on improved Logistic mapping is proposed.The image encryption performance is analyzed and studied and some indexes of encryption performance evaluation are also given in the [3] [20].
The above works used some pixel value replacement methods in the process of encryption, such as compute of encryption pixels and adjacent elements [4], operations of encryption pixel gray value and key [9] [10] [11] [13] and so on.None of these algorithms involve encrypting the original image first, followed by blocking the entire encrypted image and then scrambling the block.Therefore, this paper presents a digital image encryption algorithm based on improved Josephus loop and improved logistic mapping to scramble block.The images selected by this algorithm are all gray-scale image.The simulation experiments are carried out by Matlab, and the experimental results are evaluated by the evaluation indexes of information entropy, histogram, fixed point ratio and adjacent pixel correlation.The experimental results show that the proposed algorithm has advantages of large key space, high key sensitivity and can effectively resist the attacks of statistical analysis and gray value analysis.It has good encryption effect on digital image encryption.Journal of Computer and Communications According to the Joseph problem, we can uniquely identify an arrangement of n elements in the order of elimination.Given n and m, we can uniquely obtain a permutation constructed by ( to replace it with 3, 2, 4, 1.In order to increase the permutation variables generated by Joseph's traversal mappings, the application of Josephus rings is now augmented by an interval q constraint, which results in the randomness of the resulting permutations and increases their key space during the image's encryption.After increasing the interval q, the corresponding Joseph-ergodic mapping becomes

Improved Logistic Mapping
In 1976, American ecological mathematician May proposed a logistic mapping model used to simulate the growth behavior of biological populations.It is very simple in mathematical form, but its dynamic behavior is complicated by its nonlinear chaotic system.In the process of image encryption has a wide range of applications.The equation is: where n and u are system parameters.When 1, 2, n = and 3.75 4 u ≤ ≤ , the system is chaotic.In order to expand the encryption key of digital image, many researchers have improved the logistic mapping equation.For example, the improved logistic mapping equation is [14]: .
Its chaotic map is shown in Figure 1.In order to make the encrypted image more secure, the Equation ( 2) is made the following improvements.The equation is: , the system is chaotic.Its chaotic map is shown in Figure 2. Compared with the sequence generated by the chaotic mapping in (2), the sequence in ( 3) is more chaotic and transformable.At the same time, the value range of k is increased so that the key space of the encryption algorithm also increases.
After the above improvement, 2.1 effectively increases the substitution variable generated by Joseph's ergodic mapping, and 2.2 effectively enhances the chaos state, transformativeness and the range of k of the logistic mapping sequence.

Encryption Algorithm Description
At first, the original image is scrambled by using logistic mapping to obtain the encrypted image, then the encrypted image is divided into many blocks.Finally, Journal of Computer and Communications  the position of the blocked image is scrambled by using the improved Josephus ring to get the encrypted image.
Given a M × N grayscale image, the encryption steps are described as following: Step 1: Enter the encrypted grayscale image Q, the size of the image is M × N, let L = M × N.
Step 2: Enter the keys 1 0 , , , u x k l , where 1 u is the control parameter of the logistic chaotic map, 0 x is the initial value of the logistic chaotic map, and , k is the control index of the equation, l is the range of the chaotic sequence converted to an integer and 100 l L < < .This article take 256 l = by using the formula (3), and then modifies each component i x of T to obtain the key vector of the sequence 1  and the vector 1 T as the image encryption.
Step 4: convert the image Q from M × N matrix to one-dimensional row vec- T and B to obtain another one-dimensional vector  , and then convert C to an M × N matrix to obtain the image 1 E encrypted with the improved logistic map.
Step 6: Input 1 1 , m n , where 1 m is the pixel of each line after the block, 1 n is the column pixel of each block after the block; and the values of A and B are respectively the factors of M and N. The values of A and B may be the same or different.
Step 7: Partition the encrypted image 1 E to obtain 1 1  m n × matrix of ( ) ( ) Step 8: Enter m, q, where m is the number of the first few to come up with this one, q is the number of intervals.
Step 9: Write ( ) ( ) , where ( ) 1, 2, , N n are the numbering from left to right of 1 1  m n × array in the first row, ( ) ( ) are the numbering of the C (that is, the numbering in step 9) are arranged in a matrix of ( ) ( ) , where X is ( ) ( ) M m N n × matrix), and then these 1 1  m n × matrix of corresponding number are got into the X to get a disorganized block image.
Step 11: The block image in the tenth step is restored to M ×N image, which is the final encrypted image E.

Decryption Algorithm Description
Step 1: Input the final encrypted image E in step 11 above.
Step 2: Enter the correct 1 1 , m n to block the encrypted image E.
Step 3: Enter the correct m, q for scrambling the restoration of the block to be restored encrypted image.
Step 4: restoring the restored encrypted block image to an M × N encrypted image again.
Step 5: Enter the correct key 1 0 , , , u x k l , and perform the exclusive-OR opera- tion on the M × N encrypted image to obtain the decrypted image.

Experimental Platform
PC configuration: Intel (R) Celeron (R) CPU N3450 @ 1.10 GHz 1.10 GHz, memory 4 GB, win 10 64 bit operating system.Through the Matlab R2014a programming to achieve the above encryption algorithm.

Experimental Results
The experiments selected four grayscale images of lena, baboon, boat and couple, Journal of Computer and Communications in which the pixel value of the first image was 1024 × 1024 and the pixel values of the remaining images were both 512 × 512.The algorithm of this paper is used to test the selected four images.Figure 3 shows the comparison of plaintext, ciphertext and decrypted images.It can be seen from Figure 3 that the encrypted image has become cluttered and visually distinct from the plaintext image, showing that the algorithm has a good encrypted visual effect and the decrypted image is completely correct, indicating that the algorithm in this paper can correctly implement the role of image encryption and decryption.

Key Space and Key Sensitivity Analysis
Image encryption algorithm should have enough key space and the sensitivity of key changes, so as to effectively defend against attacks.The key of this algorithm consists of 8 parameters of , , , l m n m and p, the key space of this algorithm is more than 10 37 (calculated with a computer precision of 10 −15 ) and has a good ability to resist attacks.The comparison results with other algorithms are shown in Table 1.
The sensitivity of the key can be divided into the sensitivity of the encryption and the sensitivity of the decryption.In the encryption process, the sensitivity  Ref. [16] Key space 10 37 2 106 1.2 × 10 24 can be reflected by the slight transformation of the key.We use to calculate the rate of change of ciphertext image to reflect the key encryption sensitivity, which is calculated as: where i E is a ciphertext image encrypted by the initial key, i E′ is a ciphertext image encrypted with a small change of the key, and ( ) Dif E E′ is the number of elements with different pixel values in i E and i E′ .The following were lena, baboon, boat image as an example.x is changed to 0.50000000000001.Through the formula (4) calculated the rate of change between the two images was 99.59%.Figure 5(d 6(c) is the encrypted image E′ whose key k is changed to 9.80000000000001.By formula (4) calculated the rate of change between the two images was 99.61%.Sensitivity analysis of several parameters in the logistic map above, the following parameters 1 1   , , , m n m p are used to get on decryption analysis, the experiment chose the classic lena image and only analyzes 1 m and p (the other two parameters 1 n and m were similar to those of 1 m and p).m changed to 128. Figure 8 test the influences of key p on the decryption process.Figure 8(a The experimental results from Figures 4-6 show that the ciphertext changes rate is above 99% even though the key changes slightly in the encryption process.In the process of decryption, even if the key changes slightly, it can not get the correct decryption image.The experimental results from Figure 7, Figure 8 show that when 1 1  , , , m n m p are different from the values entered during encryption, only a small portion of small images can be decrypted, however, most other small blocks are not easy to decrypt, which shows that this algorithm has good key sensitivity and encryption effect.

Histogram Analysis
Histograms can well reflect the distribution of image pixel values.The smoother the histogram is, the more uniform the pixel values are. Figure 9 shows the histograms of the original image and the encrypted image of the lena and baboon images, respectively.

Image Encryption Fixed Point Ratio Analysis
According to the literature [3] [20], the fixed point refers to the pixel whose gray value does not change before and after the image is encrypted.The fixed point ratio is the percentage of the fixed point of the image and all pixels, which is calculated as follows: ( ) , , 100% where ( ) From the formula (5) to calculate the fixed point of the encryption algorithm as shown in Table 2.

Average Gray Value Change Analysis
After the image is encrypted, the gray value of many pixels will change.The fixed point ratio only reflects the change of the gray level in quantity, but it can not reflect the changed degree of the gray level.Therefore, in order to better evaluate the changed degree of gray-scale of encrypted image, the following gives the average changed value of gray [3] [20].The formula is as follows: where G is a plain text image and C is an encrypted image.According to formula (6) calculate the average gray value of the encryption algorithm changes as shown in Table 3.

Information Entropy Analysis
Information entropy reflects the distribution of image gray values.The more uniform the gray value of images is, the larger the information entropy of images is.On the contrary, the entropy of information is smaller [20].Information entropy is calculated as follows: ( ) ( ) ( ) The information entropy of the original image and the ciphertext image calculated according to formula (7) are shown in Table 4.

Neighborhood Pixel Correlation Analysis
The correlation of adjacent pixels is used to evaluate the effect of image encryption algorithms in eliminating the correlation of adjacent pixels in a plaintext image.In this paper, 3000 adjacent pixels are randomly selected in the original images and ciphertext images of 4 images.The correlation coefficients of adjacent pixels of the original image and the ciphertext image in the horizontal direction, the correlation coefficients of the adjacent pixels of the original image and the ciphertext image in the vertical direction and the correlation coefficients of adjacent pixels of the original image and the ciphertext image in the diagonal direction are calculated according to the formulas ( 8) - (11).Table 5 is a comparison table of correlation coefficients between the original image and the encrypted image.In Figure 10, the correlation between the original baboon image and the encrypted image in the horizontal, vertical and diagonal directions is compared.

Conclusion
With the rapid development of network technology, how to ensure the security of digital images in storage and transmission has become an important issue in the current information security.The encryption algorithm in this paper is
k ∈ are all decimal digits, plus the range of 1 1

Figure 4
Figure 4 test the sensitivity of key 1 u , Figure 4(a) is the original image of le- na, Figure 4(b) is the ciphertext image E encrypted by the keys 1 3.7u = , 0 0.5 x = , 9.8 k = , 256 l = , 1 64 m = , 1 128 n = , 3 m = and 2 p = , Figure4(c)is the encrypted image E′ whose key 1 u is changed to 3.70000000000001.By formula (4) calculated the rate of change between the two images was 99.61%.

Figure 4 (
Figure 4(d) is the decrypted image obtained by decrypting E′ with the key 1 3.7 u = , and Figure 4(e) is the decrypted image obtained by decrypting E′ with the key 1 3.70000000000001 u = .

Figure 5 2 p
Figure 5 test the sensitivity of key 0 x .Figure 5(a) is the original picture of baboon, Figure 5(b) is the ciphertext image E encrypted with the key 1 3.7 u =

.Figure 6
Figure 6 test the sensitivity of key k.Figure 6(a) is the original picture of the boat, Figure 6(b) is the ciphertext image E encrypted with the key 1 3.7 u = ,

Figure 6 (
Figure 6 test the sensitivity of key k.Figure 6(a) is the original picture of the boat, Figure 6(b) is the ciphertext image E encrypted with the key 1 3.7 u = ,

Figure 6 (
Figure 6(d) is the decrypted image obtained by decrypting E with the key 9.80000000000001 k = , and Figure 6(e) is the decrypted image obtained by decrypting E with the key 9.8 k = .

Figure 4 .
Figure 4.The sensitivity of the key 1 u experimental analysis.(a) Original lena image; (b) Encrypted image E; (c) Encrypted image E′ ; (d) The wrong key is decrypted; (e) The correct key is decrypted.

Figure 5 .
Figure 5.The sensitivity of the key 0 x experimental analysis.(a) Original baboon image.(b) Encrypted image E; (c) Encrypted image E′ ; (d) The wrong key is decrypted; (e) The correct key is decrypted.

Figure 6 .
Figure 6.The sensitivity of the key k experimental analysis.(a) Original boat image.(b) Encrypted image E; (c) Encrypted image E′ ; (d) The wrong key is decrypted; (e) The correct key is decrypted.

Figure 7
Figure 7 test the influences of key 1m on the decryption process.Figure7(a) Figure 7 test the influences of key 1 m on the decryption process.Figure 7(a) is the original picture of the lena, Figure 7(b) is the ciphertext image encrypted with the key 1 3.7 u = , 0 0.5 x = , 9.8 k = , 256 l = , 1 64 m = , 1 64 n = , 3 m = and 2 p = , Figure 7(c) is the decrypted image with 1m changed to 128.Figure8test the influences of key p on the decryption process.Figure8(a) is

1 2 p
) is the original image of the lena, Figure8(b)is the ciphertext image encrypted by the key = , and Figure8(c) is the decrypted image with p changed to 3.

Figure 8 .
Figure 8. key p on the decryption process analysis.(a) Original lena image; (b) Encrypted image; (c) p wrongly decrypted image.

Figure 9 .
Figure 9. Histogram comparison of plaintext image and ciphertext image.Histogram of plaintext lena; (b) Histogram of encrypted lena; (c) Histogram of plaintext baboon; (d) Histogram of encrypted baboon.

Table 1 .
Key space comparison results with other methods.

Table 2 .
Encrypted image fixed point ratio analysis table.

Table 3 .
Average gray value change analysis table.