Summary of the invention
To be that key existing in existing logistic mapping encrypting method is simple and key is immutable wait deficiency to technical problem to be solved by this invention, provides a kind of embedded encryption method based on high order second order logistic mapping and device.
For solving the problem, the present invention is achieved by the following technical solutions:
Based on the embedded encryption method that high order second order logistic maps, comprise the steps:
Step 1, a selected logistic maps the producing method as sub-key system, and each mapping number of times that iteration is certain respectively during this logistic is mapped;
Step 2, then expressly will be divided into some pieces with binary system;
Step 3, on the iteration basis of step 1 gained, then obtains A and D two parts to the iteration that certain number of times is carried out in each mapping during logistic maps;
Step 4, after carrying out shift transformation respectively, obtains corresponding intermediate ciphertext to each Plaintext block of step 2 gained;
Step 5, carries out XOR by the intermediate ciphertext of step 3 gained A and step 4 gained;
Step 6, judges whether that all Plaintext block have been encrypted complete all; If complete, then terminate; Otherwise, return step 3 and continue encryption.
In above-mentioned steps 1, selected logistic is mapped as
In formula,
represent the value that i-th iteration of maps n time is follow-up, u is set point value, and u ∈ (1.64,2),
be the numerical value of type double precision with u, a=1,2,3......, b=1,2,3......, and the complexity that uses according to user of the value of a, b and processor computing capability are chosen.
Because step 1 is the starting point of key, ensure the complexity of initial key, and step 3 is in order to different from home key and obtain the iteration that A, D two parts just do, so main iteration is in step 1, so the number of times carrying out iteration first to each mapping during logistic maps in step 1 is greater than the number of times in step 3, each mapping during logistic maps being carried out again to iteration.
In above-mentioned steps 4, the detailed process of each Plaintext block being carried out to shift transformation is:
Step 4.1, is divided into m expressly sub-block by Plaintext block; Wherein m be greater than 1 positive integer;
Step 4.2, respectively by after each plaintext sub-block all simultaneously ring shift left or the S position that moves to right, obtains the displacement expressly sub-block of each plaintext sub-block;
Step 4.3, merges each displacement plaintext sub-block by the order of the plaintext sub-block corresponding to it and obtains the Plaintext block that is shifted;
Step 4.4, after displacement Plaintext block ring shift left or m × S position that moves to right, obtains intermediate ciphertext.
In above-mentioned steps 4.2 and step 4.4, the direction of displacement of each plaintext sub-block is consistent, and expressly sub-block is also consistent with the direction of displacement of Plaintext block.Namely, when each plaintext sub-block equal ring shift left S position, Plaintext block circulation is corresponding ring shift left m × S position also; When each plaintext sub-block equal ring shift right S position, Plaintext block circulation is corresponding ring shift right m × S position also.
Based on the embedded encryption device that the high order second order logistic of above-mentioned embedded encryption method maps, comprise power supply module, data AD sampling module, key driver module, microcontroller encrypting module and embed interface driver module; Wherein power supply module, for this device modules provides power supply; Data AD sampling module, the be-encrypted data of sampling input, for key driver module provides the initial value changed with plaintext; Key driver module, the sampled data receiving data AD sampling module also produces the key that becomes with sampled data and passes to microcontroller encrypting module; Microcontroller encrypting module, carries out chaos encryption be-encrypted data and key and spreads out of to product by enciphered data; Embed interface driver module, the interface with product is provided.
Compared with prior art, to instant invention overcomes in traditional logistic mapping encrypting method the shortcomings such as the simple and key of key is immutable, core is mapped with logistic, stm32F407 is adopted to carry out high order second order encryption embedded mode, realize the process of encryption successive ignition high order and produce complicated changeable key, this device can be embedded in various electronic product, improves the safety of electronic product.
Embodiment
Based on the embedded encryption method that high order second order logistic maps, as shown in Figure 1, comprise the steps:
Step 1, select a logistic mapping as the producing method of sub-key series:
In formula:
represent the value that i-th iteration of maps n time is follow-up.U is set point, and u ∈ (1.64,2).
the numerical value of type double precision is, a=1,2,3......, b=1,2,3...... (complexity that the value of a, b uses according to user and processor computing capability are chosen) with u.In order to eliminate the impact of instantaneous value, in a preferred embodiment of the invention, iteration 200 times are distinguished in the mapping in formula (1), obtains x
200for producing the starting point of key.
Step 2, expressly will be divided into the grouping that a series of length is 256 bits, if last grouping curtailment, and zero padding.
Step 3, distinguishes iteration 40 times again by each mapping in formula (1).If the jth time iterative value mapped for i-th time is
(binary form is:
wherein
represent
the n-th binary system).From
middle extraction the 2nd, the numerical value in 3 binary digits, obtains the series of 18 bit
as follows respectively with the serial D extracting series A and 32 bits obtaining 256 bits through 20 iteration:
A=H
1,2H
1,3H
2,2H
2,3H
3,2H
3,3……H
16,2H
16,3
D=H
17,2H
17,3H
18,2H
18,3H
19,2H
19,3H
20,2H
20,3
In formula,
Step 4, carries out shift transformation to Plaintext block.
First, by Plaintext block p
k(k=1,2 ...) be divided into four pieces: the P of 64 bits
k1, P
k2, P
k3and P
k4ring shift left S respectively
1, S
2, S
3and S
4position, wherein S
1=(H
17,2h
17,3) mod64, S
2=(H
18,2h
18,3) mod64, S
3=(H
19,2h
19,3) mod64 and S
4=(H
20,2h
20,3) mod64.
Then, by P
k1, P
k2, P
k3and P
k4merge and obtain P
k, then by P
k, ring shift left S position, obtains intermediate ciphertext C,
k.Wherein, S=(H
17,2h
17,3+ H
18,2h
18,3+ H
19,2h
19,3+ H
20,2h
20,3) mod64.
Step 5, by A and C,
kcarry out xor operation, obtain encrypted cipher text:
Step 6, if C
ki () is ciphertext C
kin the value of i-th byte, calculate E
1~ E
4as follows:
Step 7, if Plaintext block is all encrypted complete, then terminates; Otherwise to iteration E respectively various in formula (1)
1~ E
4, then forward step 3 iteration to 40 times.
First this encryption method by initial key high order iteration 200 times, reaches the complexity of key; Then expressly some pieces will be divided into binary system, for encryption is prepared below; Again by the key of iteration before more further iteration obtain A and D two parts, then take a wherein part to carry out XOR with the plaintext through shift operation.As Fig. 1, E
1~ E
4encrypt the module substantially completed, and then judge whether that all plaintexts have been encrypted further, continue encryption if do not returned again.Be all different reach time variation at the key of iteration each time, reach enciphered message security purpose.
Realize the embedded encryption device mapped based on high order second order logistic of said method, as shown in Figure 2, it is by power supply module and the data AD sampling module be connected with power supply module, key driver module, microcontroller encrypting module with embed interface driver module composition.One input of microcontroller encrypting module and the input of data AD sampling module input be-encrypted data simultaneously.The output of data AD sampling module connects another input of microcontroller encrypting module through key driver module.The output of microcontroller encrypting module is connected with the input embedding interface driver module, and the output embedding interface driver module exports enciphered data.Power supply module is mainly this device modules and provides power supply.Data AD sampling module for the be-encrypted data of input of sampling, for key driver module provides with the expressly initial value changed.The sampled data that key driver module receives data AD sampling module also produces the key that becomes with sampled data and passes to microcontroller encrypting module.Microcontroller encrypting module carries out be-encrypted data and key chaos encryption and spreads out of enciphered data to product.Embed interface driver module and the interface with product is provided.
As shown in Figure 3, be that logistic of the present invention maps bifurcation graphs, when getting parameter a=2, during b=3, this figure is the bifurcation graphs of parameter u from 0 to 2.0 changes, as seen from the figure, is chaotic motion within the scope of 1.64-2.0, may be used for encryption.Change the value of a, b when the value determining u, all can produce different value, thus make encryption better.
As shown in Figure 4, being second order High Degree Logistic-Like Map figure of the present invention, is the iteration evolution diagram that u gets 1.649 in figure.As can be seen from the figure interative computation data are out chaos, when the value that we can change u in the full mapping range of Fig. 3, had more selectivity, better improve fail safe to encryption.