Disclosure of Invention
Aiming at the defects of the prior method, the invention combines the geographic position with the encryption of the chaotic system, takes the geographic information as a unique identifier and acts with a hardware key at the same time to construct the chaotic hardware encryption method driven by double factors, so that encrypted data cannot be decrypted outside an effective safety area, the geographic position sensitivity of the data is enhanced, and the data is effectively protected from unauthorized access.
The technical scheme adopted by the invention is that the double-factor encryption method based on HNN-like hyperchaotic mapping and geographic grids comprises the following steps:
Step one, constructing a two-dimensional HNN hyperchaotic mapping, setting a fixed point of the two-dimensional HNN hyperchaotic mapping, and carrying out iteration for a plurality of times on the two-dimensional HNN hyperchaotic mapping by utilizing an initial value of the two-dimensional HNN hyperchaotic mapping to obtain a hyperchaotic sequence of a first iteration;
As a preferred embodiment of the present invention, the formula of the hyper-chaotic sequence of the first iteration is:
wherein, (p, q) is an initial value offset factor, x, y represents the direction, and x ', y' are the hyperchaotic sequences in the x, y direction respectively.
Secondly, space partitioning is carried out by using hexagonal grids, geographical information is divided into a plurality of area indexes, and a geographical grid system is constructed;
as a preferred embodiment of the present invention, the construction of the geographic grid system includes:
step 21, utilizing a world map and longitude and latitude coordinates obtained by using the mercator projection and satellite positioning;
Step 22, dividing the world map into hexagonal grids arranged in a honeycomb mode;
step 23, determining the grid size by taking a certain coordinate as an initial dividing point;
Step 24, indexing and numbering the grids by using the positive integer with the upper left corner of the world map as a starting point;
and step 25, converting the positioned longitude and latitude coordinates into grid indexes corresponding to the initial value offset factors.
Step three, encrypting the plaintext file by utilizing the initial value offset factor and the corresponding grid index;
as a preferred embodiment of the present invention, the third step specifically includes:
step 31, processing the plaintext file into a one-dimensional binary sequence S;
Step 32, calculating an initial value of two-dimensional HNN hyperchaotic mapping by taking an initial value offset factor (p, q) as an intrinsic encryption key and taking an encryption key (s 1,s2) built in a singlechip as an internal equipment credential;
as a preferred embodiment of the invention, the formula for calculating the initial value of the two-dimensional HNN hyper-chaotic map is as follows:
(x0=s1+2pπ,y0=s2+2qπ) (8)
Wherein, (s 1,s2) is an encryption key, (p, q) is an initial value offset factor, and (x 0,y0) is an initial value of the hyperchaotic mapping.
Step 33, performing a plurality of iterations on the two-dimensional HNN hyperchaotic mapping, and taking the obtained hyperchaotic state value (X, Y) as a pseudo-random number (X, Y);
step 34, the ordered positions of the pseudo random numbers X and Y are respectively replaced by a one-dimensional binary sequence S;
Step 35, obtaining a sequence C F and a sequence C B by using a diffusion method;
Wherein M () is an operation function, P is a permuted value, and C is a diffused value;
as a preferred embodiment of the present invention, the formula of the operating function is:
Wherein, Representing a rounding-up operation, k being the amplification factor and b being the bias factor.
Step 36, repeating steps 34, 35 several times to obtain a cryptographic data sequence.
As a preferred implementation mode of the invention, the double-factor encryption device based on HNN hyperchaotic mapping and geographic grids comprises a singlechip, a dynamic random access memory, a positioning module, a digital-to-analog conversion module and a USB bus conversion module, wherein,
The USB bus conversion module is used for data communication between the host and the singlechip;
the digital-to-analog conversion module converts the encrypted ciphertext digital signal into an analog signal;
The positioning module is used for acquiring longitude and latitude coordinates in the world map;
the dynamic random access memory is used for storing pseudo-random numbers and password data sequences;
the singlechip is used for receiving a plaintext in the host and encrypting the plaintext to obtain an encrypted ciphertext digital signal.
As a preferred embodiment of the invention, the HNN hyperchaotic mapping and geography grid-based two-factor encryption system comprises a memory and a processor, wherein the memory is used for storing instructions executable by the processor, and the processor is used for executing the instructions to realize the HNN hyperchaotic mapping-like and geography grid-based two-factor encryption method.
As a preferred embodiment of the present invention, a computer readable medium storing computer program code which, when executed by a processor, implements a two-factor encryption method based on a class HNN hyperchaotic mapping and a geographical grid.
The invention has the beneficial effects that:
1. The geographic position is combined with chaotic hardware encryption for the first time, geographic information is used as a unique identifier and acts with a hardware key at the same time, so that a chaotic hardware encryption method driven by double factors is constructed, encrypted data cannot be decrypted outside an effective safety area, the geographic position sensitivity of the data is enhanced, and the data is effectively protected from unauthorized access;
2. the problem that the geographic position of data encrypted by single-factor hardware is insensitive is solved;
3. the anti-theft problem of the encryption device is solved.
Detailed Description
The invention will be further described with reference to the accompanying drawings and examples, which are simplified schematic illustrations showing only the basic structure of the invention and thus showing only those constructions that are relevant to the invention.
As shown in fig. 1, the two-factor encryption method based on the HNN-like hyper-chaotic map and the geographic grid comprises the following steps:
step one, constructing two-dimensional HNN hyper-chaotic mapping;
The mathematical model formula of the two-dimensional HNN hyper-chaos mapping is as follows:
where n is a natural number, x n and y n are two discrete time variables of the nth iteration, x and y represent the electrical activity of the first and second neurons, respectively, and for neurons at the inner decaying edge, the parameter g 11、g12、g21、g22 is a connection weight and the nonlinear function sin () is an activation function.
Let the stationary point of the two-dimensional HNN hyperchaotic mapping be S ' = (X ', Y '), the stationary point can be found by calculating X ' =x ' +g 11sinX′+g12 sinY ' and Y ' =y ' +g 21sinX′+g22 sinY ':
S'=(X',Y')=(mπ,lπ) (2)
where m and l are two integers.
Thus, the map has an infinite number of grid immobilization points, which can present a grid distribution in the X '-Y' plane, as shown in fig. 2, resulting in the appearance of grid homogeneous coexisting attractors.
The initial value of the two-dimensional HNN hyperchaotic mapping is (x 0,y0), the values are all within (-pi, pi), if x 0 deviates from 2ppi, y 0 deviates from 2qpi, namely a new initial value (x '0,y′0)=(x0+2pπ,y0 +2qpi), the two-dimensional HNN hyperchaotic mapping generates a new set of sequences, which are represented by variables (x', y '), and for (x' 0,y′0), the new sequence after the 1 st iteration is:
The new sequence after the second iteration is:
The new sequence after the third iteration is:
similarly, the new sequence after (n+1) iterations can be expressed as:
Thus, when x 0 and y 0 are offset by 2ppi and 2qpi, respectively, the sequence of the solution of formula (1) into new variables x 'and y' is offset by 2ppi in the x-direction and by 2qpi in the y-direction, i.e. the linear transformation between the original sequence and the new sequence is expressed as:
It is shown that when x 0 moves by 2ppi, the new sequence x 'moves by 2ppi in the x direction, and when y 0 moves by 2qpi, the new sequence y' moves by 2qpi in the y direction, so that the dynamic behavior of grid homocoexistence occurs.
The two integers p and q in the formula (7) are core parameters for determining the initial value of the grid, so the (p, q) is defined as an initial value offset factor, and the initial value offset factor is an important factor for using two-dimensional HNN-like hyperchaotic mapping in subsequent two-factor chaotic hardware encryption based on the geographic grid.
The two-dimensional HNN-like hyperchaotic mapping generates 8 hyperchaotic sequences, and as shown in figure 3, the numerical result shows that the dynamic amplitude of the hyperchaotic sequences can be controlled by switching the initial value offset factors in two directions, and the number of the hyperchaotic sequences is determined by integers p and q in the figure, namely 8 hyperchaotic sequences.
The two-dimensional HNN mapping can generate a hyperchaotic sequence with excellent performance, is very suitable for chaotic encryption application, and has the grid homoplasmy coexisting characteristic very well matched with the geographic grid index;
Step two, constructing a geographic grid system according to grid homogeneity characteristics of two-dimensional HNN hyperchaotic mapping;
In order to realize double-factor chaotic encryption based on geographic grids, a Beidou satellite system is utilized for positioning, a H3 geographic space index developed by Uber is utilized for space partitioning, geographic information is divided into a plurality of regional indexes, different indexes correspond to different geographic keys, regional safety is guaranteed, because the geographic space index system is irrelevant to current positioning information, positioning state information is not required to be stored in encryption, the system belongs to stateless encryption, stability and safety of the system are effectively guaranteed, and a geographic grid system is designed before encryption, wherein a schematic diagram of the geographic grid system is shown in figure 4 and comprises an cuttotor projection diagram, a hexagonal tiling diagram, a geographic index and conversion from geographic to index.
Step 21, the mercator projection is one of the most commonly used cylindrical projections, and the accuracy of the map in terms of angle and shape is maintained by projecting the earth surface onto a cylinder and then expanding the earth surface into a rectangle;
Step 22, the world map may then be divided into hexagonal grids arranged in a honeycomb, as shown in fig. 4 (b), the hexagons are most circular polygons, due to their lower area to perimeter ratio, the deviations from the grid shape boundary effect may be reduced, so that uniform grids may be split, and furthermore, the hexagonal grids are easier to locate due to their centers being the same distance from all adjacent centers, as compared to square grids, triangular grids, and are the best choice for filling planes.
Step 23, after map projection and grid segmentation are determined, a certain coordinate is used as an initial segmentation point, and the size of the grid, namely the set radius, is determined, so that the construction of a geographic grid system can be completed;
step 24, indexing and numbering grids by using a positive integer with the upper left corner of the world map as a starting point, wherein each grid corresponds to a unique plane index, and the schematic diagram is shown in fig. 4 (c);
In step 25, the coordinates (x, y) obtained by satellite positioning fall into a certain grid, the positioning is converted into grid indexes (p, q) corresponding to initial value offset factors, as shown in fig. 4 (d), and the different coordinates falling into the same hexagonal grid are finally converted into the same index, which means that the hexagon is the effective range of the index, and the coordinates are all in the same safety zone.
Correlating the geographic position with the initial value offset factor to obtain the chaotic encryption sensitive to the geographic position, and realizing the chaotic encryption method based on the geographic grid;
The double-factor encryption device based on HNN hyperchaotic mapping and geographic grids adopts a singlechip (STM 32H743IIT 6), a dynamic random access memory SDRAM (W9825G 6 KH), a positioning module (ATK-1218 chip), a digital-to-analog conversion module (DAC 856) and a USB bus conversion module (CH 340G), wherein the singlechip is electrically connected with the host through the USB bus conversion module, the dynamic random access memory is electrically connected with the singlechip, the digital-to-analog conversion module is electrically connected with the singlechip and an oscilloscope respectively, the USB bus conversion module is used for data communication between the host and the singlechip, the digital-to-analog conversion module converts encrypted ciphertext digital signals into analog signals, the positioning module is used for acquiring longitude and latitude coordinates in a world map, the singlechip is used for receiving plaintext in the host and encrypting the plaintext to obtain encrypted ciphertext digital signals, the dynamic random access memory is used for storing and encrypting pseudo-random number data sequences, and the double-factor chaotic hardware encryption device based on geographic grids can encrypt data in any format.
Step three, the host reads the whole plaintext file in a binary mode, writes the plaintext into a byte slice S dat, then transmits the byte slice to the singlechip, particularly optimizes the reading method of the image format file for convenience of safety analysis, and can identify the common image type such as JPEG, PNG, BMP format by judging file header information, decodes the image to obtain 8-bit pixels with the size of MxN, M and N are respectively the width and the height of the image for single-channel gray level images, then adopts a flattening method to obtain a one-dimensional binary sequence S img with the length of L=MxN of the image, and is notable that although S dat and S img are both one-dimensional binary sequences, the former represents complete data information, the latter only contains image pixel information, and the one-dimensional binary sequence S is defined as any data (S dat) received by the singlechip for non-loss of generality, and the specific implementation steps on hardware are as follows:
1. S is sent from a host to the singlechip through the USB bus conversion module, so that the loss of data exchange between the singlechip and the random access memory is reduced in consideration of limited resources and communication requirements of a hardware memory, and binary data acquired by the STM32 can be transferred to the SDRAM for temporary storage.
2. The method comprises the steps that a positioning module of a Beidou satellite navigation system is used for receiving longitude and latitude information of a Beidou satellite, and a geographic grid system is combined to map a current geographic position to a hexagonal center coordinate, wherein the coordinates (p, q) are used as initial value offset factors;
3. In order to protect the security of the key and encryption, an initial value offset factor (p, q) is used as an intrinsic encryption key, an encryption key (s 1,s2) built in a singlechip is used as an internal device credential, and an initial value (x 0,y0) of two-dimensional HNN hyperchaotic mapping is calculated by a formula (8), wherein the formula is as follows:
(x0=s1+2pπ,y0=s2+2qπ) (8)
The initial value (x 0,y0) is not only controlled by the device certificate, but also affected by the geographical position, when the geographical position changes within the area range, the geographical coordinates can be mapped to the same hexagonal central coordinates within the effective area range, when the geographical position exceeds the area range, the geographical coordinates can be mapped to different hexagonal central coordinates, and the initial value is changed by changing the values of initial value offset factors p and q.
4. After generating an initial value, the singlechip carries out L+L H iterations on the two-dimensional HNN hyperchaotic mapping, wherein L H =100 is the preheating frequency, the first L H iteration is abandoned, and the reserved hyperchaotic state value (X, Y) is used as a pseudo-random number (X, Y) and the pseudo-random number is stored in SDRAM;
5. The sorting position of the S and the sorting position of the X are replaced to obtain P X, then the sorting position of the Y and the sorting position of the P X are replaced by the same method to obtain P, and finally the P is stored in SDRAM;
6. The rule that the last element M (i) affects the next element M (i+1) is propagated into the whole sequence to obtain the sequence C F, and propagated again to obtain the sequence C B, the diffusion method can be described as formula (9):
Where P is the value after substitution and C is the value after diffusion.
M (x) is an operating function, described as:
Wherein, The value (X i,Yi,Pi) representing the rounding-up operation, k=10 13 being the amplification factor and b=2pi being the bias factor, can be fetched from SDRAM as required.
7. Step 5, 6 is repeatedly executed for 3 times to obtain a password data sequence C, then the password data sequence C is transmitted to a host through a USB bus conversion module, and in the process, data interaction is carried out between the singlechip and the SDRAM, so that the safety of a memory is ensured;
The repeated execution for 3 times is to increase the safety and the diffusion effect, and resist the password analysis, ensure the key use efficiency, and realize the reversibility of the algorithm, wherein the repeated execution times are the self-defined parameters.
And after the data reception is completed, recovering the original dimension data from the sequence C by using a rearrangement method on the host, and finally obtaining the ciphertext data in the mode.
The structure diagram of the two-factor chaotic hardware encryption device based on the geographic grid is shown in fig. 5, in the encryption algorithm, fig. 6 shows a process of acquiring a system initial value based on the geographic positioning, the encryption operation is described in detail in the above encryption steps, and the decryption operations of substitution and diffusion are the inverse steps of the encryption operation.
It is noted that in equation (10), a double-precision floating point number is used, which occupies 8 bytes, in order to maintain the operation accuracy, all constants and variables used in equation (10) are 64-bit double-precision floating point numbers, so that the problem of data overflow or precision loss during the mixed operation of 32 bits and 64 bits is avoided, in terms of data storage, a data type partition of SDRAM is defined, which is divided into a 64-bit double-precision floating point partition for storing hyper-chaotic sequences, a 32-bit unsigned integer partition for storing permutation information and an 8-bit unsigned integer partition for storing binary numbers, in serial transmission, the maximum 500-byte cache is configured by using the internal RAM of STM32, and data sent by a host enters the cache first, then is sequentially allocated to a predefined 8-bit unsigned integer partition address, and then the cache is cleared and SDRAM address offset of a next transmission period is recorded.
In the experiment, an image with 512 multiplied by 512 pixels is selected as an example for testing, after the STM32 is electrified, the encryption mode is entered by pressing the KEY 0 KEY, plaintext data is transmitted to the singlechip through the host computer, and the positioning module obtains the geographic position through the antenna. The geographic coordinates are transformed into grid factors (p, q) by combining the geographic grid system in fig. 4, then an encryption process is completed through iterative operation of two-dimensional HNN mapping and a series of replacement diffusion operation, then a result is transmitted to a host computer through CH340G, so that chaotic encryption combining geographic factors is completed, and similarly, KEY 1 is pressed to enter a decryption mode, and the decryption process is the same as the encryption process, so that decryption can be carried out according to the geographic coordinates during decryption.
In FIG. 7, the geographical coordinates during encryption are displayed at the bottom, the upper left corner is the original image, the upper right corner is the binary sequence corresponding to the original image, the lower left corner is binary data transmitted back from hardware equipment, the lower right corner is the corresponding encrypted image, a DAC8563 chip is used as a D/A converter to obtain real-time sequences in the encryption and decryption process in experiments, plaintext data of yellow sequences and ciphertext data of blue sequences are respectively displayed through an oscilloscope, the hardware encryption and decryption process of a host is displayed in FIG. 7, decryption results of different geographical positions are displayed, encrypted images in the encrypted geographical positions can be correctly decrypted, but encrypted images beyond the positions cannot be decrypted, and the experiment results prove the feasibility of chaotic hardware encryption based on a geographical grid system, and FIG. 8 is a hardware physical diagram.
With the above-described preferred embodiments according to the present invention as an illustration, the above-described descriptions can be used by persons skilled in the relevant art to make various changes and modifications without departing from the scope of the technical idea of the present invention. The technical scope of the present invention is not limited to the description, but must be determined according to the scope of claims.