An encryption algorithm for color images based on an improved dual-chaotic system combined with DNA encoding

Experiments were conducted on a PC equipped with an Intel® Coreâ„¢ i7-12650H CPU operating at 2.30 GHz, 16 GB of memory, and a 64-bit Windows 11 operating system. The encryption algorithm described above was implemented using MATLAB R2018b.Experimental resultsIn the simulation experiment, Baboon and Peppers color images were chosen, each with pixels arranged in a 512 × 512 grid. Figure 5 displays the original image, ciphertext image, and decrypted image. (The image source of Baboon and Peppers is https://sipi.usc.edu/database/).Fig. 5Simulation result diagrams. (a) Peppers plaintext image. (b) Encrypted image of peppers. (c) Decrypted image of peppers. (d) Baboon plaintext image. (e) Encrypted image of baboon. (c) Decrypted image of baboon.Information entropyInformation entropy is a mathematical tool employed to quantify the uncertainty and disorder of information. In the realms of image processing and computer vision, information entropy evaluates the randomness of pixel values in images. The definition of information entropy is represented by Eq. (12):$$H(x) = – \sum p(x)\log_{2}{p(x)}$$
(12)
In this expression, X represents a random variable, p(x) represents the probability of X taking the value x, and N is the grayscale level of the image, denoting the size of the set {x}. According to formula (12), the information entropy of a 256-level image can be calculated as 8. To compare with the encryption results presented in this paper, the information entropy of the encrypted image is calculated separately. Simultaneously, a comparison is made with the information entropy of the secret images in some references. Upon comparison, it is observed that under the encryption algorithm proposed in this paper, the information entropy of Lena’s ciphertext image is closer to the ideal value of 8. Therefore, this algorithm demonstrates a more ideal resistance to statistical analysis, as shown in Table 7.Table 7 Comparison table of information entropy of cryptographic images.Key space analysisTo thwart brute force attacks effectively, it is crucial for the key range in image encryption algorithms to be expansive. When the key range exceeds 2 to the power of 100, the success rate of brute force attacks can be significantly reduced. In this paper, we propose a method that leverages chaos theory to generate initial values, aiming to produce three 256-bit hash values as keys. Our key range can reach 2 to the power of 768, surpassing 2 to the power of 100 by a significant margin. Consequently, this algorithm boasts a sufficiently large key range, providing robust resistance against brute force attacks.Histogram analysisThe histogram depicts the frequency of each grayscale value, effectively illustrating the pixel distribution pattern of an image. In an excellently encrypted image, the histogram should display a horizontal distribution, as shown in Fig. 6, depicting the histograms of Lena’s R,G,B channels before and after encryption.Fig. 6Simulation result diagrams. (a) The histogram of Lena’s R channel before encryption. (b) The histogram of Lena’s G channel before encryption. (c) The histogram of Lena’s B channel before encryption. (d) The histogram of Lena’s R channel after encryption. (e) The histogram of Lena’s R channel after encryption. (c) The histogram of Lena’s R channel after encryption.Correlation analysisTo evaluate the correlation of the ciphertext image, we randomly selected 5000 pairs of adjacent pixel values in each direction of the ciphertext image and calculated their correlation coefficients using Eqs. (13), (14), and (15). The correlation coefficients of adjacent pixels can be computed accordingly. By calculating the correlation coefficients for both plaintext and ciphertext images, the comparison chart of adjacent element correlations is presented in Fig. 7, and the calculation results are listed in Tables 8 and 9.Upon observation, it was noted that the three channels of the original plaintext image exhibited a very strong correlation between pixels in the horizontal, vertical, and diagonal directions, with correlation coefficients very close to 1. However, after encryption, the correlation coefficients in these three directions of the ciphertext image approached zero. This indicates that the encryption system has successfully eliminated the correlation between adjacent pixels, achieving the desired encryption effect.$${\gamma }_{xy} = \frac{cov (x,y)}{\sqrt{D(x)^{\prime} D(y)}}$$
(13)
where x and y are pixel values.Fig. 7Comparison chart of correlation analysis between adjacent elements before and after encryption. (a1) (b1) (c1) are the correlation coefficient maps of the R channel of Lena before encryption in the horizontal, vertical, and diagonal directions, respectively. (a2) (b2) (c2) are the correlation coefficient maps of the G channel of Lena before encryption in the horizontal, vertical, and diagonal directions, respectively. (a3) (b3) (c3) are the correlation coefficient maps of the B channel of Lena before encryption in the horizontal, vertical, and diagonal directions, respectively. (a4) (b4) (c4) are the correlation coefficient maps of the R channel of Lena after encryption in the horizontal, vertical, and diagonal directions, respectively. (a5) (b5) (c5) are the correlation coefficient maps of the G channel of Lena after encryption in the horizontal, vertical, and diagonal directions, respectively. (a6) (b6) (c6) are the correlation coefficient maps of the B channel of Lena after encryption in the horizontal, vertical, and diagonal directions, respectively.Table 8 Table of correlation coefficients for the plaintext image.Table 9 Table of correlation coefficients for the ciphertext image.$$cov (x,y) = \frac{1}{N} \sum_{1}^{N}({x}_{i} – E(x))({y}_{i} – E( y))$$
(14)
$$E\left(x\right)= \frac{1}{N} \sum_{1}^{N}\left({x}_{i} \right), D(x) = \frac{1}{N} \sum_{1}^{N}({(xi – E(x))}^{2})$$
(15)
Differential attack analysisA differential attack is fundamentally a chosen plaintext attack, wherein the assailant endeavors to infer the encryption key of the algorithm through scrutinizing the disparities between plaintext and ciphertext images, with the objective of revealing the corresponding relationship. In the context of resisting differential attack analysis, two frequently employed metrics are the Number of Pixel Changes Rate (NPCR) and the Unified Average Changing Intensity (UACI), serving as benchmarks for evaluating the algorithm’s efficacy. The formula for calculating NPCR is:$$NPCR = \frac{\sum_{i=1}^{M}\sum_{j=1}^{N}D(i,j)}{MN}\times 100\%$$
(16)
where M and N denote the width and height of two arbitrary images, respectively, and D(i, j) is defined as the percentage of pixels with distinct values to the total number of pixels in the entire image.$$UACI = \frac{\sum_{i=1}^{M}\sum_{j=1}^{N}\frac{{C}_{1}\left(i,j\right)-{C}_{2}\left(i,j\right)}{255}}{MN}\times 100\%$$
(17)
where N signifies the total number of pixels in the image, and C1(i, j), C2(i, j) denote the pixel values of the original image and the compressed image at position (i, j), respectively. In the ideal state, the optimal values for NPCR and UACI are 99.6094% and 33.4635%, as depicted in Table 10. The performance of each algorithm is deemed satisfactory.Table 10 Table comparing NPCR and UACI values for different algorithms.Time complexityThe total time consumed by the protocol is referred to as computation time. Key attributes of computation costs include: to improve efficiency and reduce costs, we aim to minimize the total number of arithmetic operations performed by the algorithm. As the number of operations increases, the algorithm’s energy consumption and runtime may be affected. The comparison with other algorithms at a resolution of 512 × 512 pixels is shown in Table 11.Table 11 Time complexity comparison chart.Key sensitivity analysisIf a minor alteration in the key results in a substantial change in the ciphertext, the key is considered highly sensitive. Incorrect keys are unable to correctly decrypt the ciphertext image. Decrypting the ciphertext images with any one hash value incremented by 1 bit is illustrated in Fig. 8. The figure demonstrates that even a slight modification in the initial value or any one hash value of the key cannot lead to a correct decryption, indicating the algorithm’s robust key sensitivity.Fig. 8Comparison chart of decryption with small changes in the key. (a) Decryption chart with the correct key. (b–d) Decryption Figure with hash value increased by 1 bit.Anti-cropping performanceWhen ciphertext images are subjected to cropping attacks, it is crucial to preserve as much detail as possible, especially for images containing text. This helps minimize the overall impact of cropping on the image. For this purpose, we select an image with a significant amount of text for encryption. We then perform a cropping attack on the ciphertext image and decrypt the cropped image. Figure 9 shows the results after cropping the ciphertext image and adding zero pixels to the affected areas. This image will be used for decryption and image restoration.Fig. 9Cropping encrypted images.Figure 10 shows the result obtained by decrypting the cropped and damaged ciphertext image. As observed, although the ciphertext image was partially cropped and damaged, the algorithm disperses the impact of the cropped areas across the entire image, thereby minimizing the local effects of cropping. This result indicates that the algorithm has strong resistance to cropping attacks, making it suitable for encrypting images containing detailed information.Fig. 10Decrypted image after cropping encrypted image.Noise resistance performanceDuring image transmission, channel noise often affects and degrades the image. To test the noise resistance performance of this algorithm, different levels of salt-and-pepper noise were added to the ciphertext images to simulate transmission noise. Figure 11a–d show the images obtained after adding salt-and-pepper noise with mean square deviations of 0.05, 0.1, 0.15, and 0.2 to the three channels of the ciphertext image, followed by decryption. As seen in Fig. 11, as the mean square deviation of the added salt-and-pepper noise increases, the image quality deteriorates. However, from a visual standpoint, the main information of the original image can still be distinguished, indicating that this encryption algorithm has strong resistance to Gaussian noise.Fig. 11Decrypted image after cropping encrypted image. (a) Salt-and-pepper noise with 0.05. (b) Salt-and-pepper noise with 0.1. (c) Salt-and-pepper noise with 0.15. (d) Salt-and-pepper noise with 0.2.Image quality assessmentIn the field of image processing, the quality of reconstructed images can be evaluated using the peak signal-to-noise ratio (PSNR). A higher PSNR indicates better quality of the reconstructed image. For an original image I (with dimensions M × N) and a reconstructed image R, the mean squared error (MSE) is defined as follows (Eq. 18):$$MSE=\frac{1}{m\times n}\sum_{i=1}^{m} \sum_{j=1}^{n} {\left[R(i,j)-I(i,j)\right]}^{2}$$
(18)
The equation for calculating PSNR is given as Eq. 19, as follows:$$PSNR=10{\text{lg}}\left(\frac{{\left(256-1\right)}^{2}}{MSE}\right)$$
(19)
The MSE value is inversely proportional to image quality, while the PSNR value is directly proportional to image quality. In other words, a smaller MSE value results in a larger PSNR value, indicating a lower deviation between the reference image and the evaluated image, and thus a higher image quality. Salt-and-pepper noise ranging from 0 to 1, in intervals of 0.05, was added to the ciphertext images to obtain the corresponding decrypted images. Using the decrypted images as the evaluated images and the original image as the reference image, Eq. (19) was used to calculate the corresponding PSNR values. A curve of salt-and-pepper noise versus PSNR for the three channels was plotted, as shown in Fig. 12. Figure 12a–c show the salt-and-pepper noise versus PSNR curves for the R, G, and B channels, respectively. The simulation results show that as the salt-and-pepper noise increases from 0 to 0.4, the PSNR value rapidly decreases, indicating a rapid increase in the difference between the decrypted image and the original image. When the salt-and-pepper noise exceeds 0.4, the PSNR value changes very slowly as the noise continues to increase, indicating that the difference between the decrypted image and the original image has reached its limit and remains largely unchanged. At this point, it is also difficult to distinguish the original image from the decrypted image.Fig. 12PSNR curves for R, G, and B channels with added salt-and-pepper noise. (a) PSNR curve for the R Channel. (b) PSNR curve for the G channel. (c) PSNR Curve for the B channel.During transmission, this encryption algorithm can withstand noise attacks when the Gaussian noise mean square deviation is relatively low to moderate. However, in environments with high levels of noise, it becomes difficult for the encryption algorithm to prevent noise from affecting the image data.

Hot Topics

Related Articles