In this paper, an image encryption algorithm based on the H-fractal and dynamic self-invertible matrix is proposed. The H-fractal diffusion encryption method is firstly used in this encryption algorithm. This method crosses the pixels at both ends of the H-fractal, and it can enrich the means of pixel diffusion. The encryption algorithm we propose uses the Lorenz hyperchaotic system to generate pseudorandom sequences for pixel location scrambling and self-invertible matrix construction to scramble and diffuse images. To link the cipher image with the original image, the initial values of the Lorenz hyperchaotic system are determined using the original image, and it can enhance the security of the encryption algorithm. The security analysis shows that this algorithm is easy to implement. It has a large key space and strong key sensitivity and can effectively resist plaintext attacks.
In modern society, technologies such as the Internet and block-chains are rapidly developing, and human beings have entered the big data era. Internet technology has brought great convenience to human life and promoted the establishment of global information access. With the development of multimedia technology, digital offices and electronic payments have become more popular in various fields of human life. Compared with textual information, the informative features that are expressed by images are more intuitive, and the amount of information that images contain has increased. At this stage, images are being used as the main carrier of information. While enjoying the convenience brought by the information society, we must also be more vigilant about the disasters that can be caused by information leakage. For example, in June 2013, former CIA employee Snowden revealed the “PRISM Project” to the world. Some high-tech companies with great influence left back doors in the equipment that they produced, making it convenient for the US government to monitor the public. During the Korean Winter Olympics in January 2018, the identity information and bank account information of a large number of athletes and spectators were maliciously acquired by hackers, thereby causing adverse effects. Protecting the security of information and avoiding losses due to information leakage is an urgent task for human beings. Traditional encryption algorithms such as DES [
There are two main types of methods in image encryption algorithms: scrambling [
In this paper, an image encryption algorithm based on the H-fractal structure and dynamic self-invertible matrix is proposed. This algorithm combines the scrambling and diffusion encryption methods. Section
Chaotic systems are widely used in the information encryption field because their initial values and parameters are sensitive and pseudorandom [
The phase diagram of the Lorenz hyperchaotic system.
In 1929, Hill proposed an encryption algorithm that used invertible matrices [
In formula (
In formula (
The decryption process is the inverse of formula (
To ensure the existence of matrix
The method of calculating a 4 × 4 self-invertible matrix is as follows. When matrix
Then, formula (
To construct the self-invertible matrix,
The self-invertible matrix
Because
Because
Then, the self-invertible matrix
In 1967, Mandelbrot published a paper entitled, “How Long is the British Coastline,” in Science. In it, he used fractals to describe a large class of complex irregularities that cannot be described using traditional Euclidean geometry in nature. It marked the emergence of fractal thought. A fractal is a set of mathematical theories that uses fractal features as the research object. Some common geometric fractals are the Koch curve, the H-fractal, the Sierpinski triangle, and the Vivsek triangle. Fractal theory is not only a frontier and important branch of nonlinear science but also a new cross-discipline. It is a new mathematics discipline that studies the characteristics of a class of phenomena. Compared with its geometric form, it is more connected with differential equations and dynamic systems theory. The fractals are not limited to geometric forms and times and processes can also form fractals. As a new concept and method, the fractal is being applied in many fields. In recent years, fractal sensitivity, especially the sensitivity of the Mandelbrot sets and Julia sets to initial values, has been widely used in image encryption.
The H-fractal is a kind of fractal, and the diagram of the H-fractal is shown in Figure
The diagram of the H-fractal.
SHA-3 algorithm is a kind of Secure Hash Algorithm. This encryption algorithm uses the Hash sequence that is generated by the SHA-3(256) algorithm, and the prime number
The number of iterations of the hyperchaotic system is selected according to the size of the original image after obtaining the initial values of the Lorenz hyperchaotic system. If the size of the original image is
The sequence Step 1: The original image is divided into Step 2: The pseudorandom sequence Step 3: The matrix Step 4: The 4 × 4 matrices Step 5: The 2 × 2 matrices Step 6: The cipher matrices Step 7: The cipher image is composed of the cipher matrices
The decryption process of the self-invertible matrix encryption algorithm is the inverse of the encryption process, so it will not be described again.
The H-fractal cross-diffusion method that is proposed in this paper uses the intermediate pixel that is covered by the H-fractal as an operator to cross-process the two pixels on both ends of the H-fractal to complete the diffusion. Taking a 3 × 3 block as an example, the diffusion process based on the H-fractal is shown in Figure
The diagram of H-fractal diffusion.
In Figure
The diagram of the crossover operation.
Taking a 256 × 256 image as an example, the image that is covered by the H-fractal is shown in Figure
The image covered by the H-fractal.
In this paper, a cipher-pixel feedback method is used to enhance the diffusion effect. The cipher-pixel feedback method makes the pixels in the front of the pixel sequence affect the pixels behind them. Assuming that the size of the original image is
The algorithm uses the pseudorandom sequences
The flow chart of the encryption scheme is shown in Figure Step 1: Image Step 2: The initial values Step 3: The Lorenz hyperchaotic system is iterated Step 4: The image matrix Step 5: The image matrix Step 6: The image matrix Step 7: The image matrix Step 8: The image matrix Step 9: The cipher-text feedback operation is performed on the image matrix
The flow chart of the encryption scheme.
The decryption process of this encryption scheme is the inverse of the encryption process, so it will not be repeated.
In order to verify the effectiveness and feasibility of our algorithm, simulated experiments are undertaken on the MATLAB R2018a platform. The environment of development is Windows 7, 4.00 GB RAM, Intel(R) Core(TM) i3-4130 CPU @ 3.4 GHz. Mean execution time of test images with size of 256 × 256 is 1.518s. Part of the encryption keys are set as
The original images and their cipher images. (a) Original Lena image. (b) Original Cameraman image. (c) Original Pepper image. (d) Original Baboon image. (e) Cipher Lena image. (f) Cipher Cameraman image. (g) Cipher Pepper image. (h) Cipher Baboon image.
The encryption algorithm that is proposed in this paper uses the 256 bit Hash sequence that is generated by the SHA-3(256) algorithm and the prime number
The correct decrypted image and the incorrectly decrypted images due to a slight change in the initial values of the Lorenz hyperchaotic system. (a) The original Lena image. (b) The correct decrypted image. The decrypted image (c) when
When the original image has a slight change, the cipher image will have a big change. This phenomenon reflects that the encryption system is very sensitive to changes in the original image. The higher the sensitivity of the plaintext, the stronger the cryptosystem’s ability to resist differential attacks. Here, we use the number of pixel changes rate (NPCR) and the unified average changing intensity (UACI) to measure the antidifferential attack capability of the encryption system. The methods for calculating the NPCR and UACI are described as
In formula (
The maximum theoretical value of the NPCR is 100%, and the ideal value of the UACI is 33.4635%. The larger the NPCR is, the greater the pixel changes. When the original image has been changed by 1 bit, the values of the NPCR and UACI are shown in Table
NPCR and UACI.
Image | The proposed scheme | Reference [ |
Reference [ | |||
---|---|---|---|---|---|---|
NPCR (%) | UACI (%) | NPCR (%) | UACI (%) | NPCR (%) | UACI (%) | |
Lena | 99.6292 | 33.4481 | 99.5986 | 33.4561 | 99.58 | 33.08 |
Cameraman | 99.6094 | 33.6017 | 99.5590 | 33.4439 | 99.90 | 33.15 |
Peppers | 99.6216 | 33.5715 | 99.5803 | 33.4324 | 99.71 | 32.19 |
Baboon | 99.6140 | 33.5152 | — | — | 99.59 | 31.56 |
Information entropy is the concept that was proposed by Shannon to quantify information. It can usually be expressed as
In formula (
The information entropies of some original images and their cipher images.
Image | Entropy | |||||
---|---|---|---|---|---|---|
Original |
|
|
|
Reference [ |
Reference [ | |
Lena | 7.4532 | 7.9971 | 7.9974 | 7.9974 | 7.9971 | 7.9968 |
Cameraman | 6.9046 | 7.9976 | 7.9971 | 7.9972 | 7.9971 | 7.9904 |
Peppers | 7.5797 | 7.9973 | 7.9978 | 7.9969 | 7.9968 | 7.9961 |
Baboon | 7.0092 | 7.9972 | 7.9973 | 7.9975 | — | 7.9971 |
Histogram statistical analysis is a kind of statistical attack, and the histogram can characterize the image. The pixel distribution in the histogram of the original image is not uniform, which is not conducive to resisting statistical attacks. A good encryption algorithm can make the pixel distribution in the histogram of the cipher image more uniform, and thus, it can resist known-plaintext attacks and chosen-plaintext attacks. The histograms of the original images are shown in Figures
The histograms of the original images and their cipher images. The histograms of (a) the Lena image, (b) the Cameraman image, (c) the Pepper image, (d) the Lena cipher image, (e) the Cameraman cipher image, and (f) the Pepper cipher image.
10000 pixels and their adjacent pixels from the original Lena image are randomly selected in the horizontal, vertical, and diagonal directions, and the values of these pixels are shown in Figures
The values of the selected pixels and their adjacent pixels in different directions. Horizontal correlation of (a) the original image and (d) the cipher image. Vertical correlation of (b) the original image and (e) the cipher image. Diagonal correlation of (c) the original image and (f) of the cipher image.
The correlation coefficient is used as an indicator to measure the correlation between adjacent pixels. Its calculation method is described as
In formula (
The correlation coefficients in different directions.
Image | Original image | Cipher image | ||||
---|---|---|---|---|---|---|
Horizontal | Vertical | Diagonal | Horizontal | Vertical | Diagonal | |
Lena | 0.9680 | 0.9349 | 0.9069 | 0.0078 | 0.0040 | −0.0050 |
Cameraman | 0.9467 | 0.9180 | 0.9054 | −0.0019 | −0.0051 | 0.0032 |
Peppers | 0.9731 | 0.9664 | 0.9381 | 0.0051 | 0.0037 | 0.0014 |
Baboon | 0.8327 | 0.8759 | 0.7890 | −0.0065 | −0.0038 | 0.0065 |
The antiocclusion attack capability of the encryption system can reflect the degree of recovery of the decrypted image when the cipher image data are lost. In a cryptosystem without global scrambling, when the cipher image data are lost, its decrypted image may lose some important features in the original image. The Lena cipher images cut by 0, 1/256, 1/64, and 1/16 are shown in Figures
The reduced cipher images and their corresponding decrypted images. (a) Correct cipher image. (b) 1/256 occlusion. (c) 1/64 occlusion. (d) 1/16 occlusion. (e) The correct decrypted image. Decrypted image (f) with 1/256 occlusion, (g) with 1/64 occlusion, and (h) with 1/16 occlusion.
The NPCR, UACI, and correlation coefficients between the original images and the decrypted images after the occlusion attacks are listed in Table
The NPCRs, UACIs, and correlation coefficients of the images after the occlusion attack.
Occlusion | NPCR | UACI | Correlation coefficients | ||
---|---|---|---|---|---|
Horizontal | Vertical | Diagonal | |||
0 | 0 | 0 | 0.9680 | 0.9349 | 0.9069 |
1/256 | 3.5339 | 1.0733 | 0.8371 | 0.8222 | 0.7957 |
1/64 | 12.2253 | 3.6316 | 0.6419 | 0.6057 | 0.5811 |
1/16 | 35.9364 | 10.6799 | 0.2669 | 0.2516 | 0.2327 |
Some characteristics of the cipher images with different sizes encrypted by the proposed algorithm are listed in Table
Analysis of cipher images with different sizes.
Cipher images | Correlation Coefficients | Entropies | NPCR (%) | UACI (%) | ||
---|---|---|---|---|---|---|
Horizontal | Vertical | Diagonal | ||||
Lena 128 × 128 | 0.0002 | −0.0008 | −0.0028 | 7.9882 | 99.6094 | 33.1566 |
Lena 512 × 512 | −0.0061 | 0.0014 | −0.0012 | 7.9994 | 99.6147 | 33.4730 |
Cameraman 128 × 128 | 0.0028 | 0.0020 | 0.0011 | 7.9878 | 99.6399 | 33.3091 |
Cameraman 512 × 512 | 0.0012 | −0.0052 | −0.0028 | 7.9993 | 99.5831 | 33.4335 |
Peppers 128 × 128 | 0.0028 | −0.0078 | 0.0098 | 7.9887 | 99.6216 | 33.3656 |
Peppers 512 × 512 | −0.0005 | 0.0018 | 0.0063 | 7.9992 | 99.5899 | 33.4390 |
Baboon 128 × 128 | −0.0062 | 0.0012 | 0.0062 | 7.9869 | 99.7253 | 33.6223 |
Baboon 512 × 512 | −0.0071 | −0.0053 | −0.0067 | 7.9993 | 99.6162 | 33.5096 |
In this paper, an image encryption algorithm based on the H-fractal structure and dynamic self-invertible matrix is proposed. The algorithm uses the Hash sequence that is generated by the SHA-3(256) algorithm and a prime number as the keys. The image is scrambled and diffused by the four pseudorandom sequences that are generated by the Lorenz hyperchaotic system. In this encryption scheme, a cross-diffusion operation based on the H-fractal structure is applied for the first time. The algorithm enriches the means of digital image encryption. It has high security to resist brute-force attacks and statistical attacks, and it has the ability to recover when the cipher data are lost. Thus, this algorithm can be used to protect the security of digital images.
The data used to support the findings of this study are available from the corresponding author upon request.
The authors declare that they have no conflicts of interest.
This study was supported by the National Natural Science Foundation of China (grant nos. 61572446, 61602424, and U1804262), Key Scientific and Technological Project of Henan Province (grant nos. 174100510009 and 192102210134), and Key Scientific Research Projects of Henan High Educational Institution (18A510020).