A Dynamic Diffusion Chaos Image Encryption and Decryption Method and System Based on Raspberry Pi and NTRU Algorithm
By introducing a dynamic diffusion chaotic image encryption method based on Raspberry Pi and NTRU algorithms in image encryption, the lack of dynamicity and key distribution problems in the prior art are solved, and the image encryption and decryption process with high security and confidentiality is realized.
Patent Information
- Application Number
- CN202310008513.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-04
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2043-01-04
AI Technical Summary
The prior art has insufficient dynamics and key distribution problems in the image encryption process, resulting in insufficient encryption and being vulnerable to the risk of interception among attackers.
The dynamic diffusion chaotic image encryption and decryption method based on Raspberry Pi and NTRU algorithms is adopted to generate a chaotic matrix through a three-dimensional digital domain chaotic system, encrypt and decrypt the image, and use the NTRU algorithm to ensure the security of the encryption key.
It improves the security and confidentiality of the image encryption algorithm, ensures that the encrypted key is difficult to be cracked by the Shor algorithm, and reduces the risks in the key distribution process.
Smart Images

Figure CN116015605B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of information transmission, and more specifically, it relates to a dynamic diffusion chaotic image encryption and decryption method and system based on Raspberry Pi and NTRU algorithm. Background Art
[0002] With the rapid development of modern information technology, more and more digital images carrying various kinds of information are generated and transmitted on the Internet. Digital images not only have a very intuitive visual effect, but also have great potential and additional information. For example, a citizen's personal photo can not only intuitively show a person's appearance, but also convey some other information, such as their state, health and age. Especially for digital images in the fields of national administration, military defense, etc., they will contain some very confidential information. If leaked, it will cause great turmoil to the whole society. Therefore, it is crucial to encrypt confidential digital images during transmission to prevent unauthorized access by others.
[0003] Although the traditional Advanced Encryption Standard (AES), initially developed for data encryption, can also be used for image encryption. However, due to the lack of consideration of the redundancy characteristics of images, AES has always performed poorly in image encryption and is not suitable for encrypting images. Based on different technologies such as chaos, wave transmission, fractional-order Mellin transform, p-Fibonacci transform, visual cryptography, elliptic curve ElGamal, gray code, gyro transform, etc., many image encryption algorithms have been developed. However, different encryption algorithms have their own advantages and disadvantages. Among these numerous algorithms, the image encryption algorithms based on chaotic mapping are the focus of people's research. The chaotic system has characteristics such as ergodicity, non-periodicity, high sensitivity to initial values and control parameters, and pseudo-randomness, which very much meet the encryption requirements of cryptography. The encryption algorithms based on chaotic sequences are simple to operate, have high encryption efficiency and high security performance, so they have attracted many scholars to engage in related research, and many excellent encryption algorithms have been born.
[0004] As early as in 1989, Matthew proposed an encryption algorithm based on logical mapping. In 1998, Fridrich first proposed a permutation-diffusion structure for chaotic image encryption. Subsequently, many researchers have paid great attention to chaotic image encryption technology and proposed various algorithms. Guan et al. used Arnold and Chen chaotic systems to achieve permutation and diffusion simultaneously. Ye and Wang proposed an image encryption algorithm based on the generalized Arnold map. The whole algorithm includes three parts, namely cyclic permutation, forward diffusion and reverse diffusion, which can resist known and chosen-plaintext attacks. Liu et al. introduced a chaotic image encryption algorithm based on a one-time key. Due to the more complex dynamic characteristics of hyperchaos than chaos, Gao et al. used the Logistic map to shuffle ordinary images and then used hyperchaos to encrypt the shuffled images. Zhao et al. proposed an image encryption scheme based on an improper fractional-order chaotic system. Recently, Wang and Zhang introduced spatio-temporal non-adjacent coupled map lattices and spatio-temporal hybrid linear-nonlinear coupled map lattices, which have more prominent cryptographic characteristics than the logical map and coupled map lattices. The simulation results prove the superiority and efficiency of the algorithms. Liu et al. proposed a fast image encryption algorithm based on a new two-dimensional sine ICMIC modulation map. Since bit-level permutation can change the position and value of pixels simultaneously, Xiang et al. proposed a selective image encryption scheme to encrypt the upper four bits of each pixel and keep the lower four bits unchanged. Zhu et al. proposed an image encryption bit-level permutation scheme based on the Arnold cat map and the logistic map. The parameters of the Arnold cat map are generated by the logistic map. Because the higher four bit-planes contain almost all the information in the image, they are scrambled independently, while the lower four bit-planes are arranged as a whole. Liu et al. proposed a color image encryption method based on spatial bit-level permutation and high-dimensional chaotic systems. Wang et al. proposed a new chaotic image encryption algorithm based on pixel bit cyclic shift.
[0005] In recent years, due to the good performance of dynamicity in encryption methods, it has received extensive attention from researchers. Lu et al. proposed a new chaotic image encryption algorithm, including a block image scrambling scheme and a new diffusion scheme based on dynamic indexing. Wang et al. proposed a dynamic diffusion encryption algorithm based on logic mapping and 2D-LASM system. This algorithm is generated by the interaction of two systems instead of relying on a single system. Therefore, this algorithm increases the size of the key space. Yin et al. proposed a chaotic image encryption scheme based on breadth-first search and dynamic diffusion. However, the dynamicity of these chaotic image encryption algorithms with dynamic diffusion is reflected in that the chaotic sequence values participating in the diffusion calculation are dynamically selected, but the diffusion rules used are single, and the dynamic characteristics cannot be fully utilized. Moreover, these image chaotic encryption algorithms all use symmetric encryption, which will have a fatal problem, that is, the key distribution problem. Therefore, there may be a risk of being intercepted by attackers during the transmission process, which may lead to the attacker being able to decrypt the encrypted image by himself and cause information leakage. Summary of the Invention
[0006] Aiming at the deficiencies of the existing technology, the purpose of the present invention is to provide a dynamic diffusion chaotic image encryption and decryption method and system based on Raspberry Pi and NTRU algorithm, which has the advantages of high information transmission security and strong confidentiality.
[0007] The above technical purpose of the present invention is achieved through the following technical solutions: A dynamic diffusion chaotic image encryption and decryption method based on Raspberry Pi and NTRU algorithm, including the following steps:
[0008] S1. Generate a random initial sequence based on the size of the initial image;
[0009] S2. Substitute the random initial sequence into a three-dimensional digital domain chaotic system to generate a chaotic matrix;
[0010] S3. Encrypt the initial image based on the chaotic matrix to obtain a ciphertext image;
[0011] S4. Input the ciphertext image into a decryption algorithm to obtain a plaintext image.
[0012] In one embodiment, the step S1 includes the following steps:
[0013] S11. Separate the R channel, B channel, and G channel from the initial image;
[0014] S12. Given seed values Z 1 , Z 2 and Z 3And input them separately into the Mersenne Twister generator in Python to generate three random initial sequences s = s 1 s 2 s 3 ...s w×h 、random initial sequence u = u 1 u 2 u 3 ...u w×h and random initial sequence v = v 1 v 2 v 3 ...v w×h 。
[0015] In one embodiment, the value range of the random initial sequence is [0, 2 32 -1].
[0016] In one embodiment, the step S2 includes the following steps:
[0017] S21. Substitute the random initial sequence s, random initial sequence u, and random initial sequence v into the three-dimensional digital domain chaotic system respectively. The mathematical expression of its iteration equation is:
[0018]
[0019] S22. Iterate the three-dimensional digital domain chaotic system w×h times to obtain chaotic sequences x = x 1 x 2 x 3 ....x w×h 、chaotic sequence y = y 1 y 2 y 3 ....y w×h and chaotic sequence z = z 1 z 2 z 3 ....z w×h ;
[0020] S23. Construct the chaotic sequence x = x 1 x 2 x 3 ....x w×h into a chaotic matrix X of size w×h, and the chaotic sequence y = y 1 y 2 y 3 ....y w×h into a chaotic matrix Y of size w×h, and the chaotic sequence z = z 1 z 2 z 3....z w×h Construct a chaotic matrix Z of size w×h.
[0021] In one embodiment, the step S3 includes the following steps:
[0022] S31. Forward permutation to obtain a permutation matrix;
[0023] S32. Forward diffusion to diffuse the permutation matrix into a diffusion matrix;
[0024] S33. Repeat steps S31 and S32 to obtain a ciphertext image.
[0025] In one embodiment, the step S31 includes the following steps:
[0026] S311. Perform dimensionality reduction processing on the chaotic matrices X, Y, Z, R channel, B channel, and G channel respectively to obtain chaotic sequences X’, Y’, Z’, R’, B’, and G’ of length w×h;
[0027] S312. Sort the chaotic sequences X’, Y’, and Z’ in ascending order respectively to obtain index sequences X_index, Y_index, and Z_index;
[0028] S313. Perform pixel-level index permutation on the chaotic sequence R’ through the index sequence X_index, on the chaotic sequence B’ through the index sequence Y_index, and on the chaotic sequence G’ through the index sequence Z_index. The formula is as follows:
[0029]
[0030] Obtain C R ’, C B ’, C G ’. Then, perform permutation on the C R ’, the C B ’, and the C G ’ respectively to obtain permutation matrices C R , permutation matrices C B , and permutation matrices C G .
[0031] In one embodiment, the step S32 includes the following steps:
[0032] S321. Calculate the values of t R (i, j), t B (i, j), and t G (i, j) respectively. The calculation method is as follows:
[0033]
[0034]
[0035]
[0036] S322. Determine the diffusion method of the permutation matrix according to the value of t R (i, j), the t B (i, j), the t G (i, j) to determine the diffusion method of the permutation matrix:
[0037] When t B (i, j) = 0, the forward diffusion rule for the B channel is the exclusive OR operation:
[0038]
[0039] When t G (i, j) = 0, the forward diffusion rule for the G channel is the exclusive OR operation:
[0040]
[0041] When t R (i, j) = 0, the forward diffusion rule for the R channel is the exclusive OR operation:
[0042]
[0043] When t B (i, j) = 1, the forward diffusion rule for the B channel is the modulo operation:
[0044]
[0045] When t G (i, j) = 1, the forward diffusion rule for the G channel is the modulo operation:
[0046]
[0047] When t R (i, j) = 1, the forward diffusion rule for the R channel is the modulo operation:
[0048]
[0049] S323. Diffuse the permutation matrix C R 、the permutation matrix C B 、the permutation matrix C G into diffusion matrices S R 、diffusion matrix S B 、diffusion matrix SG 。
[0050] In one embodiment, the decryption algorithm is the inverse operation of the digital domain encryption algorithm.
[0051] A dynamic diffusion chaotic image encryption and decryption system based on Raspberry Pi and NTRU algorithm, comprising:
[0052] Raspberry Pi, which encrypts the initial image based on the initial image size;
[0053] PC, which is used to receive the encrypted image and decrypt the encrypted image;
[0054] Wherein, the Raspberry Pi and the PC are transmitted through the network.
[0055] In one embodiment, the network transmission is Socket communication.
[0056] The above-mentioned dynamic diffusion chaotic image encryption and decryption method and system based on Raspberry Pi and NTRU algorithm have the following beneficial effects:
[0057] First, a chaotic image encryption algorithm with dynamic characteristics is designed by combining the excellent chaos and pseudo-randomness of the high-dimensional digital domain chaotic system, improving the security of the image encryption algorithm;
[0058] Second, by combining the security of the NTRU algorithm based on the shortest vector problem in the lattice, it can be ensured that the encrypted key can resist being cracked by the Shor algorithm, further improving the confidentiality during the image transmission process. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 is the flow schematic diagram of this embodiment;
[0060] Figure 2 is the diffusion path schematic diagram of the matrix in this embodiment;
[0061] Figure 3 is the schematic diagram of the plaintext image and the corresponding ciphertext image in this embodiment;
[0062] Figure 4 is the channel R, G, B component diagram of the plaintext image and the ciphertext image in this embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0063] To enable those skilled in the art to better understand the solution of this application, the following will clearly and completely describe the technical solution in the embodiments of this application in conjunction with the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of this application.
[0064] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so as to describe the embodiments of this application here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0065] A dynamic diffusion chaotic image encryption and decryption method based on Raspberry Pi and NTRU algorithm, as Figure 1 shown, includes the following steps:
[0066] Encryption stage:
[0067] S1. Generate a random initial sequence based on the size of the initial image;
[0068] Specifically, S11. Assume that the height and width of the initial image are h and w respectively, and separate the R channel, B channel, and G channel of the initial image;
[0069] S12. Through the given seed values Z 1 、Z 2 and Z 3 and input them into the Mersenne Twister generator in python respectively to generate three random initial sequences s = s 1 s 2 s 3 ...s w×h 、random initial sequence u = u 1 u 2 u 3 ...u w×h and random initial sequence v = v 1 v 2 v 3 ...v w×h 。
[0070] Preferably, the value range of the random initial sequence is [0, 2 32 - 1].
[0071] S2. Substitute the random initial sequence into the three - dimensional digital domain chaotic system to generate a chaotic matrix;
[0072] Specifically, S21. Substitute the random initial sequence s, the random initial sequence u, and the random initial sequence v into the three - dimensional digital domain chaotic system respectively. The mathematical expression of its iteration equation is:
[0073]
[0074] S22. Iterate the three - dimensional digital domain chaotic system w×h times to obtain chaotic sequences x = x 1 x 2 x 3 ....x w×h 、chaotic sequence y = y 1 y 2 y 3 ....y w×h and chaotic sequence z = z 1 z 2 z 3 ....z w×h ;
[0075] S23. Construct the chaotic sequence x = x 1 x 2 x 3 ....x w×h into a chaotic matrix X with size w×h,
[0076] the chaotic sequence y = y 1 y 2 y 3 ....y w×h into a chaotic matrix Y with size w×h, and the chaotic sequence z = z 1 z 2 z 3 ....z w×h into a chaotic matrix Z with size w×h.
[0077] Among them, the chaotic matrix X corresponds to the B channel of the initial image, the chaotic matrix Y corresponds to the G channel of the initial image, and the chaotic matrix Z corresponds to the R channel of the initial image.
[0078] S3. Encrypt the initial image based on the chaotic matrix to obtain the ciphertext image C;
[0079] Specifically, S31. Perform a forward permutation to obtain a permutation matrix;
[0080] S311. Perform dimensionality reduction processing on the chaotic matrices X, Y, Z, R channel, B channel, and G channel respectively to obtain chaotic sequences X’, Y’, Z’, R’, B’, and G’ with a length of w×h;
[0081] S312. Sort the chaotic sequences X’, Y’, and Z’ in ascending order respectively to obtain index sequences X_index, Y_index, and Z_index;
[0082] S313. Perform pixel-level index permutation on the chaotic sequence R’ through the index sequence X_index, on the chaotic sequence B’ through the index sequence Y_index, and on the chaotic sequence G’ through the index sequence Z_index. The formula is as follows:
[0083]
[0084] Obtain C R ’, C B ’, C G ’. Then, perform permutation on the C R ’, the C B ’, and the C G ’ respectively to obtain permutation matrices C R , permutation matrices C B , and permutation matrices C G .
[0085] As Figure 2 shown, S32. Forward diffusion, diffuse the permutation matrix into a diffusion matrix;
[0086] S321. Calculate the values of t R (i, j), t B (i, j), and t G (i, j) respectively. The calculation method is as follows:
[0087]
[0088]
[0089]
[0090] S322. Determine the diffusion method of the permutation matrix according to the values of the t R (i, j), the t B (i, j), and the t G (i, j):
[0091] When t BWhen (i,j) = 0, the forward diffusion rule for the B channel is an exclusive OR operation:
[0092]
[0093] When t G When (i,j) = 0, the forward diffusion rule for the G channel is an exclusive OR operation:
[0094]
[0095] When t R When (i,j) = 0, the forward diffusion rule for the R channel is an exclusive OR operation:
[0096]
[0097] When t B When (i,j) = 1, the forward diffusion rule for the B channel is a modulo operation:
[0098]
[0099] When t G When (i,j) = 1, the forward diffusion rule for the G channel is a modulo operation:
[0100]
[0101] When t R When (i,j) = 1, the forward diffusion rule for the R channel is a modulo operation:
[0102]
[0103] S323. Diffuse the permutation matrix C R 、the permutation matrix C B 、the permutation matrix C G into diffusion matrices S R 、diffusion matrix S B 、diffusion matrix S G .
[0104] S32. Perform forward permutation and forward diffusion on the obtained diffusion matrices S R 、diffusion matrix S B 、diffusion matrix S G . By performing forward permutation and forward diffusion in sequence, the ciphertext image C can be obtained.
[0105] Decryption phase:
[0106] S4. Input the ciphertext image C into the decryption algorithm to obtain the plaintext image P;
[0107] Just run the steps of the above encryption phase in reverse.
[0108] Specifically, S41, the reverse diffusion stage:
[0109] Separate the ciphertext image C into three matrices S of size w×h each. The reverse diffusion stage is the opposite of the forward diffusion stage. First, decrypt S R , S B , S G , and then decrypt S R , and finally decrypt S G . The reverse diffusion process is from right to left and from bottom to top. For each pixel in the three matrices S B , S R , S B , S G , which reverse diffusion rule to choose is calculated by the following dynamic formula:
[0110]
[0111]
[0112]
[0113] When t R (i, j) = 0, the reverse diffusion rule for the red channel is an exclusive OR operation:
[0114]
[0115] When t G (i, j) = 0, the reverse diffusion rule for the green channel is an exclusive OR operation:
[0116]
[0117] When t B (i, j) = 0, the reverse diffusion rule for the blue channel is an exclusive OR operation:
[0118]
[0119] When t R (i, j) = 1, the reverse diffusion rule for the red channel is a modulo operation:
[0120]
[0121] When t G (i, j) = 1, the reverse diffusion rule for the green channel is a modulo operation:
[0122]
[0123] When t B (i, j) = 1, the reverse diffusion rule for the blue channel is a modulo operation:
[0124]
[0125] The matrix S R , S B , S G Obtain three inverse permutation matrices C through the reverse diffusion stage R , C B , C G .
[0126] S42. Reverse permutation stage:
[0127] Perform dimensionality reduction on the chaotic matrices X, Y, Z, and C R , C B , C G respectively to obtain one-dimensional vectors X’, Y’, Z’, and C of length w×h R ’, C B ’, C G ’. Ascend the chaotic sequences X’, Y’, Z’ to obtain the corresponding index sequences X_index, Y_index, Z_index, and use them to reverse permute C R ’, C B ’, C G ’. The formula is as follows:
[0128]
[0129] Then, construct the obtained S R ’, S B ’, S G ’ into an inverse diffusion matrix S of size w×h R , S B , S G .
[0130] S43. Perform reverse diffusion and reverse permutation on the diffusion matrix in sequence again to obtain the plaintext image P
[0131] A dynamic diffusion chaotic image encryption and decryption system based on Raspberry Pi and NTRU algorithm, comprising:
[0132] Raspberry Pi, used to take pictures to obtain the initial image and encrypt the initial image to obtain the ciphertext image;
[0133] PC, used to receive the ciphertext image and decrypt the ciphertext image to obtain the plaintext image;
[0134] Wherein, the Raspberry Pi and the PC are transmitted through the network
[0135] Specifically, as the receiving party, the PC uses the NTRUEncrypt algorithm to generate a corresponding public key and private key. The receiving party sends the public key to the Raspberry Pi sender. When encrypting the original image, the Raspberry Pi sender uses the public key for encryption to obtain the encryption key, and sends this encryption key to the receiving party simultaneously when sending the ciphertext image through Socket communication. When decrypting, the receiving party can decrypt the encryption key using the private key to obtain the plaintext image.
[0136] As the only optional embodiment, as Figure 1 shown, where the Raspberry Pi is the sender and the PC is the receiving party. Connect a USB camera to the Raspberry Pi for taking pictures, collect the images, and establish a wireless connection with the PC by enabling the VNC function of the Raspberry Pi.
[0137] First, the receiving party needs to enable Socket communication to wait for the connection of the sending party; then, the sending party also enables Socket communication, finds the receiving party and makes a connection; if a sending party successfully connects to the receiving party, the receiving party will display its IP and port number; next, the sending party turns on the USB camera, uses the camera to collect the image to be transmitted, and before transmission, the image needs to be encrypted first; then, the sending party not only needs to transmit the encrypted image, but also needs to transmit the corresponding key so that the receiving party can decrypt the encrypted image by itself. If the key is directly sent to the receiving party, there may be a risk that others intercept the key illegally, resulting in others being able to decrypt the encrypted image by themselves. Therefore, the key also needs to be encrypted. Let the receiving party generate a pair of public key and private key, and encrypt with the public key. Only the corresponding private key can be used to decrypt it. So, the sending party sends a request for the public key to the receiving party; after receiving the request from the sending party, the receiving party generates a pair of public key and private key and transmits the public key to the sending party; after receiving the public key, the sending party uses the public key to encrypt the key; finally, the sending party sends the encrypted image and the encrypted key to the receiving party through the network; after receiving the encrypted image and the encrypted key, the receiving party first decrypts the encrypted key to obtain the key, and then uses the key to decrypt the encrypted image to obtain the plaintext image.
[0138] Comparative analysis:
[0139] 1. Histogram analysis
[0140] As Figure 3 shown, the pixel value distribution of the histogram of the plaintext image is uneven. An attacker can obtain the information of the plaintext image according to the distribution of the pixel values. After the plaintext image is encrypted by the method provided in this solution, the histogram distribution of the ciphertext image is quite uniform, which well hides the pixel value information, thus achieving the encryption effect.
[0141] 2. Correlation analysis
[0142] Randomly select 5000 pairs of adjacent pixels in the horizontal, vertical, and diagonal directions of the plaintext images and ciphertext images respectively, and draw the pixel correlation diagrams. As Figure 4 shown, (4a) shows the R component of the plaintext image; (4c) shows the G component of the plaintext image; (4e) shows the B component of the plaintext image; (4b) shows the R component of the ciphertext image; (4d) shows the G component of the ciphertext image; (4f) shows the B component of the ciphertext image; and calculate the correlation coefficient between pixels according to the following formula.
[0143]
[0144]
[0145]
[0146]
[0147] In the formula, x and y respectively represent the values of adjacent pixel groups of the image, E(o) represents the mathematical expectation, cov(o) represents the covariance, and γ xy represents the relationship coefficient of adjacent pixels. The calculation results are shown in Table 1. The closer the correlation coefficient is to 0, the stronger the correlation, and the smaller the value, the less relevant.
[0148] Table 1 Correlation coefficients of the R, G, and B components of the ciphertext image
[0149]
[0150]
[0151] 3. Information entropy analysis
[0152] Information entropy is an important indicator to characterize the randomness and unpredictability of a source of information. Information entropy is usually described by the average amount of information, that is, the average number of bits required to represent a symbol in a source of information, and its definition is:
[0153]
[0154] where φ represents a source of information composed of N different symbols constituting the source of information, is the probability of the symbol appearing. It can be seen from Equation (26) that for a purely random image with a pixel value of 256 gray levels, the theoretical value of its information entropy is H(φ) = 8. Therefore, for a well-designed image encryption system, the information entropy of the output ciphertext image should be as close to 8 as possible.
[0155] Table 2 presents the information entropy of the plaintext image and the corresponding ciphertext image obtained using the above formula. As can be seen from the table, the information entropy of all ciphertext images is extremely close to the ideal value of 8, which means that the ciphertext image output by this encryption system can be regarded as a random information source.
[0156] Table 2 Information Entropy of Original Images and Encrypted Ciphertext Images of Different Sizes
[0157]
[0158]
[0159] 4. Randomness of Cipher Images
[0160] The pixels of an ideal cipher image need to be uniformly distributed to resist statistical attacks. The National Institute of Standards and Technology (NIST) SP800-22 is an established standard for measuring the randomness of data sequences. It contains 15 sub-tests and uses a set of binary sequences as input. All sub-tests are designed to identify non-random regions of the binary sequence. Each sub-test produces a P-value. Setting the significance level α = 0.01, if the generated P-value is greater than 0.01, the test sequence is considered to pass the test. After encrypting multiple plaintext images, the ciphertext images are converted into binary sequences and input into the NIST test. The results are shown in Table 3. It can be seen that all 15 sub-tests pass, indicating that the ciphertext images have high randomness.
[0161] Table 3 NIST Test Results of Ciphertext Images
[0162]
[0163]
[0164] From the tests in the above four aspects, it can be seen that the chaotic image encryption algorithm of this scheme has good anti-statistical attack ability and high randomness, effectively improving the security and confidentiality of pictures during transmission.
[0165] The above-described embodiments merely represent several implementation manners of the present invention. The description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the patent of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present invention, several modifications and improvements can still be made, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention should be subject to the appended claims.
Claims
1. A dynamic diffusion chaotic image encryption and decryption method based on Raspberry Pi and NTRU algorithm, characterized in that, it includes the following steps: S1. Generate a random initial sequence based on the size of the initial image; S2. Substitute the random initial sequence into a three-dimensional digital domain chaotic system to generate a chaotic matrix; S3. Encrypt the initial image based on the chaotic matrix to obtain a ciphertext image; S4. Input the ciphertext image into a decryption algorithm to obtain a plaintext image; The step S1 includes the following steps: S11. Separate the R channel, B channel, and G channel from the initial image; S12. Given the seed value Z 1 , Z 2 and Z 3 and input them into the Mersenne Twister generator in Python respectively to generate three random initial sequences s = s 1 s 2 s 3 ...s w×h , random initial sequence u = u 1 u 2 u 3 ...u w×h and random initial sequence v = v 1 v 2 v 3 ...v w×h ; The value range of the said random initial sequence is [0, 2 32 - 1]; The step S2 includes the following steps: S21. Substitute the random initial sequence s, random initial sequence u, and random initial sequence v into the three-dimensional digital domain chaotic system respectively, and the mathematical expression of its iteration equation is: S22. Iterate the three-dimensional digital domain chaotic system w×h times to obtain chaotic sequences x = x 1 x 2 x 3 ....x w×h , chaotic sequence y = y 1 y 2 y 3 ....y w×h and chaotic sequence z = z 1 z 2 z 3 ....z w×h ; S23. Construct the chaotic sequence \(x = x 1 x 2 x 3 ....x w×h \) into a chaotic matrix \(X\) of size \(w\times h\). Construct the chaotic sequence \(y = y 1 y 2 y 3 ....y w×h \) into a chaotic matrix \(Y\) of size \(w\times h\). Construct the chaotic sequence \(z = z 1 z 2 z 3 ....z w×h \) into a chaotic matrix \(Z\) of size \(w\times h\).
2. A dynamic diffusion chaotic image encryption and decryption method based on Raspberry Pi and NTRU algorithm according to claim 1, characterized in that, the step S3 includes the following steps: S31. Forward permutation to obtain a permutation matrix; S32. Forward diffusion to diffuse the permutation matrix into a diffusion matrix; S32. Repeat steps S31 and S32 to obtain a ciphertext image.
3. A dynamic diffusion chaotic image encryption and decryption method based on Raspberry Pi and NTRU algorithm according to claim 2, characterized in that, the step S31 includes the following steps: S311. Perform dimensionality reduction processing on the chaotic matrix X, chaotic matrix Y, chaotic matrix Z, R channel, B channel, and G channel respectively to obtain chaotic sequences X’, Y’, Z’, R’, B’, G’ with a length of w×h; S312. Ascending order the chaotic sequences X’, Y’, Z’ respectively to obtain index sequences X_index, Y_index, Z_index; S313. Perform pixel-level index permutation on the chaotic sequence R’ through the index sequence X_index, on the chaotic sequence B’ through the index sequence Y_index, and on the chaotic sequence G’ through the index sequence Z_index, and the formula is as follows: Obtain C R ’, C B ’, C G ’, and then respectively perform permutations on the said C R ’, the said C B ’, the said C G ’ to obtain permutation matrices C R , permutation matrix C B , permutation matrix C G .
4. A dynamic diffusion chaotic image encryption and decryption method based on Raspberry Pi and NTRU algorithm according to claim 3, characterized in that, the step S32 includes the following steps: S321. Calculate t R (i,j), t B (t,j), t G (i,j) values, and the calculation method is as follows: S322. Determine the diffusion method of the permutation matrix according to the value of t R (i, j), the t B (i, j), the t G (i, j): Determine the diffusion method of the permutation matrix according to the value of (i, j). When t B (i,j) = 0, the forward diffusion rule of the B channel is an exclusive OR operation: When t G (i,j) = 0, the forward diffusion rule for the G channel is an exclusive OR operation: When t R (i,j) = 0, the forward diffusion rule for the R channel is an exclusive OR operation: When t B (i, j) = 1, the forward diffusion rule of the B channel is a modulo operation: When t G (i, j) = 1, the positive diffusion rule of the G channel is a modulo operation: When t R (i, j) = 1, the forward diffusion rule for the R channel is a modulo operation: S323. Diffuse the permutation matrix C R 、the permutation matrix C B 、the permutation matrix C G into diffusion matrices S R 、diffusion matrix S B 、diffusion matrix S G respectively.
5. A dynamic diffusion chaotic image encryption and decryption method based on Raspberry Pi and NTRU algorithm according to claim 1, characterized in that: the decryption algorithm is the inverse operation of the digital domain encryption algorithm.
6. A dynamic diffusion chaotic image encryption and decryption system based on Raspberry Pi and NTRU algorithm, applied to a dynamic diffusion chaotic image encryption and decryption method according to any one of claims 1-5, characterized in that, it includes: Raspberry Pi, encrypt the initial image based on the initial image size; PC, used to receive the encrypted image and decrypt the encrypted image; Among them, the Raspberry Pi and the PC are transmitted through the network.
7. A dynamic diffusion chaotic image encryption and decryption system based on the Raspberry Pi and the NTRU algorithm according to claim 6, characterized in that: The network transmission is Socket communication.
Citation Information
Patent Citations
Image encryption method for high dimension digital domain chaotic system
CN105550972A
Digital image feedback encryption method based on image network
CN107220923A