Summary of the invention
For overcoming the problems of the prior art, the invention provides a kind of color image encrypting method based on DNA dynamic coding, break away from the complex biological operation in DNA encryption, effectively chaotic characteristic and DNA dynamic coding are combined, consider the impact of expressly factor simultaneously, improve the security of algorithm, be convenient to parallel computation, improve efficiency, and be easy to realize and control.
Technical scheme of the present invention is:
Based on a color image encrypting method for DNA dynamic coding, comprise the following steps:
Step 1. inputs the 8-bit color image P that size is M × N
1, separating color image P
1rGB three primary colours component, obtain Component Matrices P
1_ R
mN, P
1_ G
mN, P
1_ B
mN, the size of each Component Matrices is M × N, by Component Matrices P
1_ R
mN, P
1_ G
mN, P
1_ B
mNsort left to right and obtain the plaintext gray level image P that size is M × 3N
2;
Step 2. utilizes SHA256 function to plaintext coloured image P
1calculate, obtain one group of 256 cryptographic hash, as image key Key, this 256 bit image key K ey is scaled 32 decimal numbers, be equally divided into four groups, be used for calculating original state value and the parameter of CML chaos system used in scrambling process and diffusion process respectively;
Being used for of obtaining in step 2 is calculated CML chaos system original state value in scrambling process and parameter and brings in CML chaos system and carry out iteration by step 3., add up to obtain the state value matrix W 1 that size is M × 3N, state value matrix W 1 is sorted left to right, obtains the Scrambling Matrix K that size is M × 3N;
Being used for of obtaining in step 2 is calculated CML chaos system original state value in diffusion process and parameter and brings in CML chaos system and carry out iteration by step 4., add up to obtain the state value matrix W 2 that size is M × 3N, by in state value matrix W 2 often row be one group with 8 state values, respectively index value is set up to each state value;
State value matrix W 2 in step 4 is converted into INTEGER MATRICES Y by step 5., and matrix Y is converted to corresponding DNA matrix by the index value in step 4;
Step 6. utilizes i-th row of Scrambling Matrix K to plaintext gray level image P
2i-th to advance line shuffle, 1≤i≤M;
Step 7. will plaintext gray level image P
2in completed scramble the i-th row pixel be converted to corresponding DNA sequence dna according to the index value obtained in step 4, and dispersion operation is carried out to DNA sequence dna;
Step 8. makes i=i+1, circulation step 6 and step 7, until plaintext gray level image P
2in every one-row pixels all complete DNA encryption;
The binary matrix Q1 that step 9. sized by the DNA matrix decoding after encrypted will be M × 24N, carries out decimal system conversion operations to matrix Q1, obtains the decimal system ciphertext matrix Q2 that size is M × 3N, ciphertext matrix Q2 is equally divided into the matrix P that 3 sizes are M × N
3_ R
mN, P
3_ G
mN, P
3_ B
mN, by three matrix merger and reorganization, obtaining size is that the colored ciphertext graph of M × N is as P
3, namely obtain encrypted image.
Above-mentioned, described step 2 specifically comprises following content:
The local that step 2.1. adopts LTS to map as CML chaos system submodel maps, and LTS mapping definition is:
Generate chaos sequence by CML chaos system, expression is as follows:
Wherein,
In formula, n=1,2 ..., n is time index or state index, and i, j, k are the location index of reflection grid,
for i-th grid in CML model is at the state value of space-time n, and
1≤j≤L, 1≤k≤L, i=1,2 ..., L, L are the coupled map lattice systems number in CML chaos system, the parameter value that p, q, ε ∈ [0,1], η ∈ [0,1] they are CML model.
Step 2.2. utilizes SHA256 function to plaintext coloured image P
1calculate, obtain the cryptographic hash of a group 256, it can be used as image key, then the cryptographic hash of 256 is scaled 32 decimal numbers, and is defined as k
1, k
2..., k
32, by k
1, k
2..., k
32be equally divided into four groups, use k respectively
1, k
2..., k
8, k
9, k
10..., k
16, k
17, k
18..., k
24, k
25, k
26..., k
32represent;
Step 2.3. utilizes k
1, k
2..., k
8and k
9, k
10..., k
168 original state values of the CML chaos system be used in scrambling process are calculated by computing formula
with 8 parameter value r
i, computing formula is
Wherein,
for the state value of coupled map lattice systems, and
r
ifor the controling parameters that LTS maps, and 0 < r
i< 4;
Step 2.4. utilizes k
17, k
18..., k
24and k
25, k
26..., k
328 original state values of the CML chaos system in diffusion process are used for by formulae discovery
with 8 parameter value r
i, formula is
Preferably, described step 3 specifically comprises following content:
8 state values being used for the CML chaos system in scrambling process that step 3.1. will obtain in step 2.3
with 8 parameter value r
ibring iteration in step 2.1 into
secondary, wherein,
Give up front N
0individual numerical value, the accumulative size that obtains is that the state value matrix W 1, floor (x) of M × 3N represents the maximum integer being no more than x, and L is the coupled map lattice systems number in CML chaos system;
Step 3.2. by state value matrix W 1 according to formula [ignore, K]=sort (W1,2) sort left to right, obtain the Scrambling Matrix K that size is M × 3N, wherein, the element of a line every in matrix W 1 arranges according to order from small to large by sort (W1,2) expression, ignore represents the matrix after arrangement, the location index matrix that the element after sequence that what K represented be through is corresponding in former array.
Preferably, described step 4 specifically comprises following steps:
8 state values being used for the CML chaos system in diffusion process that step 4.1. will obtain in step 2.4
with 8 parameter value r
ibring iteration in step 2.1 into
wherein,
Give up front N
0individual numerical value, the accumulative size that obtains is that the state value matrix W 2, floor (x) of M × 3N represents the maximum integer being no more than x, and L represents the reflection grid number in CML chaos system;
It is one group that step 4.2. often goes with 8 state values to state value matrix W 2, passes through formula
Index is set up respectively to often organizing state value, a unique index value is had corresponding thereto to each element in state value matrix W 2, by Ind (i, j) index value that in representing matrix W2, the i-th row jth row are corresponding, and 1≤i≤M, 1≤j≤3N, wherein, sort (x, ' descend') and represent the element in x is arranged according to descending, x is the array be made up of 8 state values, ignore represents the matrix after arrangement, the location index matrix that element after sequence that what Ind1 represented be through is corresponding in former array, element in Ind1 sorts according to order from small to large by sort (Ind1) expression, Ind represents after Ind1 sequence, the location index matrix of its element in former Ind1.
Preferably, described step 5 comprises following content:
Step 5.1. by state value matrix W 2 according to formula
Y (i, j)=mod ((W2 (i, j)-floor (W2 (i, j))) * 10^8,256) is converted into INTEGER MATRICES Y, wherein,
Mod (a, b) represents the modulo operation of a to b; Floor (x) represents the maximum integer being no more than x; Y (i, j) represents the element value of the i-th row jth row of the INTEGER MATRICES Y obtained, wherein 1≤i≤M, 1≤j≤3N;
Step 5.2. definition DNA operation rule, directly uses DNA encoding value to carry out mathematics or logical operation in encryption method;
Each element in INTEGER MATRICES Y is converted to corresponding DNA matrix according to index value corresponding in step 4 by step 5.3., for arbitrary Y (i, j) plant encoding scheme according to Ind (i, j) and be converted to corresponding DNA sequence dna, r element of DNA sequence dna is designated as DNA
r(Y (i, j)), wherein, r=1,2,3,4,1≤i≤M, 1≤j≤3N.
Preferably, described step 7 specifically comprises following content:
Step 7.1. is to plaintext gray level image P
2in completed the i-th row element of scramble
P
2(i, 1), P
2(i, 2), P
2(i, 3) ..., P
2(i, 3N) is respectively according to the index value of the i-th row obtained in step 4
Ind (i, 1), Ind (i, 2), Ind (i, 3) ..., Ind (i, 3N) carries out DNA encoding, to arbitrary P
2(i, j) plants encoding scheme according to Ind (i, j) and is converted to corresponding DNA sequence dna, and r element of DNA sequence dna is designated as DNA
r(P
2(i, j)), wherein, r=1,2,3,4,1≤i≤M, 1≤j≤3N;
The DNA sequence dna of pixel in the i-th row obtained is passed through formula by step 7.2.
Carry out dispersion operation, wherein, R
rp
2(i, j) represent encrypted after DNA encoding value, R
(r-1)p
2(i, j) represents the DNA encoding value of previous encryption, if r=1, then represents the secret value of last DNA encoding in previous pixel, and R
0p
2(i, 1)=0.
The invention has the beneficial effects as follows:
(1) the present invention has broken away from the complex biological operation of DNA encryption in prior art, encryption key used is produced by adopting SHA256 function, greatly improve key space, and the generation of key depends on expressly, effectively can resist known-plaintext and select attack expressly, improve the security of algorithm; Adopt dynamic DNA encoding method, different pixels point adopts different DNA encoding rules, using the state value of CML chaos system as the foundation selecting DNA encoding, effectively chaotic characteristic is combined with DNA dynamic coding, further increase the security of encryption method, line shuffle of advancing according to image in ciphering process is encrypted with diffusion, is convenient to parallel computation, effectively raises the efficiency; Can realize being encrypted color digital image based on compared with DNA encipherment scheme with existing, relative to the biological operation of complexity, the present invention is easy to realize and control.
(2) key of the present invention comprises: controling parameters ε, η, p, q of CML chaos system and selected reflection grid number L; 256 cryptographic hash produced by SHA256 function; The number N of the CML chaos sequence given up
0; If arranging precision is 10
-14, then key space is at least 2
256, key space is enough large, effectively can resist exhaustive attack; High to encryption key susceptibility, cryptographic security is better, and anti-Statistical Analysis Attacks ability is strong, and after encryption, image neighbor related coefficient is close to 0, and opposing differential attack ability is strong, and the information entropy of ciphertext graph picture is close to ideal value 8, and cryptographic algorithm security is good.
Embodiment
Below in conjunction with accompanying drawing and technical scheme, the present invention is further detailed explanation, and describe embodiments of the present invention in detail by preferred embodiment, but embodiments of the present invention are not limited to this.
Embodiment one, a kind of color image encrypting method based on DNA dynamic coding, comprises the following steps:
Step 1. inputs the 8-bit color image P that size is M × N
1, separating color image P
1rGB three primary colours component, obtain Component Matrices P
1_ R
mN, P
1_ G
mN, P
1_ B
mN, the size of each Component Matrices is M × N, by Component Matrices P
1_ R
mN, P
1_ G
mN, P
1_ B
mNsort left to right and obtain the plaintext gray level image P that size is M × 3N
2;
Step 2. utilizes SHA256 function to plaintext coloured image P
1calculate, obtain one group of 256 cryptographic hash, as image key Key, this 256 bit image key K ey is scaled 32 decimal systems, be equally divided into four groups, be used for calculating original state value and the parameter of CML chaos system used in scrambling process and diffusion process respectively;
Being used for of obtaining in step 2 is calculated CML chaos system original state value in scrambling process and parameter and brings in CML chaos system and carry out iteration by step 3., add up to obtain the state value matrix W 1 that size is M × 3N, state value matrix W 1 is sorted left to right, obtains the Scrambling Matrix K that size is M × 3N;
Being used for of obtaining in step 2 is calculated CML chaos system original state value in diffusion process and parameter and brings in CML chaos system and carry out iteration by step 4., add up to obtain the state value matrix W 2 that size is M × 3N, by in state value matrix W 2 often row be one group with 8 state values, respectively index value is set up to each state value;
State value matrix W 2 in step 4 is converted into INTEGER MATRICES Y by step 5., and matrix Y is converted to corresponding DNA matrix by the index value in step 4;
Step 6. utilizes i-th row of Scrambling Matrix K to plaintext gray level image P
2i-th to advance line shuffle, 1≤i≤M;
Step 7. will plaintext gray level image P
2in completed scramble the i-th row pixel be converted to corresponding DNA sequence dna according to the index value obtained in step 4, and dispersion operation is carried out to DNA sequence dna;
Step 8. makes i=i+1, repeats step 6 and step 7, until plaintext gray level image P
2in every one-row pixels all complete DNA encryption;
The binary matrix Q1 that step 9. sized by the DNA matrix decoding after encrypted will be M × 24N, carries out decimal system conversion operations to matrix Q1, obtains the decimal system ciphertext matrix Q2 that size is M × 3N, ciphertext matrix Q2 is equally divided into the matrix P that 3 sizes are M × N
3_ R
mN, P
3_ G
mN, P
3_ B
mN, by three matrix merger and reorganization, obtaining size is that the colored ciphertext graph of M × N is as P
3, namely obtain encrypted image.
Embodiment two: shown in Figure 1, substantially identical with embodiment one, difference is: described step 2 specifically comprises following content:
The local that step 2.1. adopts LTS to map as CML chaos system submodel maps, and LTS mapping definition is:
Generate chaos sequence by CML chaos system, expression is as follows:
Wherein,
In formula, n=1,2 ..., n is time index or state index, and i, j, k are the location index of reflection grid,
for i-th grid in CML model is at the state value of space-time n, and
1≤j≤L, 1≤k≤L, i=1,2 ..., L, L are the coupled map lattice systems number in CML chaos system, the parameter value that p, q, ε ∈ [0,1], η ∈ [0,1] they are CML model;
Step 2.2. utilizes SHA256 function to plaintext coloured image P
1calculate, obtain the cryptographic hash of a group 256, as image key, then the cryptographic hash of 256 is scaled 32 decimal numbers, and is defined as k
1, k
2..., k
32, by k
1, k
2..., k
32be equally divided into four groups, use k respectively
1, k
2..., k
8, k
9, k
10..., k
16, k
17, k
18..., k
24, k
25, k
26..., k
32represent;
Step 2.3. utilizes k
1, k
2..., k
8and k
9, k
10..., k
168 original state values of the CML chaos system be used in scrambling process are calculated by computing formula
with 8 parameter value r
i, computing formula is
Wherein,
for the state value of coupled map lattice systems, and
r
ifor the controling parameters that LTS maps, and 0 < r
i< 4;
Step 2.4. utilizes k
17, k
18..., k
24and k
25, k
26..., k
328 original state values of the CML chaos system in diffusion process are used for by formulae discovery
with 8 parameter value r
i, formula is
Preferably, described step 3 specifically comprises following content:
8 state values being used for the CML chaos system in scrambling process that step 3.1. will obtain in step 2.3
with 8 parameter value r
ibring iteration in step 2.1 into
secondary, wherein,
Give up front N
0individual numerical value, the accumulative size that obtains is that the state value matrix W 1, floor (x) of M × 3N represents the maximum integer being no more than x, and L is the coupled map lattice systems number in CML chaos system;
Step 3.2. by state value matrix W 1 according to formula [ignore, K]=sort (W1,2) sort left to right, obtain the Scrambling Matrix K that size is M × 3N, wherein, the element of a line every in matrix W 1 arranges according to order from small to large by sort (W1,2) expression, ignore represents the matrix after arrangement, the location index matrix that the element after sequence that what K represented be through is corresponding in former array.
Preferably, described step 4 specifically comprises following steps:
8 state values being used for the CML chaos system in diffusion process that step 4.1. will obtain in step 2.4
with 8 parameter value r
ibring iteration in step 2.1 into
wherein,
Give up front N
0individual numerical value, the accumulative size that obtains is that the state value matrix W 2, floor (x) of M × 3N represents the maximum integer being no more than x, and L represents the reflection grid number in CML chaos system;
It is one group that step 4.2. often goes with 8 state values to state value matrix W 2, passes through formula
Index is set up respectively to often organizing state value, a unique index value is had corresponding thereto to each element in state value matrix W 2, by Ind (i, j) index value that in representing matrix W2, the i-th row jth row are corresponding, and 1≤i≤M, 1≤j≤3N, wherein, sort (x, ' descend') and represent the element in x is arranged according to descending, x is the array be made up of 8 state values, ignore represents the matrix after arrangement, the location index matrix that element after sequence that what Ind1 represented be through is corresponding in former array, element in Ind1 sorts according to order from small to large by sort (Ind1) expression, Ind represents after Ind1 sequence, the location index matrix of its element in former Ind1.
Preferably, described step 5 comprises following content:
Step 5.1. by state value matrix W 2 according to formula
Y (i, j)=mod ((W2 (i, j)-floor (W2 (i, j))) * 10^8,256) is converted into INTEGER MATRICES Y, wherein,
Mod (a, b) represents the modulo operation of a to b; Floor (x) represents the maximum integer being no more than x; Y (i, j) represents the element value of the i-th row jth row of the INTEGER MATRICES Y obtained, wherein 1≤i≤M, 1≤j≤3N;
Step 5.2. definition DNA operation rule, directly uses DNA encoding value to carry out mathematics or logical operation in encryption method;
Each element in INTEGER MATRICES Y is converted to corresponding DNA matrix according to index value corresponding in step 4 by step 5.3., for arbitrary Y (i, j) plant encoding scheme according to Ind (i, j) and be converted to corresponding DNA sequence dna, r element of DNA sequence dna is designated as DNA
r(Y (i, j)), wherein, r=1,2,3,4,1≤i≤M, 1≤j≤3N.
Preferably, described step 7 specifically comprises following content:
Step 7.1. is to plaintext gray level image P
2in completed the i-th row element of scramble
P
2(i, 1), P
2(i, 2), P
2(i, 3) ..., P
2(i, 3N) is respectively according to the index value of the i-th row obtained in step 4
Ind (i, 1), Ind (i, 2), Ind (i, 3) ..., Ind (i, 3N) carries out DNA encoding, to arbitrary P
2(i, j) plants encoding scheme according to Ind (i, j) and is converted to corresponding DNA sequence dna, and r element of DNA sequence dna is designated as DNA
r(P
2(i, j)), wherein, r=1,2,3,4,1≤i≤M, 1≤j≤3N;
The DNA sequence dna of pixel in the i-th row obtained is passed through formula by step 7.2.
Carry out dispersion operation, wherein,
R
rp
2(i, j) represent encrypted after DNA encoding value, R
(r-1)p
2(i, j) represents the DNA encoding value of previous encryption,
If r=1, then represent the secret value of last DNA encoding in previous pixel, and R
0p
2(i, 1)=0.
Embodiment three, shown in Fig. 2 ~ 4, the programming software of employing is MatlabR2014a, choose size be 256 × 256 lena coloured image be experimental subjects, as follows to the process of lena color image encryption:
Step 1. inputs the lena coloured image that original size is 256 × 256, uses P
1=imread (' lena.bmp') reading images information, separating color image P
1r, G, B three primary colours component obtain Component Matrices P
1_ R
mN, P
1_ G
mN, P
1_ B
mN, and the size of each Component Matrices is 256 × 256, then by image P
1three Component Matrices P
1_ R
mN, P
1_ G
mN, P
1_ B
mNsort left to right and obtain the gray level image P that a size is 256 × 768
2.
Step 2. utilizes SHA256 function to plaintext coloured image P
1calculate, obtain one group 256 cryptographic hash and using it as image key Key, then the Key of 256 is scaled 32 decimal numbers, next be equally divided into four groups, be used for respectively calculate in scramble and diffusion process the original state value of CML chaos system used and the concrete steps of parameter as follows:
Adopt LTS to map as the local of coupled map lattice systems model herein, LTS (LogisticTentSystem) maps and maps and Tent mapping generation in conjunction with Logistic, is defined as follows:
2.1.CML chaos system:
The chaos sequence produced herein is according to coupled map lattice systems (Coupledmaplattices, CML) model produces, coupled map lattice systems is a kind of Chaotic Systems, and generate chaos sequence with CML Chaotic Systems in this algorithm, its expression formula is:
Wherein
In formula: n=1,2 ..., n is time index or state index, and i, j, k are the location index of reflection grid,
for i-th grid in CML model is at the state value of space-time n, and
1≤j≤L, 1≤k≤L, i=1,2 ..., L, L are the coupled map lattice systems number in CML chaos system, the parameter value that p, q, ε ∈ [0,1], η ∈ [0,1] they are CML model, wherein L=8, ε=0.5, η=0.9, p=12, q=9.
2.2. utilize SHA256 function to plaintext coloured image P
1calculate, obtain the cryptographic hash [780edea123d2ae372b5ebea72781e84e93564dc0b5ebe0f1b9e0f871 7d72d681] of a group 256, and using its key K ey as image, then the Key of 256 is scaled 32 decimal numbers, is defined as k
1, k
2..., k
32, its value is [12,014,222,161,352,101,745,543,941,901,673,912,923,278,147,867,719,218,123 5224241185224248113125114214129], is next equally divided into four groups, i.e. k
1, k
2..., k
8[120142221613521017455]; k
9, k
10..., k
16[43941901673912923278]; k
17, k
18..., k
24[1478677192181235224241]; k
25, k
26..., k
32[185224248113125114214129].
2.3. k is utilized
1, k
2..., k
8and k
9, k
10..., k
168 original state values of the CML chaos system be used in scrambling process are calculated by formula (4)
with 8 parameter value r
i.
Wherein
for the state value of coupled map lattice systems, and
r
ifor the controling parameters that LTS maps, and 0 < r
i< 4.
8 the original state values for the CML chaos system in scrambling process calculated herein
with 8 parameter value r
ibe respectively:
r
1=0.671875,r
2=1.46875,r
3=2.96875,r
4=2.609375,
r
5=0.609375,r
6=2.015625,r
7=3.625,r
8=1.21875。
2.4. k is utilized
10, k
11..., k
24and k
25, k
26..., k
328 original state values of the CML chaos system be used in diffusion process are calculated by formula (5)
with 8 parameter value r
i.
Wherein
for the state value of coupled map lattice systems, and
r
ifor the controling parameters that LTS maps, and 0 < r
i< 4.
8 the original state values for the CML chaos system in diffusion process calculated herein
with 8 parameter value r
ibe respectively:
r
1=2.890625,r
2=3.5,r
3=3.875,r
4=1.765625,
r
5=1.953125,r
6=1.78125,r
7=3.34375,r
8=2.015625。
The original state value being used for the CML chaos system in scrambling process calculated and parameter value are brought in CML chaos system and are carried out iteration by step 3., add up to obtain the state value matrix W 1 that a size is 256 × 768, and matrix W 1 is sorted left to right, can obtaining a size, to be similarly the step of the Scrambling Matrix K of 256 × 768 as follows:
3.1. 8 state values being used for the CML chaos system in scrambling process will obtained in step 2.3
with 8 parameter value r
ibring iteration (N in formula (1)-(3) into
0+ 24576) secondary, wherein N
0=1146, in order to avoid deleterious effect, give up front N
0individual numerical value, adds up to obtain the state value matrix W 1 that a size is 256 × 768.
3.2. the state value matrix W 1 obtained is sorted left to right according to formula (6), obtain the Scrambling Matrix K that a size is 256 × 768.
[ignore,K]=sort(W1,2)(6)
Wherein sort (W1,2) element of a line every in matrix W 1 arranges according to order from small to large by expression, ignore represents the matrix after arrangement, the location index matrix that the element after sequence that what K represented be through is corresponding in former array.
Such as: for a matrix
After formula (6) sequence:
The original state value being used for the CML chaos system in diffusion process calculated and parameter are brought in CML chaos system and are carried out iteration by step 4., add up to obtain the state value matrix W 2 that a size is 256 × 768, then by W2 often row be one group with 8 state values, respectively the step of index value is set up to each state value as follows:
4.1. 8 state values being used for the CML chaos system in diffusion process will obtained in step 2.4
with 8 parameter value r
ibring iteration N in formula (1)-(3) into
0+ 24576 times, wherein N
0=1146, in order to avoid deleterious effect, give up front N
0individual numerical value, adds up to obtain the state value matrix W 2 that a size is 256 × 768.
4.2., in the state matrix W2 obtained, often row is one group with 8 state values, sets up index respectively by formula (7) to often organizing state value, namely the index value at maximal value place is 1, the index value at second largest value place is 2, and by that analogy, the index value at minimum value place is 8.Have a unique index value corresponding thereto for each element in W2 like this, we remember the index value that in Ind (i, j) representing matrix W2, the i-th row jth column element is corresponding, and 1≤i≤256,1≤j≤768.
Wherein sort (x, ' descend') and represent the element in x is arranged according to descending, x is an array be made up of 8 state values, ignore represents the matrix after arrangement, the location index matrix that element after sequence that what Ind1 represented be through is corresponding in former array, element in Ind1 sorts according to order from small to large by sort (Ind1) expression, and Ind represents after Ind1 sequence, the location index matrix of its element in former Ind1.Such as: for a matrix
First I
All elements in the first row be one group according to every 8 divide into groups, two groups can be obtained, be denoted as A
11=[642361606757], A
12=[955541213515016], next respectively to A
11and A
12the index value of trying to achieve according to formula (7) is: A
11: Ind=[1872365]; A
12: Ind=[8127634].A can be found out
11in the index value of the index value of the index value of the index value of 64 correspondences to be the index value of 1,2 correspondences be 8,3 correspondences to be the index value of 7,61 correspondences be 2,60 correspondences to be the index value of 3,6 correspondences be 6,7 correspondences be the index value of 5,57 correspondences be 4.In like manner, A
12in the index value of the index value of the index value of the index value of 9 correspondences to be the index value of 8,55 correspondences be 1,54 correspondences to be the index value of 2,12 correspondences be 7,13 correspondences to be the index value of 6,51 correspondences be 3,50 correspondences be the index value of 4,16 correspondences be 5.So far, the first row Ind (1 of the index matrix Ind of matrix A, :)=[18723658127634], correspondingly, the index value of the second row and the third line is respectively Ind (2 :)=[456327814532786] and Ind (3 :)=[5436721883562741], finally can obtain the index value Ind (i, j) of any i-th row jth column element.
The matrix W 2 obtained is converted into INTEGER MATRICES Y by step 5., ensures that its value is between [0,255], and the step that matrix Y is converted to corresponding DNA matrix according to the index value of trying to achieve in step 4 is as follows:
5.1. the matrix W 2 obtained is converted into INTEGER MATRICES Y according to formula (8), ensures that its value is between [0,255].
Y(i,j)=mod((W2(i,j)-floor(W2(i,j)))*10^8,256)(8)
In formula, mod (a, b) represents the modulo operation of a to b; Floor (x) represents the maximum integer being no more than x; Y (i, j) represents the element value of the i-th row jth row of the INTEGER MATRICES Y obtained, wherein 1≤i≤256,1≤j≤768.
5.2.DNA encryption rule
5.2.1.DNA encoding scheme
Single-stranded DNA sequence is made up of four kinds of base A, C, G, T, and wherein A and T, C and G are complementary, carry out binary coding respectively, have 24 kinds of coded combinations with 00,01,10,11 to the base of four in DNA sequence dna.Because binary digit 0 and 1 is complementary, thus 00 and 11 is complementary, and 01 and 10 is complementary, therefore in 24 kinds of numerical codings, have 8 kinds of codings to meet base pair complementarity criterion, in table 1.As mathematical operation, we can define multiple DNA operation rule, and the convenient DNA encoding value that directly uses in cryptographic algorithm carries out mathematics or logical operation.
8 kinds of schemes of table 1DNA coding
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
A |
00 |
00 |
11 |
11 |
01 |
01 |
10 |
10 |
T |
11 |
11 |
00 |
00 |
10 |
10 |
01 |
01 |
G |
01 |
10 |
01 |
10 |
00 |
11 |
00 |
11 |
C |
10 |
01 |
10 |
01 |
11 |
00 |
11 |
00 |
5.2.2.DNA add the computing of (subtracting) method
DNA adds (subtracting), and method operation definition is: two DNA encoding values are converted to corresponding binary value according to fixing DNA encoding rule and carry out being added (subtracting), DNA encoding value is converted to, in table 2, table 3 by being added the binary value that (subtracting) obtain again according to DNA encoding used before rule.
Addition rule when table 2DNA encoding scheme is 1
+ |
A |
T |
G |
C |
A |
A |
T |
G |
C |
T |
T |
T |
A |
G |
G |
G |
A |
C |
T |
C |
C |
G |
T |
A |
Subtraction rule when table 3DNA encoding scheme is 3
- |
A |
T |
G |
C |
A |
T |
A |
C |
G |
T |
G |
T |
A |
C |
G |
C |
C |
T |
A |
C |
A |
C |
G |
T |
5.2.3.DNA XOR
Method that reference dna adds (subtracting) rule, then DNA XOR is defined as: two DNA encoding values are converted to corresponding binary value according to fixing DNA encoding rule and carry out XOR, the binary value obtained by XOR according to DNA encoding used before rule is again converted to DNA encoding value, in table 4.
XOR rule when table 4DNA encoding scheme is 5
Example: if expressly one of them pixel value of image is 75 [01001011], be [GACT] with the 1st kind of DNA encoding rule DNA sequence dna obtained that carries out encoding, the DNA sequence dna after encrypting is obtained for [TCAA] through DNA cryptographic calculation, then DNA sequence dna [TCAA] the 1st kind of decoding rule is carried out the binary pixel values sequence [11100000] obtained of decoding, being converted to decimal number is 224.
5.3. each element in matrix Y is converted to corresponding DNA matrix according to index value corresponding in step 4, namely for arbitrary Y (i, j) plant encoding scheme according to Ind (i, j) and be converted to corresponding DNA sequence dna, and r element of DNA sequence dna is designated as DNA
r(Y (i, j)), DNA
r(Y (i, j)) ∈ { A, T, G, C}, r=1,2,3,4 and 1≤i≤256,1≤j≤768.Step 6. utilizes i-th row of the Scrambling Matrix K tried to achieve in step 3 to image P
2i-th to advance line shuffle.
Step 7. will plaintext image P
2in completed scramble the i-th row pixel be converted to corresponding DNA sequence dna according to the index value obtained in step 4, and the step of being carried out dispersion operation is as follows:
7.1. to P
2in completed the i-th row element P of scramble
2(i, 1), P
2(i, 2), P
2(i, 3) ..., P
2(i, 768) respectively according to the index value Ind (i, 1) of the i-th row of gained in step 4, Ind (i, 2), Ind (i, 3) ..., Ind (i, 768) carries out DNA encoding, namely for arbitrary P
2(i, j) plants encoding scheme according to Ind (i, j) and is converted to corresponding DNA sequence dna, and r element of DNA sequence dna is designated as DNA
r(P
2(i, j)), DNA
r(P
2(i, j)) ∈ { A, T, G, C}, r=1,2,3,4 and 1≤i≤256,1≤j≤768.
7.2. the DNA sequence dna of pixel in the i-th row obtained is carried out dispersion operation by formula (9):
Wherein R
rp
2(i, j) represent encrypted after DNA encoding value, R
(r-1)p
2(i, j) represents the DNA encoding value of previous encryption,
If r=1, then represent the secret value of last DNA encoding in previous pixel, and R
0p
2(i, 1)=0;
Step 8. makes i=i+1, repeats the operation of step 6 and step 7, until plaintext gray level image P
2in every one-row pixels all complete DNA encryption;
Step 9. by the DNA matrix after encrypted according to its corresponding DNA decoding rule, DNA matrix is decoded as the binary matrix Q1 that a size is 256 × 6144, then decimal system conversion operations is carried out to matrix Q1, the decimal system ciphertext matrix Q2 that a size is 256 × 768 can be obtained, then Q2 is equally divided into the matrix P that 3 sizes are 256 × 256 entirely
3_ R
mN, P
3_ G
mN, P
3_ B
mN, finally by three matrix merger and reorganization, finally obtaining a size is that the colored ciphertext graph of 256 × 256 is as P
3, i.e. encrypted image.
Good cryptographic algorithm can resist various attack, and key space is enough large, and susceptibility is enough high, and the technical scheme safety analysis that this embodiment adopts is as follows:
1. key space is enough large, is enough to resist exhaustive attack, and chaos system is to starting condition and controling parameters sensitivity extremely, and any small initial deviation all can be amplified by exponential form, and therefore the security of chaos encryption algorithm and key space have much relations.In general, key space is larger, and the ability of its opposing exhaustive attack is also stronger; In this embodiment, key specifically comprises: 1) controling parameters ε, η, p, q of CML chaos system and selected reflection grid number L; 2) 256 cryptographic hash produced by SHA256 function; 3) the number N of the CML chaos sequence given up
0.If arranging precision is 10
-14, then key space is at least 2
256, visible key space is enough large, effectively can resist exhaustive attack.
2. key susceptibility is high, and the susceptibility of key is exactly that after carrying out slight change to key, its ciphertext also significant change can occur.When assailant with one with the very close data of key carry out image crack time, original image can not be recovered.
In accompanying drawing 2, what a () represented is plaintext image, what b () represented is final encrypted image, c (), (d) are key sensitivity experiments, wherein parameter ε=0.5 of CML chaos system, η=0.9, p=12, q=9, L=8, correct key K ey=780edea123d2ae372b5ebea72781e84e93564dc0b5ebe0f1b9e0f 8717d72d681.Figure
When 2 (c), 2 (d) are the parameter constant when CML chaos system respectively, make decrypted image during Key1=880edea123d2ae372b5ebea72781e84e93564dc0b5ebe0f1b9e 0f8717d72d681 and Key2=780edea123d2ae372b5ebea72781e84e93564dc0b5ebe0f1b9e 0f8717d72d680.As can be seen here, the susceptibility of this cryptographic algorithm to key is high, and cryptographic security is also better.
3. the grey level histogram of ciphertext graph picture is level and smooth and even, and anti-Statistical Analysis Attacks ability is strong, the frequency that the pixel that histogram describes all gray levels in digital picture occurs.A good resume image is after being encrypted image, and the grey level histogram of the ciphertext graph picture obtained should be level and smooth and uniform, can prevent the person of stealing secret information from cracking image by histogrammic leak.
In accompanying drawing 3, (a) represents the histogram of expressly image R component; B () represents the histogram of encrypted image R component; C () represents the histogram of expressly image G component; D () represents the histogram of encrypted image G component; E () represents the histogram of expressly image B component; F () represents the histogram of encrypted image B component.As can be seen from the figure, before encryption, the pixel value distributed pole of image is uneven, and pixel value after encryption is level and smooth and be evenly distributed in [0,255], effectively can resist the attack of statistical study.
4. plaintext image neighbor height correlation, after encryption, image neighbor related coefficient is close to 0, substantially uncorrelated.As the correlativity of neighbor, the related coefficient of neighbor is introduced in order to analyze expressly image and ciphertext graph.Related coefficient is larger, illustrates that the correlativity of neighbor is larger; Otherwise the correlativity of neighbor is less.From image, choose 5000 pairs of horizontal direction neighbors pair, the 5000 pairs of vertical direction neighbors to 5000 to angular direction neighbor pair, quantitatively calculate the related coefficient of neighbor with following formula:
In formula, x, y represent the pixel value of adjacent two pixels in image respectively, and D (x) represents the mean square deviation of pixel value, and E (x) represents the mean value of pixel value, and cov (x, y) represents related function, R
x,yrepresent the related coefficient of adjacent two pixels.
As shown in Figure 4, in Fig. 4, (a) is the correlation analysis figure of neighbor on plaintext image level direction to its mid point (x, y) place test result, and (b) is for ciphertext graph is as the correlation analysis figure of neighbor in horizontal direction; C () is the correlation analysis figure of neighbor in plaintext image vertical direction, (d) is for ciphertext graph is as the correlation analysis figure of neighbor in vertical direction; E (), for ciphertext graph picture is to the correlation analysis figure of neighbor on angular direction, (f) is for ciphertext graph picture is to the correlation analysis figure of neighbor on angular direction.
Expressly, the related coefficient contrast of ciphertext neighbor sees the following form:
Can find out that expressly image neighbor is height correlation, related coefficient is close to 1.And the neighbor related coefficient of encrypted image is close to 0, between neighbor, correlativity obviously reduces, and now the statistical property of plaintext has been diffused in random ciphertext, effectively can resist statistical attack.
5.NPCR is greater than 99%, UACI and is greater than 33%, and Against Differential Cryptanalysis ability is strong.
Algorithm is stronger to susceptibility expressly, the ability of opposing differential attack is also stronger, can on average change intensity UACI (UnifiedAverageChangingIntensity) measure cryptographic algorithm to susceptibility expressly with pixel count rate of change NPCR (NumberofPixelsChangeRate) and normalization pixel value.Computing formula is as follows:
In formula, M and N represents line number and the columns of image, C
1represent original ciphertext graph picture, C
2represent the ciphertext graph picture changing and obtain expressly, C
1(i, j) represents the expressly pixel value of image at coordinate (i, j) place, C
2(i, j) represents the pixel value of ciphertext graph picture at coordinate (i, j) place.D represents that the value of D (i, j) is by C with ciphertext graph as equirotal matrix
1(i, j) and C
2(i, j) determines.If C
1(i, j)=C
2(i, j), so D (i, j)=0; If C
1(i, j) ≠ C
2(i, j), so D (i, j)=1.
In the present invention, first of original plaintext image pixel value is changed into and after 223, to obtain a new plaintext image, then these two images are regenerated ciphertext graph as C
1and C
2.NPCR and the UACI value calculating ciphertext graph picture is as shown in the table, can see that the value that the value of NPCR is greater than 99%, UACI is greater than 33%.This shows, even if do small change to plaintext image, after being encrypted by this algorithm, ciphertext graph picture also has obvious difference.Therefore, this algorithm effectively can resist differential attack.
NPCR and the UACI value of ciphertext graph picture:
6. the information entropy of ciphertext graph picture closely ideal value 8, cryptographic algorithm security is good.
Information entropy is the important measure index of reflection information randomness, and the information entropy computing formula of information source m is as follows:
Wherein, p (m
i) represent symbol m
ithe probability occurred, 2
nit is total status number of information source m.After information encryption, the expectation value of information entropy is 8.If encrypted image information entropy closely 8, then show that this ciphertext graph picture is close to stochastic distribution.
Be encrypted standard 256 × 256lena image algorithm of the present invention, the information entropy obtaining ciphertext graph picture is 7.9971, closely ideal value 8, and this shows that encryption method provided by the invention has good security.
Embodiment four, shown in Fig. 5 ~ 7, the programming software of employing is MatlabR2014a, choose size be 512 × 480 fruits coloured image be experimental subjects, as follows to the process of fruits color image encryption:
(1) the 8-bit color image P that size is 512 × 480 is inputted
1, separating color image P
1r, G, B three primary colours component obtain Component Matrices P
1_ R
mN, P
1_ G
mN, P
1_ B
mN, and the size of each Component Matrices is 512 × 480, then by image P
1three Component Matrices P
1_ R
mN, P
1_ G
mN, P
1_ B
mNsort left to right and obtain the gray level image P that a size is 512 × 1440
2.
(2) utilize SHA256 function to plaintext coloured image P
1calculate, obtain one group 256 cryptographic hash and using it as image key Key, then the Key of 256 is scaled 32 decimal numbers, is next equally divided into four groups, be used for calculating the original state value of CML chaos system used and parameter in scramble and diffusion process respectively.
(3) initial value being used for the CML chaos system in scrambling process obtained in step 2 and parameter are brought in CML chaos system carry out iteration, add up to obtain the state value matrix W 1 that a size is 512 × 1440, and matrix W 1 is sorted left to right, the Scrambling Matrix K that a size is similarly 512 × 1440 can be obtained.
(4) initial value being used for the CML chaos system in diffusion process obtained in step 2 and parameter are brought in CML chaos system carry out iteration, add up to obtain the state value matrix W 2 that a size is 512 × 1440, then by W2 often row be one group with 8 state values, respectively index value is set up to each state value.
(5) matrix W 2 obtained is converted into INTEGER MATRICES Y, ensures that its value is between [0,255], and matrix Y is converted to corresponding DNA matrix according to the index value in step (4).
(6) utilize i-th row of Scrambling Matrix K to image P
2i-th to advance line shuffle.
(7) will plaintext image P
2in completed scramble the i-th row pixel be converted to corresponding DNA sequence dna according to the index value obtained in step (4), and carried out dispersion operation.
(8) make i=i+1, repeat the operation of step 6 and step 7, until plaintext gray level image P
2in every one-row pixels all complete DNA encryption;
(9) by the DNA matrix after encrypted according to its corresponding DNA decoding rule, DNA matrix is decoded as the binary matrix Q1 that a size is 512 × 11520, then decimal system conversion operations is carried out to matrix Q1, the decimal system ciphertext matrix Q2 that a size is 512 × 1440 can be obtained, then Q2 is equally divided into the matrix P that 3 sizes are 512 × 480 entirely
3_ R
mN, P
3_ G
mN, P
3_ B
mN, finally by three matrix merger and reorganization, finally obtaining a size is that the colored ciphertext graph of 512 × 480 is as P
3, i.e. encrypted image.
Safety analysis in the present embodiment is as follows:
1. key space is enough large, is enough to resist exhaustive attack, and chaos system is to starting condition and controling parameters sensitivity extremely, and any small initial deviation all can be amplified by exponential form, and therefore the security of chaos encryption algorithm and key space have much relations.In general, key space is larger, and the ability of its opposing exhaustive attack is also stronger; In this embodiment, key specifically comprises: 1) controling parameters ε, η, p, q of CML chaos system and selected reflection grid number L; 2) 256 cryptographic hash produced by SHA256 function; 3) the number N of the CML chaos sequence given up
0.If arranging precision is 10
-14, then key space is at least 2
256, visible key space is enough large, effectively can resist exhaustive attack.
2. key susceptibility is high
See accompanying drawing 5, wherein, what a () represented is plaintext image, what b () represented is final encrypted image, c (), 5 (d) are key sensitivity experiments, wherein parameter ε=0.5 of CML chaos system, η=0.9, p=12, q=9, L=8, correct key K ey=881ecc9992cfaad47a4981276b92a27bd7a9b6ce457dc30ce76f3 8989075bb27.When (), (d) are the parameter constant when CML chaos system respectively c, make decrypted image during Key1=981ecc9992cfaad47a4981276b92a27bd7a9b6ce457dc30ce76 f38989075bb27 and Key2=881ecc9992cfaad47a4981276b92a27bd7a9b6ce457dc30ce76 f38989075bb28.As can be seen here, the susceptibility of this cryptographic algorithm to key is high, and cryptographic security is also better.
3. the grey level histogram of ciphertext graph picture is level and smooth and even, and anti-Statistical Analysis Attacks ability is strong.
See accompanying drawing 6, wherein, (a) represents the histogram of expressly image R component; B () represents the histogram of ciphertext graph as R component; C () represents the histogram of expressly image G component; D () represents the histogram of ciphertext graph as G component; E () represents the histogram of expressly image B component; F () represents the histogram of ciphertext graph as B component.As can be seen from the figure, before encryption, the pixel value distributed pole of image is uneven, and pixel value after encryption is level and smooth and be evenly distributed in [0,255], effectively can resist the attack of statistical study.
4. plaintext image neighbor height correlation, after encryption, image neighbor related coefficient is close to 0, substantially uncorrelated.
See Fig. 7, wherein, (a) is the correlation analysis figure of neighbor on plaintext image level direction, and (b) is for ciphertext graph is as the correlation analysis figure of neighbor in horizontal direction; C () is the correlation analysis figure of neighbor in plaintext image vertical direction, (d) is for ciphertext graph is as the correlation analysis figure of neighbor in vertical direction; E () is that expressly image is to the correlation analysis figure of neighbor on angular direction, (f) is for ciphertext graph picture is to the correlation analysis figure of neighbor on angular direction.
Expressly, the related coefficient contrast of ciphertext neighbor sees the following form:
Can find out that expressly image neighbor is height correlation, related coefficient is close to 1.And the adjacent related coefficient of encrypted image is close to 0, between neighbor, correlativity obviously reduces, and now the statistical property of plaintext has been diffused in random ciphertext, effectively can resist statistical attack.
5.NPCR is greater than 99%, UACI and is greater than 33%, and Against Differential Cryptanalysis ability is strong.
In the present embodiment, first of original plaintext image pixel value is changed into and after 131, to obtain a new plaintext image, then these two images are regenerated ciphertext graph as C
1and C
2.NPCR and the UACI value calculating ciphertext graph picture is as shown in the table, can see that the value that the value of NPCR is greater than 99%, UACI is greater than 33%.This shows, even if do small change to plaintext image, after being encrypted by this algorithm, ciphertext graph picture also has obvious difference.Therefore, this algorithm effectively can resist differential attack.
NPCR and the UACI value of ciphertext graph picture:
6. the information entropy of ciphertext graph picture closely ideal value 8, cryptographic algorithm security is good.
Be encrypted standard 512 × 2480fruits image algorithm of the present invention, the information entropy obtaining ciphertext graph picture is 7.9993, closely ideal value 8, and this shows that cryptographic algorithm provided by the invention has good security.
From embodiment 1 ~ 4, cryptographic algorithm provided by the invention can carry out the encryption of high safety to the coloured image of M=N or M ≠ N, have broad application prospects in field of information encryption.
By reference to the accompanying drawings the preferred embodiments of the disclosure and embodiment are explained in detail above, but the present invention is not limited to the above-described embodiment and examples, in the ken that those skilled in the art possess, various change can also be made without departing from the inventive concept of the premise.