Image encryption method and device based on neural network chaotic system
By building a chaotic system based on neural networks, complex chaotic sequences are generated for image encryption, which solves the problem of insufficient security and attack resistance of the image encryption process in the prior art, and achieves higher encryption security and attack resistance.
Patent Information
- Application Number
- CN202510139238.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-08
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2045-02-08
AI Technical Summary
The prior art is difficult to effectively resist password attacks during image encryption, and the security and attack resistance of the encryption process are insufficient.
Using an image encryption method based on the chaotic system of neural networks, by constructing a chaotic system of Shindermash-Ross neurons, memristors and Hopfield neural networks, complex chaotic sequences are generated for confusion and diffusion, improving the security of image encryption.
This method significantly improves the security and attack resistance of the image encryption process, and can more effectively resist common password attacks such as brute force cracking and statistical attacks.
Smart Images

Figure CN119603410B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing, and in particular to an image encryption method and device based on a neural network chaotic system. Background Art
[0002] With the development of information technology, information security is of paramount importance in the era of information expansion. Digital images contain a large amount of information. Images have become an important carrier of information dissemination and are widely used in social media, e-commerce, medical imaging, monitoring systems and other fields. However, the widespread use of images is also accompanied by security risks. Image content may be maliciously tampered with, stolen or leaked, posing serious risks to personal privacy and business secrets. Summary of the invention
[0003] The purpose of this application is to provide an image encryption method and device based on a neural network chaotic system, which can improve the security and anti-attack capability of the encryption process.
[0004] To achieve the above objectives, this application provides the following solutions.
[0005] In the first aspect, the present application provides an image encryption method based on a neural network chaotic system, including: preprocessing an image matrix to be encrypted to generate a plaintext image in a square matrix form; associating the plaintext image with an external key to generate three groups of initial values of the neural network chaotic system; the neural network chaotic system is constructed based on Hindmarsh-Ross neurons, memristors and Hopfield neural networks; inputting the three groups of initial values into the neural network chaotic system respectively to generate three groups of target chaotic sequences; generating a scrambled matrix in which each element is unique in each row and column according to the first group of target chaotic sequences; generating two diffusion matrices according to the second group of target chaotic sequences and the third group of target chaotic sequences; scrambling the plaintext image in rows according to the row index of the scrambled matrix to obtain a row scrambled matrix; scrambling the row scrambled matrix in columns according to the column index of the scrambled matrix and two diffusion matrices to obtain a ciphertext image.
[0006] In a second aspect, the present application provides a computer device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the image encryption method based on a neural network chaotic system.
[0007] According to the specific embodiments provided in the present application, the present application discloses the following technical effects: the present application provides an image encryption method and device based on a neural network chaotic system, uses a memristor to simulate neural synapses, analyzes the influence of free neurons Hindmarsh-Ross on a small Hopfield neural network, and constructs a neural network chaotic system. The chaotic system has a high sensitivity to initial values, and the generated chaotic sequence has complex pseudo-randomness. Image encryption using the characteristics of the chaotic system can better resist common cryptographic attacks, such as brute force cracking, statistical attacks, etc. During the encryption process, the chaotic sequence generated by the chaotic system is used to obtain a scrambling matrix and a diffusion matrix, realizing the functions of synchronous scrambling and diffusion, which can improve the security and anti-attack capability of the encryption process. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0009] Figure 1 A flowchart of an image encryption method based on a neural network chaotic system provided in this application.
[0010] Figure 2 A tight hysteresis loop curve diagram of the memristor provided for this application; Figure 2 Part (a) is the amplitude variation curve of the memristor at a fixed frequency. Figure 2 Part (b) is the frequency variation curve of the memristor under fixed amplitude.
[0011] Figure 3 Topological diagram of the Hopfield neural network provided for this application.
[0012] Figure 4 Lyapunov exponents and bifurcation diagrams of the neural network chaotic system provided for this application; Figure 4 Part (a) shows the first three Lyapunov exponents of the neural network chaotic system. Figure 4 Part (b) is the bifurcation diagram of the neural network chaotic system.
[0013] Figure 5 The phase diagram of the neural network chaotic system provided in this application at the initial value (0.1, 0.1, 0.1, 0.1, 0.1, 0.1); Figure 5 Part (a) is the phase diagram of the neural network chaotic system when the parameter k=0.6. Figure 5 Part (b) is the phase diagram of the neural network chaotic system when the parameter k=0.2.
[0014] Figure 6 Neural network chaos system provided for this application Schematic diagram of the local basin of attraction of a plane.
[0015] Figure 7 Schematic diagram of coexistence attractors of the neural network chaotic system provided in this application under different initial values.
[0016] Figure 8 This is the HNN circuit schematic diagram of the neural network chaotic system provided in this application.
[0017] Fig. 9 Schematic diagram of the HR circuit of the neural network chaotic system provided in this application.
[0018] Fig.10 This is a schematic diagram of the memristor circuit of the neural network chaotic system provided in this application.
[0019] Fig.11 This is the multisim circuit simulation diagram of the neural network chaotic system provided in this application.
[0020] Fig.12 A detailed flow chart of the image encryption method based on a neural network chaotic system provided in this application.
[0021] Fig.13 The encrypted and decrypted images of the three images of "airplane", "pepper" and "baboon" provided for this application; Fig.13 Parts (a), (b), and (c) are the plaintext image, ciphertext image, and decrypted image of the “airplane” image, respectively. Fig.13 Parts (d), (e) and (f) are the plaintext image, ciphertext image and decrypted image of the “chili” image, respectively. Fig.13 Parts (g), (h) and (i) are the plaintext image, ciphertext image and decrypted image of the “baboon” image respectively.
[0022] Fig.14 A graph showing the correlation test results for the “aircraft” image provided for this application; Fig.14 Parts (a), (b), and (c) are the correlation test results of the plaintext image of the “airplane” image in the horizontal, vertical, and diagonal directions, respectively. Fig.14 Parts (d), (e) and (f) are the correlation test result diagrams of the ciphertext image of the “airplane” image in the horizontal, vertical and diagonal directions respectively.
[0023] Fig.15 The robustness test result diagram of the “aircraft” image provided for this application; Fig.15Parts (a) and (b) in the figure are the ciphertext image of the “airplane” image cropped 1 / 4 and the decrypted image after cropping, respectively. Fig.15 Parts (c) and (d) in the figure are the ciphertext image of the “airplane” image cropped 1 / 16 and the decrypted image after cropping, respectively. DETAILED DESCRIPTION
[0024] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0025] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0026] In an exemplary embodiment, the present application provides an image encryption method based on a neural network chaotic system. In the embodiment of the present application, Figure 1 As shown, the method includes the following steps 1 to 7.
[0027] Step 1: Preprocess the image matrix to be encrypted to generate a plaintext image in the form of a square matrix.
[0028] Step 2: Associating the plaintext image with the external key to generate three sets of initial values of the neural network chaotic system. The neural network chaotic system is constructed based on Hindmarsh-Ross neurons, memristors and Hopfield neural networks.
[0029] Step 3: Input the three sets of initial values into the neural network chaotic system respectively to generate three sets of target chaotic sequences.
[0030] Step 4: Generate a scrambled matrix in which each element is unique in each row and column according to the first set of target chaotic sequences.
[0031] Step 5: Generate two diffusion matrices according to the second set of target chaotic sequences and the third set of target chaotic sequences.
[0032] Step 6: Perform row scrambling on the plaintext image according to the row index of the scrambling matrix to obtain a row scrambling matrix.
[0033] Step 7: Perform column scrambling and synchronous diffusion on the row scrambling matrix according to the column index of the scrambling matrix and the two diffusion matrices to obtain the ciphertext image.
[0034] This application constructs a new type of neural network chaotic system, namely, a neuron memristor neural network (HR-M-HNN) chaotic system, and applies it to image encryption. The following is a detailed description of the construction of the neural network chaotic system and the implementation of the image encryption method.
[0035] The human brain is composed of a large number of neurons, and information is transmitted between neurons through synapses. The functionality of neurons reflects their important role in information reception, processing, transmission and plasticity. Through complex electrochemical mechanisms, neurons can not only respond to external stimuli, but also continuously adjust their own functions in learning and adaptation. This high degree of functionality is the basis for the normal operation and complex behavior of biological nervous systems. In biological nervous systems, free neurons refer to neurons that are not directly connected to specific neural circuits. They can connect with other neurons or neural networks through synapses in the nervous system to form a complex signal transmission network. The Hopfield neural network (HNN) is used to simulate the complex behavior of the human brain. The study of the interaction between Hindmarsh-Rose (HR) and HNN is of great help in understanding the complex neural activities of the human brain and studying new artificial neural networks. The neural network chaos system constructed in this application uses memristors to simulate neural synapses and analyzes the influence of free neurons HR on small HNNs. The Lyapunov index, phase diagram, bifurcation diagram and local attraction basin of the chaotic system were analyzed by MATLAB numerical simulation. Finally, the circuit schematic of the system was drawn using multisim simulation software, and it was simulated and compared with the phase diagram in MATLAB to verify the correctness of the numerical simulation analysis in MATLAB.
[0036] Memristors are often used to simulate neural synapses. This application proposes a new type of memristor based on a magnetically controlled memristor, and its model is as follows.
[0037] .
[0038] Where a, b, and c are the relevant parameters of the memristor. and Represent the input voltage and output current respectively, is the magnetic flux of the memristor, represents the memristor function, is the hyperbolic tangent function, is a sine function.
[0039] In order to verify whether the proposed memristor model conforms to the tight hysteresis curve characteristics. When the memristor parameters a=0.5, b=1, c=0.45, a sinusoidal voltage is added to the input of the proposed memristor. , where A is the voltage amplitude, F is the frequency, and t is the time. When (0)=-1, F=1, the volt-ampere characteristic curves when the amplitude A=6, 8, 10, 12 are as follows Figure 2 As shown in part (a) of When (0)=-2, A=10, the volt-ampere characteristic curves when the amplitude F=2,5,10,25 are as follows Figure 2 As shown in part (b) of .
[0040] The mathematical model of the Hindmarsh-Ross neuron is as follows.
[0041] .
[0042] In the formula, is the cell membrane potential, is the recovery variable of HR neurons, is the external current, All are parameters.
[0043] The Hopfield neural network is a classic neural network model, and its mathematical model is as follows.
[0044] .
[0045] In the formula, , , are the capacitance, resistance and voltage on the neuron cell membrane. It connects neurons q arrive p The weight matrix represents the connection strength of the synapses between neurons. is the activation function of the neuron, is the external input current of the neuron, Is a positive integer.
[0046] This application combines memristors (M) with HNN and HR neurons to simulate neural synapses. When the number of neurons n=3, the topology of the neural network is as follows Figure 3 As shown. =1, =1, =0, the mathematical model of HR memristor HNN (HR-M-HNN) is as follows.
[0047] .
[0048] In the formula, is the voltage on the cell membrane of the first neuron in the Hopfield neural network, for The first derivative of is the voltage on the cell membrane of the second neuron in the Hopfield neural network, for The first derivative of is the voltage on the cell membrane of the third neuron in the Hopfield neural network, for The first derivative of is the cell membrane potential of the Hindmarsh-Ross neuron, for The first derivative of is the restoration variable of the Hindmarsh-Ross neuron, for The first derivative of is the magnetic flux of the memristor, for The first derivative of is the hyperbolic tangent function, is a sine function, is the relevant parameter of the chaotic system, indicating the coupling strength, , and These are the relevant parameters of the memristor.
[0049] The characteristics of the HR-M-HNN chaotic system are as follows: the system consists of HR neurons connected to the neural network through synapses simulated by the new memristor, where the parameters of the neuron HR are They are set to 1, 3, 1, and 3 respectively. The weight matrix of HNN is: .
[0050] Analyze the complex dynamics under parameter control: fix the parameters a=0.5, b=1, c=0.8. Set the initial value of the system to (0.1, 0.1, 0.1, 0.1, 0.1, 0.1). Perform a parameter sweep on the coupling strength k and analyze the Lyapunov exponent and bifurcation diagram of the system, such as Figure 4 shown.
[0051] In order to further verify the dynamic changes of the chaotic system, for different parameters k, the phase diagram of the system is drawn, as shown in Figure 5 As shown in Figure 3, under different parameters k=0.6 or k=0.2, periodic attractors and chaotic attractors are generated, which is consistent with the dynamic behavior of the bifurcation diagram corresponding to this point.
[0052] The HR-M-HNN chaotic system will produce coexistence attractors under different initial values. Fixed parameters a=0.5, b=1, c=0.8, k=0.1, initial values , draw The local basin of attraction of a plane, such as Figure 6As shown in the figure, the local attraction basin intuitively shows that the system will produce different attractors under different initial values, and the three regions represent different chaotic states. In order to verify the chaotic state of different regions in the local attraction basin, phase diagrams under different initial values are drawn, as shown in Figure 1. Figure 7 As shown, according to At this time, the chaotic system is in a chaotic state. The attractor at this time shows that the chaotic system is in different chaotic states. A chaotic sequence generator (i.e., analog signal generator) based on the HR-M-HNN chaotic system is designed. The equation of the HR-M-HNN chaotic system is transformed into a dimensionless state equation, and the mathematical model of the chaotic circuit is as follows.
[0053] .
[0054] According to the coefficients of the chaotic system, the value of the chaotic circuit is obtained. The DC voltage E0 = 0.5V; E1 = 1V; E2 = 4V. The multiplier output gain =0.1; =0.1; =1, = 1. Resistance 10K ; 6.67K ; 3.57K ; 20K ; 10K ; 6.67K ; 9.09K ; 100K ; 10K ; 555 ; 10K ; 100 ; 333 ; 10K ; 333 ; 10K ; 100 ; 1K ; 10K ; 10K ; 10K ; 10K The supply voltage for all operational amplifiers is 15V.
[0055] Chaotic circuits include HNN circuits ( , , ), HR neuron circuit ( , ) and memristor circuits ( ), where the hyperbolic tangent function tanh operation circuit input , , and Calculated , , as well as , HR-M-HNN chaotic system circuit schematic diagram as shown in the circuit Figure 8 , Fig. 9 and Fig.10 shown.
[0056] 1. If Figure 8 As shown, the HNN circuit has three dimensions and consists of 9 operational amplifiers, resistors ~ ,resistance And the resistance of the control parameter k Composition; set the integration constant = 1s, where =10K , =100nF. Resistance Connected to the inverting input of the operational amplifier, the output is connected through another resistor Then it is connected to the reverse input terminal of the operational amplifier to form a reverse proportional operator , , .resistance Connected to the inverting input of the operational amplifier, the output is connected through a capacitor Then it is connected to the reverse input terminal of the operational amplifier to form an integrator , , The non-inverting input terminals of the operational amplifiers are both grounded.
[0057] The HNN first operation circuit includes a resistor ~ ,resistance ,resistance ,capacitance And the inverse proportional operator , Integrator and operational amplifiers .Signal Connecting the inverse proportional operator The input terminal, The output terminal and the resistor After connecting to the operational amplifier The inverting input terminal. , , 、- Respectively through the resistor , , , Then connect to the operational amplifier in parallel The inverting input terminal, The output terminal passes through the resistor Post-access The inverting input terminal, The output end is connected to the integrator The input terminal, The output result is .
[0058] The HNN second operation circuit includes a resistor ~ ,resistance ,capacitance And the inverse proportional operator , Integrator and operational amplifiers .Signal Connecting the inverse proportional operator The input terminal, The output terminal and the resistor After connecting to the operational amplifier The inverting input terminal. , , Respectively through the resistor , , Then connect to the operational amplifier in parallel The inverting input terminal, The output terminal passes through the resistor Post-access The inverting input terminal, The output end is connected to the integrator The input terminal, The output result is .
[0059] The HNN third operation circuit includes a resistor ,resistance ,resistance ,capacitance And the inverse proportional operator , Integrator and operational amplifiers .Signal Connecting the inverse proportional operator The input terminal, The output terminal and the resistor After connecting to the operational amplifier The inverting input terminal. Through resistor Then connected to the operational amplifier The inverting input terminal, The output terminal passes through the resistor Post-access The inverting input terminal, The output end is connected to the integrator The input terminal, The output result is .
[0060] 2. If Fig. 9 As shown, the HR circuit consists of two dimensions, consisting of 7 operational amplifiers, capacitors , Multiplier ~ ,resistance ~ , DC power supply E1 and resistance of control parameter k Composition. Set the integration constant = 1s, where =10K , =100nF. Resistance Connected to the inverting input of the operational amplifier, the output is connected through another resistor Then it is connected to the reverse input terminal of the operational amplifier to form a reverse proportional operator , , .resistance Connected to the inverting input of the operational amplifier, the output is connected through a capacitor Then it is connected to the reverse input terminal of the operational amplifier to form an integrator , The non-inverting input terminals of the operational amplifiers are both grounded.
[0061] The first HR operation circuit includes a multiplier ~ ,resistance ~ , resistance of control parameter k ,resistance ,capacitance And the inverse proportional operator , Integrator and operational amplifiers .Signal Connecting the Multiplier The first input terminal and the second input terminal of the multiplier The output of the multiplier is connected to The first input terminal, Connecting the Multiplier The second input of the multiplier The output end is connected to the reverse proportional operator The input terminal, The output terminal is connected through a resistor After the operational amplifier The reverse input terminal is connected; Connecting the Multiplier The first input terminal and the second input terminal of the multiplier The output terminal is connected through a resistor After the operational amplifier The inverting input terminal of the signal is connected; , Respectively through the resistor , After the operational amplifier The inverting input terminal of the operational amplifier is connected The output terminal is connected through a resistor After access to The inverting input terminal of the operational amplifier The output end is connected to the integrator The input terminal, The output terminal output .
[0062] The second HR operation circuit includes a multiplier ,resistance ~ , DC power supply E1, resistor ,capacitance And the inverse proportional operator , Inverse Proportional Operator , Integrator and operational amplifiers . The DC power supply E1 is connected to the With operational amplifier The inverting input terminal of the signal Connecting the Multiplier The first input terminal and the second input terminal of the multiplier The output end is connected to the reverse proportional operator The input terminal, The output terminal is connected through a resistor After the operational amplifier The inverting input terminal of the signal is connected; With inverse proportional operator The input terminal of the reverse proportional operator The output terminal is connected through a resistor After the operational amplifier The inverting input terminal of the operational amplifier is connected. The output terminal is connected through a resistor After access to The inverting input terminal of the operational amplifier The output end is connected to the integrator The input terminal is followed by the output .
[0063] 3. If Fig.10 As shown, the memristor circuit includes: a first memristor operation circuit, a second memristor operation circuit and a third memristor operation circuit.
[0064] The first operational circuit of the memristor consists of an operational amplifier And resistor ~ Composition. Signal , Respectively through the resistor , Then access to The positive input and negative input. The positive input terminal is connected through a resistor After grounding, The output terminal is connected through a resistor Then connect back to The inverting input terminal, The output signal of .
[0065] The second operational circuit of the memristor consists of four operational amplifiers , , , And resistor ,resistance ~ , DC power supply E2, resistance of control parameter b , resistance of control parameter c , Multiplier ~ and capacitor All operational amplifier positive input terminals are grounded. Connected to the inverting input of the operational amplifier, the output is connected through another resistor Then it is connected to the reverse input terminal of the operational amplifier to form a reverse proportional operator , .Signal Connecting the Multiplier The first input terminal and the second input terminal of the multiplier The output of the multiplier The first input of the multiplier The second input terminal is connected to , multiplier The output end is connected to the reverse proportional operator The input terminal, The output terminal is connected through a resistor After the operational amplifier The inverting input terminal of the signal , DC power supply E2 is connected to the multiplier The first input terminal and the second input terminal of the multiplier The output terminal is connected through a resistor After the operational amplifier The inverting input terminal of the operational amplifier is connected. The output terminal is connected through a resistor Then connect it back to its inverting input and put the operational amplifier The output of the multiplier is connected to The first input terminal, signal After the sin function operation, it is connected to The second input terminal, The output terminal is connected through a resistor Then connected to the operational amplifier The inverting input terminal of Connect to the reverse proportional operator Input terminal, inverse proportional operator The output terminal is connected through a resistor Then connect to the operational amplifier The inverting input terminal, The output terminal is connected through a capacitor Then connect it back to its inverting input terminal, the operational amplifier The output terminal output .
[0066] The third operational circuit of the memristor is composed of an operational amplifier and , Multiplier , DC power supply E0, resistance of control parameter a And resistor ,resistance and capacitor The DC power supply E0 is connected to the resistor With operational amplifier The inverting input terminal of the signal is connected; Through resistor With operational amplifier The positive input terminal of the operational amplifier is connected to The output terminal is connected through another resistor Connect back to its inverting input. Operational Amplifier The output result is , Access multiplier The first input terminal, Access multiplier The second input of the multiplier The output result is .Signal Through resistor Access to operational amplifier Inverting input terminal, operational amplifier The output terminal is connected through another resistor Connected to its inverting input, the operational amplifier The output signal of the output terminal is - .
[0067] Perform circuit simulation in multisim and set all capacitors The initial voltage is set to 0.1V, and the parameter control resistance is set 10K ; 10K ; 12.5K ; 50K . , Observe and the results are as follows Fig.11 As shown, Figure 5 The Matlab numerical simulation results of part (b) are basically consistent, and the chaotic circuit further verifies the correctness of the numerical simulation.
[0068] The HR-M-HNN chaotic system proposed in this application is helpful for studying the influence of free neurons on neural networks through synapses. In addition, for the proposed HR-M-HNN chaotic system, an analog circuit based on the system is designed and implemented, and a HR-M-HNN chaotic system analog signal generator is successfully constructed. It combines the unpredictability of the HR-M-HNN chaotic system and the high efficiency of the analog circuit, and can generate complex analog signals. It has a wide range of applications in the fields of communication, sensing, random number generation and neuroscience research.
[0069] This application proposes a new image encryption method with simultaneous scrambling and diffusion. Fig.12 As shown in the figure, the plaintext image (P=M1×N1) is shaped into a square matrix (N×N) and then associated with the secure hash function SHA-512. The obtained hash value is converted into 64 decimal numbers, and the initial value of the chaotic system is obtained after operating with the external initial key. The chaotic sequence generated by the chaotic system is used to obtain a scrambling matrix and two diffusion matrices, where each element of the scrambling matrix is unique in each row and column, and the diffusion matrix is generated by the chaotic sequence. First, the row index of the scrambling matrix is used to scramble the plaintext image, and then the column index of the scrambling matrix and the diffusion matrix are used to diffuse and scramble simultaneously. The specific steps of the image encryption method are as follows.
[0070] Step 1: Image preprocessing. Since the scrambling matrix and diffusion matrix used are both square matrices, the image is first reshaped into a square matrix. The implementation method is as follows.
[0071] Determine whether the image matrix to be encrypted is a square matrix; if the image matrix to be encrypted is a square matrix, determine the image matrix to be encrypted as a plaintext image; if the image matrix to be encrypted is not a square matrix, expand the image matrix to be encrypted to the nearest perfect square size by padding with zeros to generate a plaintext image.
[0072] Specifically, if the image matrix A (M1×N1) is not a square matrix, the matrix is expanded to the nearest perfect square matrix B (N×N) by padding with zeros, where N is the matrix that satisfies The smallest integer ≥M1×N1. The specific implementation method is: first calculate the number of all elements in the matrix A, sl, and convert it into a one-dimensional vector containing sl elements. , determine the side length N of the image matrix B, which is the upper bound of the square root of sl, and then Zero padding ( -sl), so that the total length of the vector reaches . The expanded vector Reshape into an N×N square matrix B as the plaintext image.
[0073] Step 2: Key generation. Since the chaotic system has coexisting attractors, different initial values have a great influence on the dynamics of the system. Therefore, according to the local attraction basin diagram, that is, Figure 6 The chaotic system parameters are fixed as a=0.5, b=1, c=0.8, k=0.1, and the initial values of the chaotic system are fixed as follows: , the first two dimensions of the chaotic system are used as keys, and the value range is: -0.5< <0.5, -0.5< <0.5. In order to make the key space of the cryptographic system large enough, this application uses a three-time chaotic system to generate three sets of chaotic sequences, and the initial value used to generate the chaotic sequence each time is different. The initial value of the chaotic system is obtained by associating the external key with the plaintext, and the method is implemented as follows.
[0074] The SHA-512 function operation is performed on the plaintext image to obtain a 512-bit hash value; the 512-bit hash value is converted into 64 decimal numbers, and each 4 decimal numbers are grouped and summed to obtain 16 sum values; the 16 sum values are first associated with 6 external keys to generate 6 plaintext key associated values; wherein the 6 plaintext key associated values correspond to the 6 external keys one by one; the 6 plaintext key associated values are divided into 3 groups in sequence, and are secondly associated with the corresponding external keys respectively to generate three groups of initial values of the neural network chaotic system.
[0075] The preprocessed plaintext image P (N×N) is operated by the SHA-512 function, and the 512-bit hash value is converted into 64 decimal numbers, which are divided into groups of 4 and summed up to obtain: , , ,... .Will ~ With external key ~ Perform an association operation to obtain the value associated with the plaintext ~ In order to generate three sets of initial values of the chaotic system, the last four dimensions of the three sets of initial values are fixed to 0.1, and the first two dimensions of each set of initial values are processed as follows.
[0076] Will , With external key , The first two dimensions of the first set of initial values of the chaotic system are obtained by correlation , ;Will , With external key , The first two dimensions of the second set of initial values of the chaotic system are obtained by correlation , ;Will , With external key , The first two dimensions of the third set of initial values of the chaotic system are obtained by correlation , The generation method is as follows, where is the intermediate summation value.
[0077] 。
[0078] .
[0079] .
[0080] Step 3: Preprocess the chaotic sequence to generate three sets of initial chaotic sequences (s1, s2, s3) with lengths of N, ceil((N×N) / 6), ceil((N×N) / 6), where ceil is rounded up. Expand the six dimensions of each set of chaotic sequences into a one-dimensional vector. Then process the chaotic sequences s1, s2, s3 to make the control sequence uniformly distributed. The processing method is: mod(s z ×10^4,1), where z∈{1,2,3}, and three sets of target chaotic sequences are obtained.
[0081] Specifically, three groups of initial values are respectively input into the neural network chaotic system to generate three groups of initial chaotic sequences; among them, the length of the first group of initial chaotic sequences is equal to the side length of the plaintext matrix, and the lengths of the second and third groups of initial chaotic sequences are both equal to the square of the side length of the plaintext matrix divided by 6 and rounded up; the six dimensions of each group of initial chaotic sequences are expanded into a one-dimensional vector, and the elements in the one-dimensional vector are multiplied by 10 to the fourth power and then a modulo 1 operation is performed to generate three groups of target chaotic sequences.
[0082] Step 4: Generate a scrambled matrix, in which each element is unique in each row and column. The implementation method is as follows.
[0083] Perform linear transformation and modular operation on the elements in the first group of target chaotic sequences to generate the first vector and the second vector; sort the elements in the first vector and the second vector respectively to generate the first sorting index mapping and the second sorting index mapping; use the first sorting index mapping as the reference row and the corresponding elements in the second sorting index mapping as the shift distance of the reference row, perform row cyclic shift and assignment, and generate a scrambled matrix in which each element is unique in each row and column. An example of a scrambled matrix is as follows.
[0084] 6-order matrix: .
[0085] Specifically, the method of generating the scrambled matrix is as follows.
[0086] 1. First, two vectors, namely the first vector Q1 and the second vector Q2, are generated by a specific linear transformation and modular operation of the chaotic sequence s1, and the value range of each element in Q1 and Q2 is limited to [1,255]. The generation method is as follows.
[0087] Q1=mod(floor((s1(1:N)+100)×10^10),256).
[0088] Q2=mod(floor((s1(1:N)+100)×10^12),256).
[0089] Where floor is the floor function and mod is the modular operation.
[0090] 2. Then sort the generated Q1 and Q2 sequences as follows.
[0091] [~,Qs1]=sort(Q1).
[0092] [~,Qs2]=sort(Q2).
[0093] Where Qs1 and Qs2 are sorted index mappings of Q1 and Q2 respectively.
[0094] 3. Then perform a row circular shift operation to generate a unique scrambled matrix L for each element in each row and column. For each row of the matrix L, use the Qs1 vector as the reference row and the corresponding element in the Qs2 vector as the shift distance of the row. Generate a new row through the RowShift circular shift function and assign it to the corresponding row of L. The function of the RowShift circular shift function is to circularly shift the input sequence Qs1 to the left, and the number of shifts is equal to the given shift value Qs2(r+1). The implementation method is: for r = 0:N-1 L(r+1, :) = RowShift(Qs1, Qs2(r+1)); end.
[0095] Step 5: Use chaotic sequence to generate diffusion matrices D1 and D2. The generation method is as follows.
[0096] Linear transformation and modular operation are performed on the elements in the second target chaotic sequence and the third target chaotic sequence to generate the third vector and the fourth vector; the third vector and the fourth vector are respectively reconstructed into matrices with the same size as the plaintext image to generate two diffusion matrices.
[0097] Specifically, first select the length of chaotic sequence s2 to be N×N. Multiply each element in sequence s2 by Then round down, perform a modulo operation on the obtained elements to obtain the third vector Q3, and then multiply each element in the sequence s3 by After that, the value is rounded down, and the obtained elements are subjected to a modulo operation to obtain a fourth vector Q4. After the modulo operation, the value can be limited to a grayscale level between 0 and 255, thereby forming a grayscale value range suitable for image processing. The method for generating Q3 and Q4 is as follows.
[0098] Q3=mod(floor(s2(1:N×N)×10^10),256).
[0099] Q4=mod(floor(s3(1:N×N)×10^10),256).
[0100] Then, Q3 and Q4 are reshaped into N×N matrix form through the reshape function to obtain two different diffusion matrices D1 and D2. The generation method is as follows.
[0101] D1=reshape(Q3,N,N).
[0102] D2=reshape(Q4,N,N).
[0103] Step 6: Use the scrambling matrix L to scramble the rows of the plaintext image P. Take each column in the plaintext image as the current processing column in turn, traverse all the rows in the current processing column, and exchange the elements in each row with the elements at the target position specified by the row index according to the row index of the scrambling matrix to obtain the row scrambling matrix.
[0104] Specifically, for each column (j) in the image P, starting from the first column to the last column, the following steps are performed in sequence: After selecting the current processing column, traverse all rows of the column. In this process, for each row (i), according to the row index value indicated by the corresponding position of the scrambled matrix L, the elements of the current row are exchanged with the elements at their target positions, so that the elements originally located in a specific row are moved to the new position specified by the scrambled matrix index, and the elements originally at the new position are moved to the original position. The entire process is repeatedly applied to all columns in the matrix until the row scrambling processing of the entire image P is completed, and the row scrambled image matrix PP is obtained. The implementation method is as follows.
[0105] .
[0106] In the formula, is the element value at the image matrix PP(i,j), is the element value at the plaintext image p(j,i), The element value of the target position specified by the row index of the scrambled matrix L in the plaintext image P, temp is a temporary variable.
[0107] Step 7: Column scrambling and synchronous diffusion. Take each element in the row scrambling matrix as the current processing element in turn, first pre-diffuse the current processing element according to the corresponding element in the first diffusion matrix, then exchange the current processing element with the element at the target position specified by the column index according to the column index of the scrambling matrix, and diffuse the current processing element according to the corresponding element in the second diffusion matrix. Among them, if the current processing element is an element in the first row and the first column, the corresponding element in the second diffusion matrix is added to the current processing element and then a modulo 256 operation is performed; if the current processing element is an element in the second column and thereafter, the corresponding element in the second diffusion matrix, the element in the previous column of the current processing element, and the current processing element are added and then a modulo 256 operation is performed; if the current processing element is an element in the first column but not the first row, the corresponding element in the second diffusion matrix, the element in the previous row and the last column of the current processing element, and the current processing element are added and then a modulo 256 operation is performed.
[0108] Specifically, first, the elements of the image matrix PP before column scrambling are pre-diffused: PP(i,j)=mod(D1(i,j)+PP(i,j),256); then the diffused elements are column-scrambled according to the column index of the scrambled matrix L, and diffusion is performed synchronously when performing the column scrambling operation (the column scrambling method is similar to the above-mentioned row scrambling method). When traversing the image matrix PP, the following column scrambling synchronous diffusion is performed.
[0109] When i=1 and j=1, the image matrix PP(1,1) is pre-diffused first, and then the columns are scrambled according to the column index of the scramble matrix L. Then, the algorithm enters the diffusion phase, and the elements of the diffusion matrix D2(1,1) are added to the pixel values of PP(1,1) and then a modulo operation is performed.
[0110] When j>1 (i.e. the current element is not in the leftmost column), the image matrix PP(i,j) is pre-diffused first, and then the columns are scrambled according to the column index of the scramble matrix L. Then, the algorithm enters the diffusion phase, and the previous column value PP(i,j-1) of the current position, the diffusion matrix D2(i,j), and the original value PP(i,j) of the current position are added, and the result is modulo 256.
[0111] When i>1 and j=1 (i.e. the current element is in the first column but not in the first row), the image matrix PP(i,j) is pre-diffused first, and then the columns are scrambled according to the column index of the scramble matrix L. Then, the algorithm enters the diffusion phase, and the last element PP(i-1,N) in the row above the current position, the diffusion matrix D2(i,j), and the original value PP(i,j) at the current position are added, and the result is also modulo 256.
[0112] The implementation method is: .
[0113] In the formula, is the element value at the diffusion matrix D1(i,j), is the element value of the diffusion matrix D2(i,j), is the element value at the image matrix PP(i,j-1), is the element value at the image matrix PP(i-1,N), The element value at the target position specified by the column index of the scrambling matrix L in the image matrix PP.
[0114] The decryption algorithm is the inverse process of the encryption algorithm and will not be described in detail in this application.
[0115] The above encryption and decryption algorithms together constitute the key system. In order to ensure the security and reliability of the cryptographic system, the security analysis of the cryptographic system is carried out. The computer configuration environment is 64-bit Windows 10, 32.0 GB RAM, Intel(R) Core(TM)i7-6700K CPU @ 4.00GHz 4.01 GHz, and the experimental platform is MATLAB R2021b.
[0116] In this embodiment, the HR-M-HNN chaotic system parameters are set to a=0.5, b=1, c=0.45, and k=0.1. ~ =(0.278498218867048, 0.546881519204984, 0.957506835434298, 0.964888535199277, 0.157613081677548, 0.970592781760616). Fig.13 The images of “airplane”, “pepper” and “baboon” are encrypted and decrypted. From the visual security of the ciphertext images, it can be seen that the cryptographic system has a significant encryption effect on the plaintext image information. In order to further verify the security of the cryptographic system, key space analysis, histogram test, correlation test, anti-differential attack analysis, key sensitivity analysis and robustness analysis are carried out on the cryptographic system.
[0117] 1. Key space analysis. A larger key space has the ability to resist exhaustive attacks. For the proposed HR-M-HNN chaotic system encryption algorithm, using 64-bit double-precision floating point numbers, the accuracy can reach The algorithm uses three HR-M-HNN chaotic systems to generate control sequences, so the single key space is (1× )×(1× )= In step 2 above, three different sets of initial values are used, and new values are selected each time. Since the selection of each set of initial values is independent, the total key space size is the product of these three key spaces: , much larger than , which can effectively resist exhaustive attacks.
[0118] 2. Correlation test. Extract 2000 pairs of adjacent pixels from the plaintext image ("airplane") and the ciphertext image, and compare the strength of the correlation between the adjacent pixels. Fig.14 As shown in Figure 1, based on the correlation comparison between adjacent pixels of plaintext and ciphertext, it can be concluded that the correlation between adjacent pixels of plaintext after encryption is very weak. After encrypting the plaintext image ("airplane", "pepper", "baboon"), the correlation coefficients of 2000 pairs of random adjacent pixels in the corresponding ciphertext image are calculated. The results are shown in Table 1. The correlation between adjacent pixels of the ciphertext image is close to 0.
[0119] Table 1 Correlation coefficient test table
[0120]
[0121] 3. Anti-differential attack. Differential attack is a common security attack model. Encrypt two plaintexts with small differences and compare their ciphertexts. If the Normalized Pixel Contrast Ratio (NPCR) value between the ciphertexts is close to the theoretical value of 99.6094%, it means that the cryptographic system has good anti-differential attack capabilities. The theoretical value of the Normalized Average Changing Intensity (UACI) is 33.4635%. The closer the test results are to this theoretical value, the stronger the cryptographic system's ability to resist differential attacks. As can be seen from the data in Table 2, the NPCR values are close to the theoretical value of 99.6094%, and the UACI values are close to the theoretical value of 33.4635%, which verifies that the cryptographic system has strong anti-differential attack capabilities.
[0122] Table 2 Anti-differential attack analysis table
[0123]
[0124] 4. Key sensitivity analysis: If the correct key is slightly changed and the same ciphertext image is decrypted, if the slightly changed key cannot correctly decrypt the ciphertext image, it means that the cryptographic system has strong key sensitivity.
[0125] For the plaintext image "airplane", add slight changes to each of the six external keys ( ), the difference between the ciphertext images encrypted by the original external key and the modified key was tested and analyzed by NPCR and UACI, where the ciphertext image encrypted by the original external key is represented by C, and the ciphertext images encrypted by the modified key are represented by C1 to C6 respectively. The test results are shown in Table 3. The NPCR values are close to the theoretical value of 99.6094%, and the UACI values are close to the theoretical value of 33.4635%. The results in the table show that the proposed cryptographic system has extremely strong key sensitivity.
[0126] Table 3 NPCR and UACI between ciphertext images
[0127]
[0128] 5. Robustness test. If information is lost or there is transmission noise during the transmission process, the encryption and decryption system still needs to be able to ensure data security and decryption capabilities. Fig.15 As shown in the figure, the ciphertext is first cropped by 1 / 4 and 1 / 16 respectively, and then the ciphertext image is decrypted. It can be seen that the cryptographic system has extremely strong robustness.
[0129] In summary, the artificial neural network HNN is used to simulate the complex behavior of the human brain and study the interaction between HR and HNN, which is of great help to understand the complex neural activities of the human brain and study new artificial neural networks. The HR-M-HNN chaotic system proposed in this application helps people study the influence of free neurons on neural networks through synapses. The HR-M-HNN chaotic system proposed in this application has complex dynamic behaviors and has multiple coexisting attractors, which further confirms the complex dynamic characteristics of human brain activities. The coexistence of multiple attractors provides more options for chaotic communication and information encryption. By switching different attractor states to encode information, the confidentiality and robustness of the system can be effectively improved. This application designs and implements an analog circuit based on the proposed HR-M-HNN chaotic system, and successfully constructs an HR-M-HNN chaotic system analog signal generator, which combines the unpredictability of the HR-M-HNN chaotic system and the high efficiency of the analog circuit, and can generate complex analog signals. It has a wide range of applications in communication, sensing, random number generation, and neuroscience research. Based on the proposed new chaotic system, this application proposes a new synchronous scrambling diffusion image encryption method and a corresponding cryptographic system. By analyzing the key space of the cryptographic system, it is found that the size of its key space is approximately: , much larger than , which can effectively resist exhaustive attacks. The correlation test result is close to 0, indicating that the encrypted image pixels are randomly distributed and the original information has been completely obfuscated. From the test data of differential attack resistance, it can be seen that the NPCR values are close to the theoretical value of 99.6094%, and the UACI values are close to the theoretical value of 33.4635%, which verifies that the cryptographic system has a strong ability to resist differential attacks, ensuring that a small change in the plaintext will lead to a large range of unpredictable differences in the ciphertext, thereby improving the system's anti-attack ability and data security. By conducting a key sensitivity analysis on the cryptographic system, the analysis results show that it has a high degree of key sensitivity, ensuring that attackers cannot restore plaintext by probing the key in a small range, and that a small change in the key will lead to completely different encryption results, improving the security of the system. By conducting a robustness analysis on the cryptographic system, it is verified that the cryptographic system still has the ability to ensure data security and decryption when facing various attacks, data loss, transmission errors or noise interference.
[0130] In an exemplary embodiment, the present application further provides a computer device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0131] In an exemplary embodiment, the present application further provides a computer-readable storage medium storing a computer program, which implements the steps in the above-mentioned method embodiments when executed by a processor.
[0132] In an exemplary embodiment, the present application further provides a computer program product, including a computer program, which implements the steps in the above-mentioned method embodiments when executed by a processor.
[0133] It should be noted that in this application, all actions to obtain signals, information or data are carried out in compliance with the relevant data protection laws and policies of the country where they are located and with the authorization given by the owner of the corresponding device.
Claims
1. An image encryption method based on a neural network chaotic system, characterized in that: include: Preprocess the image matrix to be encrypted to generate a plaintext image in the form of a square matrix; The plaintext image is associated with the external key to generate three sets of initial values of the neural network chaotic system; The neural network chaotic system is constructed based on Hindmarsh-Ross neurons, memristors and Hopfield neural networks; Input three groups of initial values into the neural network chaotic system respectively to generate three groups of target chaotic sequences; Generate a scrambled matrix in which each element is unique in each row and each column according to the first set of target chaotic sequences; Two diffusion matrices are generated according to the second group of target chaotic sequences and the third group of target chaotic sequences; Perform row scrambling on the plaintext image according to the row index of the scrambling matrix to obtain a row scrambling matrix; According to the column index of the scrambled matrix and two diffusion matrices, the row scrambled matrix is subjected to column scrambled synchronous diffusion to obtain a ciphertext image; The number of neurons in the Hopfield neural network is 3, the capacitance and resistance on the neuron cell membrane are both 1, and the external input current of the neuron is 0; the parameters of the Hindmarsh-Ross neuron are , , and are set to 1, 3, 1 and 3 respectively; the mathematical model of the neural network chaotic system is: ; in, is the voltage on the cell membrane of the first neuron in the Hopfield neural network, for The first derivative of is the voltage on the cell membrane of the second neuron in the Hopfield neural network, for The first derivative of is the voltage on the cell membrane of the third neuron in the Hopfield neural network, for The first derivative of is the cell membrane potential of the Hindmarsh-Ross neuron, for The first derivative of is the restoration variable of the Hindmarsh-Ross neuron, for The first derivative of is the magnetic flux of the memristor, for The first derivative of is the hyperbolic tangent function, is a sine function, are the relevant parameters of the chaotic system, , and These are the relevant parameters of the memristor.
2. The image encryption method based on a neural network chaotic system according to claim 1 is characterized in that: Preprocess the encrypted image matrix to generate a plaintext image in the form of a square matrix, including: Determine whether the image matrix to be encrypted is a square matrix; If the matrix of the image to be encrypted is a square matrix, the matrix of the image to be encrypted is determined as a plaintext image; If the matrix of the image to be encrypted is not a square matrix, the matrix of the image to be encrypted is expanded to the nearest perfect square size by padding with zeros to generate a plaintext image.
3. The image encryption method based on a neural network chaotic system according to claim 1 is characterized in that: The plaintext image is associated with the external key to generate three sets of initial values of the neural network chaotic system, including: Perform SHA-512 function operation on the plaintext image to obtain a 512-bit hash value; Convert the 512-bit hash value into 64 decimal numbers, and sum up every 4 decimal numbers into a group, to get 16 sum values; Associating the 16 summed values with the 6 external keys for the first time to generate 6 plaintext key associated values; wherein the 6 plaintext key associated values correspond to the 6 external keys one by one; The six plaintext key-associated values are divided into three groups in sequence and are associated with the corresponding external keys for the second time to generate three groups of initial values of the neural network chaotic system.
4. The image encryption method based on a neural network chaotic system according to claim 1 is characterized in that: The three sets of initial values are input into the neural network chaotic system to generate three sets of target chaotic sequences, including: Input three groups of initial values into the neural network chaotic system respectively to generate three groups of initial chaotic sequences; wherein, the length of the first group of initial chaotic sequences is equal to the side length of the plaintext matrix, and the lengths of the second group of initial chaotic sequences and the third group of initial chaotic sequences are both equal to the square of the side length of the plaintext matrix divided by 6 and rounded up; The six dimensions of each group of initial chaotic sequences are expanded into a one-dimensional vector, and the elements in the one-dimensional vector are multiplied by 10 to the fourth power and then modulo 1 operation is performed to generate three groups of target chaotic sequences.
5. The image encryption method based on a neural network chaotic system according to claim 1, characterized in that: Generate a scrambled matrix in which each element is unique in each row and each column according to the first set of target chaotic sequences, including: Performing linear transformation and modular operation on elements in the first group of target chaotic sequences to generate a first vector and a second vector; Sort the elements in the first vector and the second vector respectively to generate a first sorting index map and a second sorting index map; The first sorted index mapping is used as the reference row, and the corresponding element in the second sorted index mapping is used as the shift distance of the reference row. Row cyclic shift and assignment are performed to generate a scrambled matrix in which each element is unique in each row and column.
6. The image encryption method based on a neural network chaotic system according to claim 1 is characterized in that: Two diffusion matrices are generated according to the second group of target chaotic sequences and the third group of target chaotic sequences, including: Performing linear transformation and modular operation on the elements in the second group of target chaotic sequences and the third group of target chaotic sequences to generate a third vector and a fourth vector; The third vector and the fourth vector are respectively reconstructed into matrices having the same size as the plaintext image to generate two diffusion matrices.
7. The image encryption method based on a neural network chaotic system according to claim 1 is characterized in that: The plaintext image is row-scrambled according to the row index of the scrambling matrix to obtain a row scrambling matrix, including: Each column in the plaintext image is taken as the current processing column in turn, and all rows in the current processing column are traversed respectively. According to the row index of the scrambling matrix, the elements in each row are exchanged with the elements at the target position specified by the row index to obtain the row scrambling matrix.
8. The image encryption method based on a neural network chaotic system according to claim 1 is characterized in that: According to the column index of the scrambled matrix and the two diffusion matrices, the row scrambled matrix is column-scrambled and synchronously diffused to obtain the ciphertext image, including: Take each element in the row scramble matrix as the current processing element in turn, pre-diffuse the current processing element according to the corresponding element in the first diffusion matrix, then exchange the current processing element with the element at the target position specified by the column index according to the column index of the scramble matrix, and diffuse the current processing element according to the corresponding element in the second diffusion matrix; The current processing element is diffused according to the corresponding element in the second diffusion matrix, including: If the current processing element is the element in the first row and first column, then the corresponding element in the second diffusion matrix is added to the current processing element and then a modulo 256 operation is performed; If the current processing element is an element in the second column or later, then the corresponding element in the second diffusion matrix, the element in the previous column of the current processing element and the current processing element are added together and then a modulo-256 operation is performed; If the current processing element is an element in the first column but not the first row, the corresponding element in the second diffusion matrix, the element in the last column of the previous row of the current processing element and the current processing element are added and then a modulo-256 operation is performed.
9. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the image encryption method based on a neural network chaotic system as described in any one of claims 1 to 8.