A New Digital Image Encryption Algorithm Based on Improved Logistic Mapping and Josephus Circle ()
1. 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.
2. The Preparatory Work
2.1. Improved Joseph’s Traversal Mappings
Joseph’s problem describes n individuals in a circle, counting from the first person, and continuously eliminating the mth person until the last one remains [8] .
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 (
). Write
. For example,
, which corresponds to the element sequence of 3, 2, 4, 1, so the elements of the order can be 1, 2, 3, 4 by mapping
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
.
2.2. 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:
(1)
where n and u are system parameters. When
and
, 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] :
(2)
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:
(3)
When
and
, 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.
3. Algorithm Description
3.1. 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,
Figure 1. The chaotic map of Equation (2).
Figure 2. The chaotic map of Equation (3).
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
, where
is the control parameter of the logistic chaotic map,
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
. This article take
.
Step 3: Generate a L-long chaotic sequence
by using the formula (3), and then modifies each component
of T to obtain the key vector of the sequence
and the vector
as the image encryption.
Step 4: convert the image Q from M × N matrix to one-dimensional row vector
.
Step 5: Exclusive-OR the
and B to obtain another one-dimensional vector
, and then convert C to an M × N matrix to obtain the image
encrypted with the improved logistic map.
Step 6: Input
, where
is the pixel of each line after the block,
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
to obtain
matrix of
blocks.
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
are the numbering from left to right of
array in the first row,
are the numbering of the
array in the second row from left to right and go on in order .Then all the elements in C are scrambled by the improved Josephian traversal mapping
to get a sequence
.
Step 10: The elements in
(that is, the numbering in step 9) are arranged in a matrix of
from left to right in the order of positions in
(Write
, where X is
matrix), and then these
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.
3.2. Decryption Algorithm Description
Step 1: Input the final encrypted image E in step 11 above.
Step 2: Enter the correct
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
, and perform the exclusive-OR operation on the M × N encrypted image to obtain the decrypted image.
4. Experimental Results and Analysis
4.1. 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.
4.2. Experimental Results
The experiments selected four grayscale images of lena, baboon, boat and couple, 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.
4.3. 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
, where
,
and
are all decimal digits, plus the range of
and p, the key space of this algorithm is more than 1037 (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
Figure 3. (a) Original lena image; (b) Original baboon image; (c) Original boat image; (d) Original couple image; (e) Encrypted lena image; (f) Encrypted baboon image; (g) Encrypted boat image; (h) Encrypted couple image; (i) Decrypted lena image; (j) Decrypted baboon image; (k) Decrypted boat image; (l) Decrypted couple image.
Table 1. Key space comparison results with other methods.
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:
(4)
where
is a ciphertext image encrypted by the initial key,
is a ciphertext image encrypted with a small change of the key, and
is the number of elements with different pixel values in
and
. The following were lena, baboon, boat image as an example.
Figure 4 test the sensitivity of key
, Figure 4(a) is the original image of lena, Figure 4(b) is the ciphertext image E encrypted by the keys
,
,
,
,
,
,
and
, Figure 4(c) is the encrypted image
whose key
is changed to 3.70000000000001. By formula (4) calculated the rate of change between the two images was 99.61%. Figure 4(d) is the decrypted image obtained by decrypting
with the key
, and Figure 4(e) is the decrypted image obtained by decrypting
with the key
.
Figure 5 test the sensitivity of key
. Figure 5(a) is the original picture of baboon, Figure 5(b) is the ciphertext image E encrypted with the key
,
,
,
,
,
,
and
. Figure 5(c) is the encrypted image
whose key
is changed to 0.50000000000001. Through the formula (4) calculated the rate of change between the two images was 99.59%. Figure 5(d) is the decrypted image obtained by decrypting E with the key
, and Figure 5(e) is the decrypted image obtained by decrypting E with the key
.
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
,
,
,
,
,
,
and
. Figure 6(c) is the encrypted image
whose key k is changed to 9.80000000000001. By formula (4) calculated the rate of change between the two images was 99.61%. Figure 6(d) is the decrypted image obtained by decrypting E with the key
, and Figure 6(e) is the decrypted image obtained by decrypting E with the key
.
Sensitivity analysis of several parameters in the logistic map above, the following parameters
are used to get on decryption analysis, the experiment chose the classic lena image and only analyzes
and p (the other two parameters
and m were similar to those of
and p).
Figure 4. The sensitivity of the key
experimental analysis. (a) Original lena image; (b) Encrypted image E; (c) Encrypted image
; (d) The wrong key is decrypted; (e) The correct key is decrypted.
Figure 5. The sensitivity of the key
experimental analysis. (a) Original baboon image. (b) Encrypted image E; (c) Encrypted image
; (d) The wrong key is decrypted; (e) The correct key is decrypted.
Figure 6. The sensitivity of the key k experimental analysis. (a) Original boat image. (b) Encrypted image E; (c) Encrypted image
; (d) The wrong key is decrypted; (e) The correct key is decrypted.
Figure 7 test the influences of key
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
,
,
,
,
,
,
and
, Figure 7(c) is the decrypted image with
changed to 128.
Figure 8 test the influences of key p on the decryption process. Figure 8(a) is the original image of the lena, Figure 8(b) is the ciphertext image encrypted by the key
,
,
,
,
,
,
and
, and Figure 8(c) is the decrypted image with p changed to 3.
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
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.
Figure 7. Key
on the decryption process analysis. (a) Original lena image; (b) Encrypted image; (c)
wrongly decrypted image.
Figure 8. key p on the decryption process analysis. (a) Original lena image; (b) Encrypted image; (c) p wrongly decrypted image.
4.4. 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.
4.5. 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:
(5)
where
.
From the formula (5) to calculate the fixed point of the encryption algorithm as shown in Table 2.
4.6 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:
Table 2. Encrypted image fixed point ratio analysis table.
(6)
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.
Table 3. Average gray value change analysis table.
4.7. 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:
(7)
The information entropy of the original image and the ciphertext image calculated according to formula (7) are shown in Table 4.
4.8. 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.
(8)
(9)
(10)
(11)
5. 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
Table 4. Table of information entropy analysis of original and encrypted images.
Table 5. Comparison table of correlation coefficient between original image and encrypted image.
encryption algorithm based on improved Josephus loop and improved logistic mapping to scrambling block. At first, we use logistic mapping to scramble the original image to obtain the encrypted image and then the encrypted image is divided into blocks. Finally, an improved Josephus ring is used to perform the position of the blocked image to get the encrypted image in this paper. By Matlab simulation experiments and the safety of experimental results are analyzed, the results show that the algorithm has the advantages of large key space, high key sensitivity, and can effectively resist the statistical analysis and gray value analysis attacks. So, it has good encryption effect on digital image encryption.