The present application claims the priority of Chinese patent application filed in China Patent Office on Sep. 18, 2021, with the application No. 202111111709.5 and entitled “an image encryption method based on improved class boosting scheme”, the entire contents of which are incorporated in the present application by reference.
The present invention relates to the technical field of image encryption, in particular to an image encryption method based on an improved class boosting scheme.
With the rapid development of Internet and multimedia technology, it is more and more convenient for people to get information on the Internet. Because images carry private and sensitive information, the security of image information has drawn more attention. The image encryption technology is one of the most effective means to ensure the security of image information. Zhang Yong proposed a unified image encryption system based on a class boosting scheme, which uses class boosting transformation to diffuse image information, thereby realizing image encryption. Although the system has a fast encryption and decryption speed and a good encryption effect, it has the disadvantages that update and prediction functions are too simple: and it is easy for a decoding person to find out a linear relationship, so as to solve it. Therefore, it is positive work to study more complex update and prediction functions to improve the security and reliability of image encryption.
Aiming at the problem that update and prediction functions in a class boosting scheme in the prior art are too simple, the present invention provides an image encryption method based on the improved class boosting scheme, which combines class perception networks with a class boosting scheme to achieve a better encryption effect.
To achieve the above purpose, the present invention provides an image encryption method based on an improved class boosting scheme, which comprises:
acquiring parameters of a hyperehaotic system according to plaintext image information;
generating weights required by class perceptron networks through he plaintext image information;
bringing the parameters into the hyperchaotic system to obtain chaotic sequences, and shuffling the chaotic sequences by a shuffling algorithm;
pre-processing the chaotic sequences after shuffling to obtain a sequence required by encryption; and
bringing a plaintext image and the sequence into an improved class boosting. scheme to obtain a ciphertext image, wherein the improved class boosting scheme is realized based on the class perception networks.
Further, wherein acquiring the parameters of the hyperchaotic system according to the plaintext image information specifically comprises; generating a hash value K of the plaintext image by a SHA512 function, converting the hash value K into a binary number, and then generating 128 groups of decimal numbers H=h1, h2, h3, . . . , h128 by 4 hits in each group, and then obtaining a hyperchaotic initial value by the decimal number group H, which is specifically:
Further, wherein generating the weights required by the class perceptron networks through the plaintext image information specifically comprises: generating initial weights of two class perceptron networks by the decimal number group H=h1, h2, h3, . . . , h128, wherein weights of the class perceptron network PLN-1 are respectively:
φ11=mod(sum(h1h2. . . h32)×1010,9)
φ12=mod(sum(h33h34. . . h64)×1010,9)
φ21=mod(sum(h65h66. . . h96)×1010,9)
φ22=mod(sum(h97h98. . . h128)×1010,9) ;and
weights φ′11, φ′12,φ′21,φ′22 of the perceptron network PLN-2 are respectively:
φ′11=floor(mean(h1h2 . . . h32))
φ′12=floor(mean(h33h34 . . . h64))
φ′21=floor(mean(h65h66 . . . h96))
φ′22=floor(mean(h97h98 . . . h128))
Further, wherein bringing the parameters into the hyperchaotic system to obtain the chaotic sequences, and shuffling the chaotic sequences by the shuffling algorithm specifically comprise:
bringing the parameters into the hyperchaotic system to generate four sequences a1, a2, a3 and a4 with the length of M×N+300, discarding the first 300 elements of each sequence, and processing the remaining sequences as follows, so as to obtain sequences within a scope of normal plaintext pixel values, namely (i=1, 2, 3, . . . , n), wherein
b
1(i)=mod(abs(floor(a1(i)×1010)) ,256)
b
2(i)=mod(abs(floor(a2(i)×1010)) ,256)
b
3(i)=mod(abs(floor(a3(i)×1010)) ,256)
b
4(i)=mod(abs(floor(a4(i)×1010)) ,256)
generating a random value array (i=1, 2, 3, . . . , n) used for a Knuth-Durstenfeld shuffling algorithm, wherein NUM is the total sequence length; and
aa
1(i)=mod(abs(floor(a1(i)×1010)) ,NUM−i+1)+1
aa
2(i)=mod(abs(floor(a2(i)×1010)) ,NUM−i+1)+1
aa
3(i)=mod(abs(floor(a3(i)×1010)) ,NUM−i+1)+1
aa
4(i)=mod(abs(floor(a4(i)×1010)) ,NUM−i+1)+1
shuffling the generated sequences by the shuffling algorithm with the generated random value array.
Further, wherein pre-processing the chaotic sequences after shuffling to obtain the sequence required by encryption specifically comprises: alter shuffling the obtained sequences b1, b2, b3 and b4 with the shuffling algorithm, taking the first numbers in b1, b2, b3 and b4 arrays as a group to sere as the first four numbers in the sequence {ai}; taking the second numbers in the b1, b2, b3 and b4 arrays as a group and inserting the numbers into the sequence {ai}, repeating the above steps until there are M×N/2 numbers in the sequence {ai}, generating the required sequence {ai}, where i=1, 2, 3, . . . , M×N/2, and directly using the sequence for image encryption, wherein M is the number of rows of the plaintext image; and N is the number of columns of the plaintext image.
Further, wherein the improved class boosting scheme comprises a forward transformation module, an overturning transformation module and an inverse transformation module; and operations in the three modules are all based on a GF(28) domain.
Further, wherein in the forward transformation module, the plaintext image is first converted into a one-dimensional sequence {x1}, where i=1, 2, 3, . . . , M×N; and then the sequence {xi} is divided into two subsequences {ej} and {oj}, where ej=x2j-1; oj=x2j; and j=1,2,3, . . . L;
a sequence {pj} is obtained from the subsequence {ej} and the sequence {ai} as follows:
pj=ej+ai; where j=1,2,3, . . . , L;
after the sequence {pj} as updated by the class perceptron network PLN-1, the sequence is combined with the subsequence {oj} to obtain a sequence {dj} as follows:
dj=dj-1+oj+PLN-1(pj,pj+1), where j=1,2,3, . . . , L;
d0=0; and P0=0; and
after the sequence {sj} is updated by the class perceptron network PLN-2, the sequence is combined with the sequence {pj} to obtain a sequence {sj} as follows:
sj=pj+pj-1+PLN-2(dj-1,dj), where j=1,2,3, . . . , L; and
d0=0; and P0=0; and
the obtained sequences {sj} and {dj} are combined into a new sequence {ri}, where i=1, 2, 3, . . . , M×N; R2j-1=Sj; R2J=Dj; and j=1, 2, 3, . . . , L.
Further, wherein in the forward transformation module, the sequence {ri}, where i=1, 2, 3, . . . , M×N, is flipped left and right in the overturning module to obtain a new sequence {r′i}, where i=1, 2, 3, . . . , M×N.
Further, wherein in the forward transformation module, the sequence {r′i} is divided into two different sequences {s′j} and {d′j} according to an odd even index in the inverse transformation module, where s′j=r′2j-1; d′j=r′2j; and j=1, 2, 3, . . . L;
after the sequence {d′j} is updated by the class perceptron network PLN-2, the seqence is combined with the sequence {s′j} to obtain a sequence {S′j} as follows:
S′j=s′j−S′j-1−PLN-2(d′j-1,d′j), where j=1,2,3, . . . L;
d′0=0; and S′0=0;
after {S′j} is updated by the class perceptron network PLN-1, the sequence is combined with the sequence {d′j} to obtain a sequence {o′j} as follows:
o′j=d′j−d′j-1−PLN-1(S′j,S′j+1), where j=1,2,3, . . . L;
d′0=0; and S′L+1=0;
a sequence {e′j} obtained from the sequence {S′j} and the sequence {ai} is:
e′j=S′j-ai, where j=1,2,3, . . . L;
{e′j} and {o′j} are combined into a new sequence {yi}, where i=1,2,3, . . . , M×N; Y2j-1=e′j; Y2j=o′j; and j=1,2,3, . . . L; and
finally, the obtained sequence is converted into a matrix with the size of M×N. that is, an encrypted image is obtained.
According to specific embodiments provided by the present invention, the present invention discloses the following technical effects:
1. Compared with a traditional permutation diffusion structure, the scheme has a faster encryption and decryption speed and has higher information entropy and a better encryption effect when only one round of encryption is needed:
2. Different from an original class boosting scheme, the present invention makes an original linear function become a complex structure combining linear and nonlinear functions by taking class perceptron networks as prediction and update functions of the class boosting scheme. Moreover, parameters of the class perceptron networks are related to a plaintext. Meanwhile, there is a function of self-updating, which can make each operation different, thereby increasing randomness and unpredictability of image encryption, and being of great significance to security of image encryption; and
3. Parameters required by chaotic sequences and the class perception networks are related to a plaintext image, so that the parameters generated by different images are different, thereby greatly improving randomness and security of encryption.
The present invention comprises the following steps: firstly, generating a HASH value of a plait/text image by a HAS512 function, generating parameters required by a hyperchaotic system and weights required by class perceptron networks by the HASH value; secondly, shuffling generated chaotic sequences by a shuffling algorithm; and finally, bringing an obtained random sequence and the plaintext image into an improved class boosting scheme to obtain a final ciphertext image. In the process of decryption, the plaintext image can be recovered without any loss only by bringing the ciphertext image and a key into the improved class boosting scheme.
A chaotic system used in the present invention is a hyperchaotic system.
where in
i=1,2,3,4 is a derivative of time t; and m, n, p, q and r are parameters of the chaotic system. When m=35, n=3, p=12, q=7 and r=0.58, the system is called a hyperchaotic system.
A Knuth-Durstenfeld shuffling algorithm used in the present invention comprises the following specific steps:
Step 1: Storing an array with the length of n in an array arr[].
Step 2: Generating a random number [1,n], taking the generated random number as an array subscript and outputting as x.
Step 3: Swapping the output x with the last element in the array arr[].
Step 4: Generating a random number [1,n-1], taking the generated random number as an array subscript, and outputting as x′.
Step 5: Swapping the output x′ with the penultimate element in the array arr[].
The above steps are repeated until all n numbers are processed.
As shown in
Step 1: inputting signals x1 and x2 for linear transformation to obtain x′1 and x′2 of a hidden layer:
x′
1
=x
1×ω11+x2×ω21
x′
2
=x
1×ω12+x2×ω22
Step 2: replacing a weight from the hidden layer to an output layer by a function f(x), wherein an or result of the output layer is as follows.
y′1=f(x′1)
y′2=f(x′2)
Where: f (x)=mod (x, 16).
Step 3: calculating an output signal y through S-box.
y=S-box(y′1,y′2).
Step 4; automatically updating height functions.
ω11=ω11+mod(x1,2)
ω12=ω12+mod(x2,2)
ω21=ω21+mod(x1,2)
ω22=ω22+mod(x2,2)
Initial weights of class perceptron networks are generated by the HASH value.
An embodiment of the present invention is implemented based on the technical solution of the present invention. Detailed implementations and specific operation processes are given, but the protection scope of the present invention is not limited to the following embodiment. In the present embodiment, lena256×256 image is used; and a HASH value is generated by a HASH function. After processing, original parameters of a hyperchaotic system are x1=0.37; x2=0.5313; x3=0.1875; and x4=0.2500. Parameters of class perceptron networks are respectively as follows. In PLN-1, W11=7; W12=7; W21=7; and W22=6. In PLN-2, w11=2; w12=7; w21=5; and w22=2.
Step 1: bringing the original parameters into the hyperchaotic system to generate four sequences a1, a2, a3, and a4 with the length of M×N+300, discarding the first 300 elements of each sequence, and processing the remaining sequences as follows.
b
1(i)=mod(abs(floor(a1(i)×1010)) ,256)
b
2(i)=mod(abs(floor(a2(i)×1010)) ,256)
b
3(i)=mod(abs(floor(a3(i)×1010)) ,256)
b
4(i)=mod(abs(floor(a4(i)×1010)) ,256)
Step 2: using the four sequences a1, a2, a3 and a4 to generate random arrays aa1, aa2, aa3 and aa4 used for a shuffling algorithm, and shuffling b1, b2, b3 and b4 by the shuffling algorithm. The algorithm to generate aa1, aa2, aa3 and aa4 are as follows.
aa
1(i)=mod(abs(floor(a1(i)×1010)) ,NUM−i+1)+1
aa
2(i)=mod(abs(floor(a2(i)×1010)) ,NUM−i+1)+1
aa
3(i)=mod(abs(floor(a3(i)×1010)) ,NUM−i+1)+1
aa
4(i)=mod(abs(floor(a4(i)×1010)) ,NUM−i+1)+1
Step 3: preprocessing the obtained sequences b1, b2, b3 and b4 with the shuffling algorithm in step 2, taking the first numbers in b1, b2, b3 and b4 arrays as a group to serve as the first four numbers in the sequence {ai}; taking the second numbers in the b1, b2, b3 and b4 arrays as a group and inserting the numbers into the sequence {ai}, repeating the above steps until there arc M×N/2 numbers in the sequence {ai}, generating the required sequence {ai}, where i=1, 2, 3, . . . , M×N/2, and directly using the sequence for image encryption.
Step 4. Bringing the obtained sequence {ai} together with the plaintext image into the improved class boosting scheme to generate a final ciphertext image.
The present invention proposes an image encryption method based on an improved class boosting scheme, which greatly enhances unpredictability of the scheme by adding the class perceptron networks into the improved class boosting scheme, and can obtain a better encryption result. The present invention carries out simulation on a computer based on an Intel(R)Core(TM)i5-9400CPU@2.90 GHz2.90 GHz 64-bit operation system, and an x64 processor; and the programming language used is MATLAB2019b. After the above encryption method is applied to image processing,
In this paper, specific embodiments are used to explain the principle and implementations of the present invention; and the explanations of the above embodiments are only used to help understand the method and core ideas of the present invention. Meanwhile, according to the idea of the present invention, there will be some changes in the specific implementations and application scope for those ordinarily skilled in the art. To sum up, the contents of the specification should not be understood as limitations to the present invention.
Number | Date | Country | Kind |
---|---|---|---|
202111111709.5 | Sep 2021 | CN | national |
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2022/097038 | Jun 2022 | US |
Child | 17877994 | US |