Image encryption method based on two-dimensional discrete hyperchaotic system
Technical Field
The invention belongs to the technical field of image encryption, and relates to an image encryption method based on a two-dimensional discrete hyperchaotic system.
Background
In modern digital communication, the password is usually embodied in the form of 0 and 1 bit which are randomly distributed, and a high-quality random number sequence generation mode is an important guarantee for the security of a password system. The nonlinear dynamics system is an important research object for generating random numbers due to the inherent randomness, wherein the chaotic system with both the dynamics and the randomness shows stronger adaptability and application potential. As an important branch of nonlinear science, chaos theory has been receiving extensive attention and intensive research in recent years.
The image encryption technology is one of important technologies in the field of information network security, and the main purpose of the image encryption technology is to protect private information from leakage in the image transmission process, so that the existing image encryption technology still has partial shortages in the aspects of key security and stability and is easy to attack by various cracking means. The hyper-chaotic system is used as a dynamic system with high nonlinearity, initial value sensitivity, ergodic property and aperiodic characteristic, and the inherent chaos and pseudo-randomness of the hyper-chaotic system can generate a complex and unpredictable sequence, so that the hyper-chaotic system is particularly suitable for the generation of a secret key in an encryption algorithm and the reinforcement of an encryption process. Therefore, the theory and the method of the hyper-chaotic system are applied to the image encryption technology, and a solution with higher safety can be provided for the field of information safety.
At present, some classical chaotic systems are introduced into the design of an image encryption algorithm, such as Logistic, circle and Tent systems, however, the problems of limited chaotic range, low entropy value, too simple structure and the like of the systems exist, and the application potential of the systems in the encryption field is obviously limited. In contrast, the hyperchaotic system can generate more unpredictable chaotic characteristics by virtue of more complex nonlinear dynamic behaviors, the security of the encryption system, particularly the multiple positive Lyapunov index characteristics of the system, are obviously enhanced, the high sensitivity of the system to initial conditions is ensured, so that even if an attacker grasps part of system information, the dynamic behaviors of the system cannot be predicted, and although some discrete hyperchaotic systems such as 2D-LASM, 2D-SIMM, SCM and LSMCL and the like are used for image encryption, the system is still insufficient in hyperchaotic activity and randomness, and further application of the system is restricted.
Aiming at the technical defects, the invention provides an image encryption method based on a two-dimensional discrete hyperchaotic system, which utilizes the two-dimensional discrete hyperchaotic system to generate a high-quality pseudorandom number sequence, and performs pixel-level diffusion and bit-level scrambling operations on a plaintext image so as to generate a pixel-independent high-entropy ciphertext image.
According to the search, a Chinese patent is found to use the hyperchaotic system for an image encryption system as well as the invention, the name of the Chinese patent is 'an image processing method based on a discrete hyperchaotic system and dynamic DNA coding with diffusivity', the application number is '202210478909.2', the Chinese patent is taken as a comparison file, and the following distinguishing technical characteristics of the invention and the comparison file are stated:
(1) The chaotic system is different in that the mathematical model of the chaotic system in the comparison file is more complex, and the chaotic system provided by the invention is simpler in expression, and the chaotic control parameter interval is wider, so that the flexibility of an encryption algorithm is enhanced, and meanwhile, the key space is enlarged, so that the safety of the encryption system is improved;
(2) The encryption process is different in that the security of the ciphertext image is enhanced by adopting a DNA coding theory, however, the introduction of the DNA coding theory increases the computational complexity and brings certain limitation, for example, the encryption process of the comparison file comprises the steps of converting each pixel in the image into 4 binary characters, carrying out pixel recombination according to the DNA coding rule, and carrying out element-by-element scrambling and diffusion operation; compared with a comparison file, the invention obviously reduces the computational complexity of the encryption process and optimizes the encryption process while ensuring the security of the ciphertext image, specifically, the invention can complete the whole encryption process only by pixel-by-pixel diffusion and bit-by-bit scrambling operation, and simultaneously omits the DNA coding step and adopts a novel diffusion and scrambling mechanism;
(3) The invention has different safety, namely, in the pixel correlation test analysis of the ciphertext image, the pixel correlation coefficient of the obtained ciphertext image is as low as 0.0001, and the comparison file is only 0.01, and the higher the pixel correlation coefficient index is, the higher the safety is, so the ciphertext safety is better than the comparison file, in the information entropy test, the average value of the information entropy of the ciphertext image reaches 7.99973, and the comparison file is only 7.9990, and the closer the average value of the information entropy of the image is 8, the higher the safety is, so the invention has obvious advantages in terms of reducing the pixel correlation and improving the information entropy, and the ciphertext safety is enhanced.
In summary, compared with the comparison file, the method and the device can not only effectively improve the security of the encryption effect, but also reduce the calculation complexity of the algorithm and the encryption operation flow.
Disclosure of Invention
The invention aims to solve the problems of the prior art, and provides an image encryption method based on a two-dimensional discrete hyperchaotic system, which solves the problems of 1, low complexity, more periodic windows and poor pseudo-randomness of a generated chaotic sequence of a traditional discrete hyperchaotic system, 2, poor random quality of key streams used in the traditional encryption algorithm, and 3, low security of the traditional image encryption algorithm.
For this purpose, the invention adopts the following technical scheme:
an image encryption method based on a two-dimensional discrete hyperchaotic system comprises the steps of respectively carrying out diffusion treatment on a chaotic sequence and RGB channels of an image so as to enhance the correlation between pixel information and pseudo-random number streams and effectively hide the information of an original image, converting the image into a binary bit stream, carrying out scrambling operation on the information stream based on the chaotic sequence, further breaking the spatial structure of a plaintext image, and obviously improving the safety of the ciphertext image by the scrambling and confusion operation realized on a bit layer, wherein the method comprises the following specific steps:
step 1, in order to generate a random chaotic sequence, a two-dimensional discrete hyperchaotic system is constructed based on logic cliff mapping and unitary quadratic equation coupling and modulo;
the expression of the two-dimensional discrete hyper-chaotic system is as follows:
the logistic mapping equation and the unitary quadratic equation used by the two-dimensional discrete hyper-chaotic system are respectively shown as follows:
xt=μxt-1·(1-xt-1)
In the formula, x t is the state output of a first system state variable x at the current moment in the hyperchaotic system, y t is the state output of a second system state variable y at the current moment in the hyperchaotic system, x t-1 is the state output of the first system state variable x at the previous moment in the hyperchaotic system, y t-1 is the state output of the second system state variable y at the previous moment in the hyperchaotic system, mu, a, b E (- [ infinity ], 0) U (0, + [ infinity ]) are all control parameters, and mod1 is the modular operation according to 1.
Compared with the existing discrete chaotic system, the two-dimensional discrete hyper-chaotic system provided by the invention is remarkably improved in the aspects of complexity, nonlinearity, pseudo-randomness and the like, and has better parameter adaptability, space ergodic property, pseudo-randomness and initial condition sensitivity.
In order to more accurately verify the randomness of the time sequence generated by the two-dimensional discrete hyper-chaotic system, the binary sequence of the two-dimensional discrete hyper-chaotic system is evaluated by using a NIST SP800-22 randomness test kit, wherein the NIST SP800-22 randomness test kit comprises 15 tests for detecting a non-random mode possibly existing in the binary sequence and is widely applied to evaluating the randomness of the binary sequence. During testing, each decimal number in the two-dimensional discrete hyperchaotic system is converted into a 32-bit binary number and circularly output according to the x-y sequence, so that each iteration of the two-dimensional discrete hyperchaotic system can generate a 64-bit binary sequence, and a complete password stream is formed.
In this test, the significance level is set to 0.01, and the P-value of each test is required to be not lower than 0.01 to pass the corresponding NIST test item, and the chaotic sequence is considered to be in accordance with the randomness standard only when all test items in the NIST kit pass.
The NIST test results of the two-dimensional discrete hyperchaotic system provided by the invention are shown in table 1, and the symbols in the table represent the average value of the test. The minimum pass per statistical test should be 98 for a single sample sequence length 1.0176Mb, a significance level of 0.01 and a sample size of 100. From table 1, the pseudo-random sequence generated by the two-dimensional discrete hyperchaotic system provided by the invention successfully passes all NISTSP800,800-22 randomness statistical tests, and the high randomness of the two-dimensional discrete hyperchaotic system generated sequence provided by the invention is fully verified, which indicates that the pseudo-random sequence can be excellently applied to the design of an image encryption system.
TABLE 1 NIST test results of the two-dimensional discrete hyperchaotic system proposed by the invention
And 2, randomly selecting an initial control parameter mu 0、a0、b0 and an initial state parameter x 0、y0 in the two-dimensional discrete hyper-chaotic system.
Step 3, inputting an RGB color plaintext image P with the matrix size of MxNx3, generating a 256-bit secret key K for the plaintext image by using an SHA-256 algorithm, dividing the secret key K into 16 blocks, wherein the expression of the secret key K is as follows:
K={k1,k2.k3,3,k16}
Where k i denotes the ith key.
And 4, the invention adopts the SHA-256 hash function to obtain the 256-bit binary key, thus the formed key space exceeds 2 256, obviously, the 256-bit binary key is enough to resist violent attack based on the calculation capability in the current technical field, and the reliability of an encryption scheme can be ensured.
Step 5, for enhancing the correlation between the secret keys K, calculating an intermediate parameter h i;
the calculation formula of the intermediate parameter h i (i=1, 2,3, 4) is as follows:
In the formula, Representing an exclusive or operation.
Step 6, calculating a state parameter iteration value x 0'、y0 'and a control parameter iteration value mu 0'、a0'、b0' of the two-dimensional discrete hyper-chaotic system by using an intermediate parameter h i, wherein the calculation formula is as follows:
where mod is the remainder operation.
And 7, randomly generating a first chaotic sequence A 1 and a second chaotic sequence A 2 with the total length of 3 XM XN for the RGB color plaintext image P by using the key K.
Step 8, performing exclusive or operation on the plaintext image P and the first chaotic sequence a 1 to generate an association matrix Q 1, and specifically:
recombining the first chaotic sequence A 1 into three R channel chaotic matrixes A M×N,R, G channel chaotic matrixes A M×N,G and B channel chaotic matrixes A M×N,B with the sizes of M multiplied by N, wherein the three R channel chaotic matrixes A M×N,R, the G channel chaotic matrixes A M×N,G and the B channel chaotic matrixes A M×N,B respectively correspond to R, G, B color channels;
carrying out pixel-level exclusive-or operation on the R channel chaotic matrix A M×N,R, the G channel chaotic matrix A M×N,G and the B channel chaotic matrix A M×N,B and the R channel plaintext matrix corresponding to R, G and B channels in the plaintext image P, the G channel plaintext matrix P G and the B channel plaintext matrix P B respectively to obtain an association matrix Q 1, wherein the expression is as follows:
the pixel level exclusive-or operation refers to performing a binary exclusive-or operation on each pixel value in the two images, which belongs to a technology known to those skilled in the art, so that an operation process thereof is not repeated.
Step 9, converting all elements in the incidence matrix Q 1 into 8-bit binary data stream, carrying out bit level scrambling on the 8-bit binary data stream by utilizing the second chaotic sequence A 2 to obtain a one-dimensional binary data stream Q 2, and recombining the one-dimensional binary data stream Q 2 to obtain a ciphertext matrix Q 3 with the size of MXNX3, thereby obtaining a ciphertext image.
The invention has the beneficial effects that:
1. Compared with the existing discrete chaotic system, the two-dimensional discrete hyperchaotic system has the advantages of obvious improvement in the aspects of complexity, nonlinearity, pseudo-randomness and the like, and good parameter adaptability, space ergodic property, pseudo-randomness and initial condition sensitivity.
2. The pseudo-random sequence generated by the two-dimensional discrete hyper-chaotic system provided by the invention passes the performance verification of the test suite NIST SP800-22, proves that the generated time sequence has high enough complexity and unpredictability, and shows good randomness, so that the key stream is ensured to have good randomness and robustness, malicious attack behaviors such as differential attack, statistical attack and the like can be effectively resisted, and the design of an image encryption algorithm is ensured.
3. The invention provides a color image encryption strategy combining pixel-level diffusion and bit-level scrambling, namely after a plaintext image is in exclusive or correlation with a chaotic sequence, each state value of an association matrix is converted into a binary data stream form, and each bit in the data stream is randomly scrambled based on a chaotic pseudo-random sequence generated by a designed two-dimensional discrete hyperchaotic system, so that the spatial structure of the plaintext image is damaged, and the correlation among pixel points is weakened. The process effectively improves the anti-attack capability of the encrypted image.
Drawings
FIG. 1 is a schematic flow chart of the method of the present embodiment;
FIG. 2 is a schematic diagram showing the comparison of an encrypted image and an original sample image according to the present embodiment;
FIG. 3 is a pixel histogram of a plaintext image and a ciphertext image according to the present embodiment;
fig. 4 shows the distribution of adjacent pixels of the plaintext image and the ciphertext image in horizontal, vertical, and diagonal directions according to the present embodiment.
Detailed Description
The technical scheme of the invention is described in the following with reference to the accompanying drawings and the implementation method.
Examples
As shown in fig. 1, an image encryption method based on a two-dimensional discrete hyperchaotic system comprises the following steps:
step 1, in order to generate a random chaotic sequence, a two-dimensional discrete hyperchaotic system is constructed based on logic cliff mapping and unitary quadratic equation coupling and modulo;
the expression of the two-dimensional discrete hyper-chaotic system is as follows:
In the formula, x t is the state output of a first system state variable x at the current moment in the hyperchaotic system, y t is the state output of a second system state variable y at the current moment in the hyperchaotic system, x t-1 is the state output of the first system state variable x at the previous moment in the hyperchaotic system, y t-1 is the state output of the second system state variable y at the previous moment in the hyperchaotic system, mu, a, b E (- [ infinity ], 0) U (0, + [ infinity ]) are all control parameters, and mod1 is the modular operation according to 1.
And 2, randomly selecting an initial control parameter mu 0、a0、b0 and an initial state parameter x 0、y0 in the two-dimensional discrete hyper-chaotic system.
Step 3, inputting an RGB color plaintext image P with the matrix size of MxNx3, generating a 256-bit key K for the plaintext image by using an SHA-256 algorithm, and dividing the key K into 16 blocks, wherein the expression of the key K is as follows:
K={k1,k2.k3,3,k16}。
Where k i denotes the ith key.
Step 4, for enhancing the correlation between the secret keys K, calculating an intermediate parameter h i;
the calculation formula of the intermediate parameter h i (i=1, 2,3, 4) is as follows:
In the formula, Representing an exclusive or operation.
Step 5, calculating a state parameter iteration value x 0'、y0 'and a control parameter iteration value mu 0'、a0'、b0' of the two-dimensional discrete hyper-chaotic system by using an intermediate parameter h i, wherein the calculation formula is as follows:
Wherein x 0、y0 is an initial state parameter of the two-dimensional discrete hyper-chaotic system, mu 0、a0、b0 is an initial control parameter of the two-dimensional discrete hyper-chaotic system, and mod is a remainder operation.
And 6, randomly generating a first chaotic sequence A 1 and a second chaotic sequence A 2 with the total length of 3 XM XN for the RGB color plaintext image P by using the key K.
And 7, recombining the first chaotic sequence A 1 into three R channel chaotic matrixes A M×N,R, G channel chaotic matrixes A M×N,G and B channel chaotic matrixes A M×N,B with the size of M multiplied by N, wherein the three R channel chaotic matrixes A M×N,R, the G channel chaotic matrixes A M×N,G and the B channel chaotic matrixes A M×N,B respectively correspond to R, G, B color channels.
Step 8, performing pixel-level exclusive-or operation on the R channel chaotic matrix a M×N,R, the G channel chaotic matrix a M×N,G and the B channel chaotic matrix a M×N,B, and the R channel plaintext matrix, the G channel plaintext matrix P G and the B channel plaintext matrix P B corresponding to R, G and B channels in the plaintext image P, respectively, to obtain an association matrix Q 1, where the expression is as follows:
Step 9, converting all elements in the incidence matrix Q 1 into 8-bit binary data stream, carrying out bit level scrambling on the 8-bit binary data stream by using the chaotic sequence A 2 to obtain a one-dimensional binary data stream Q 2, and recombining the one-dimensional binary data stream Q 2 to obtain a matrix Q 3 with the size of MXNX3, thereby obtaining a ciphertext image.
The encryption effect, key sensitivity, differential attack resistance, protection of sensitive information, pixel distribution randomness, and information entropy of the present embodiment are tested separately as follows.
And (3) testing encryption effect:
In order to evaluate the encryption security of the present embodiment, three color images with sizes of 512×512, which are commonly used in the image processing field, are selected for testing, and are respectively planes, baboons and peppers, as shown in fig. 2, the present embodiment can successfully complete encryption of the original sample image.
Key sensitivity test:
To verify the key sensitivity in this embodiment, this embodiment introduces 10 -15 small changes in the system parameters and initial values, respectively, and observes the difference between the encrypted ciphertext images of two times. In order to quantify the difference in results between the two encryptions, the evaluation indexes adopted in this embodiment include a signal-to-noise ratio SNR, a mean square error MSE, and a structural similarity index SSIM.
In general, the larger the difference between the two images, the higher the MSE, and the lower the SNR and SSIM. If the encryption scheme lacks sensitivity to the key stream, when the key stream is slightly changed, the two generated encrypted images may still have high structural similarity, so that the two encrypted images are judged to be unsafe to encrypt.
As shown in table 2, table 3, table 4, table 5, and table 6, the key sensitivity of the present embodiment is robust, has strong key sensitivity, and can effectively prevent an attacker from retrieving any valuable information even if one bit in the key is changed.
TABLE 2 Key sensitivity analysis results (Change x 0)
TABLE 3 Key sensitivity analysis results (Change y 0)
TABLE 4 Key sensitivity analysis results (Change. Mu 0)
TABLE 5 Key sensitivity analysis results (Change a 0)
TABLE 6 Key sensitivity analysis results (Change b 0)
Test of resistance to differential attack:
In the field of image encryption, differential attack tests are used to evaluate the sensitivity of an encryption algorithm to small changes in a plaintext image, and a secure encryption algorithm should exhibit high sensitivity to small changes in the plaintext, i.e., only one pixel changes, and the ciphertext image should also change significantly.
In the differential attack test, the pixel change rate NPCR and the uniform average change intensity UACI are common indexes for measuring the differential attack resistance of an encryption algorithm, wherein the NPCR is used for measuring the percentage of the change of pixel values in two ciphertext images and reflecting the influence range of small change of plaintext on ciphertext, and the UACI is used for measuring the average degree of the change of pixel values in the two ciphertext images and reflecting the integral level of the change of the intensity of the encrypted image.
NPCR and UACI theoretical values of the encrypted ciphertext image are 99.6094% and 33.4635%, respectively. Table 7 shows the results of the differential attack resistance test of this example on plane, baboon and pepper plaintext images. As shown in table 7, the present embodiment is closer to the theoretical value in the NPCR and UACI indexes, and has the capability of resisting differential attack.
TABLE 7 differential attack test results
Protection sensitive information test:
The histogram is used to display the frequency of occurrence of different pixel values, and the more uniform the distribution of the pixel histogram of the encrypted image, the stronger the resistance of the encryption algorithm to statistical attacks.
As shown in fig. 3, the histogram distribution of the plaintext image before encryption is uneven, and there is an obvious peak value at some pixel values, which indicates that the plaintext image has clear statistical characteristics, and the histogram distribution of the ciphertext image is very even, which indicates that the embodiment can effectively destroy and hide the pixel information of the plaintext, and can successfully hide any identifiable mode or feature in the plaintext, thereby remarkably enhancing the effectiveness of the encryption algorithm in protecting sensitive information.
Pixel distribution randomness test:
Correlation analysis in image encryption refers to measuring whether an encryption algorithm successfully destroys and conceals statistical properties in a plaintext image by calculating correlations of adjacent pixels in horizontal, vertical and diagonal directions, and an effective image encryption algorithm can randomize the distribution of encrypted ciphertext image pixels, and a correlation coefficient should be close to 0.
In this embodiment, 10000 pairs of adjacent pixels are selected from 3 directions of horizontal, vertical and diagonal to perform statistical analysis to evaluate the effectiveness of the algorithm in reducing the correlation, and the calculation result is shown in table 8, and includes specific values of the test results of adjacent pixels in the horizontal, vertical and diagonal directions of the plaintext image before encryption in this embodiment and the ciphertext image after encryption in this embodiment.
TABLE 8 analysis of adjacent pixel correlation of plaintext and ciphertext images
As can be seen from table 8, the pixel distribution of the ciphertext image generated in the present embodiment is more nearly uniform, and the high randomness of the pixel distribution can effectively reduce the risk of an attacker to infer plaintext information or a secret key by using statistical characteristics, thereby further verifying the security and robustness of the present embodiment.
Fig. 4 is a visual representation of the calculation results in table 8, in which red represents the distribution of the adjacent pixels in the horizontal direction in the entire pixel space, green represents the distribution of the adjacent pixels in the vertical direction in the entire pixel space, and blue represents the distribution of the adjacent pixels in the diagonal direction in the entire pixel space. Since the plaintext image contains the feature information, the result of the neighboring pixels is close to 1, and since the ciphertext image presents a disordered state, the result of the neighboring pixels is close to 0, as can be seen from fig. 4, the encryption scheme proposed by the present embodiment has effectiveness in resisting the statistical attack.
And (3) testing information entropy:
The information entropy test is used for measuring the uncertainty of pixel variables in the ciphertext image in image encryption, and the theoretical value of the information entropy is 8 for an image with 256 gray scales. The closer the information entropy is to the theoretical maximum value, the more random the pixel value distribution of the encrypted image is, and the more effectively the encryption algorithm can hide the information attribute of the plaintext image.
As can be seen from table 9, the entropy of the ciphertext image generated in this embodiment is closer to the theoretical maximum value, indicating that it has high randomness.
TABLE 9 information entropy analysis results
The test results show that the pseudo-random key stream generated by the embodiment can pass NIST test, and the time sequence of the pseudo-random key stream has high enough complexity and unpredictability, so that the key stream is ensured to have excellent randomness and robustness, and malicious attack behaviors such as differential attack, statistical attack and the like can be effectively resisted.