摘 要
近年来,图像数据信息的安全性逐渐受到人们的关注,为了保证图像的可靠传输,混沌系统被引入图像加密技术。本文主要研究了两种基于混沌系统的图像加密方案。第一种方案是基于超混沌系统和 DNA 编解码运算相结合的图像加密算法,该算法对图像分块进行加密,由混沌系统生成的混沌序列决定每一图像块的 DNA 编解码和运算方式。针对该算法密钥空间较低以及不能抵御裁剪攻击的问题,本文增加了算法中混沌系统的个数,优化了加密的流程。仿真结果表明改进后的加密算法密钥容量提升至 10127 数量级,可以抵抗穷举密钥攻击;加密后图像相邻元素相关性降低至 10-3 数量级,且加密后图像具备抗裁剪性能。另一方面,基于超混沌系统和 DNA 编解码运算的加密算法复杂度较高, 不适用高效图像加密应用场景,因此本文又研究了基于混沌系统和离散余弦变换(DCT)相结合的图像加密压缩算法。此类算法可以在保证图像安全性的同时对图像数据进行压缩,从而提升图像传输的效率。鉴于传统混沌系统 DCT 加密算法的加密过程比较单一,本文在此基础上引入了符号加密,并且将加密后的结果存储为一维数据。仿真结果表明改进后算法的密钥容量达到 1074 数量级。当压缩率低
于 64:10 时,解密后还原的图像在视觉效果上和原始图像区别较小,同时,可以根据实际需要,更改压缩矩阵从而获得不同的压缩率,从而提升图像的传输效率。
关键词:图像加密;混沌系统;DNA 编解码运算;离散余弦变换
Research and Simulation of Chaotic Digital Image Encryption Technology
Abstract
In recent years, the security of image data has been paid more and more attention. In order to ensure the reliable transmission of images, the chaotic system is introduced into image encryption technology. This paper mainly studies two image encryption schemes based on chaotic systems. The first scheme is an image encryption algorithm based on the combination of hyperchaotic system and DNA encoding, decoding and computing. This algorithm encrypts the blocks of image. The chaotic sequence generated by the chaotic system determines the DNA coding, decoding, and computing modes of each image blocks. For the problem that the algorithm has a low key space and cannot resist the cropping attack, this paper increases the number of chaotic systems in the algorithm and optimizes the encryption process. The simulation results show that the key capacity of the improved encryption algorithm is improved to 10127 order of magnitude, which can resist the exhaustive key attack; after the encryption, the correlation of the adjacent elements of the image is reduced to 10-3 orders of magnitude, and the encrypted image has the anti-clipping performance. On the other hand, encryption algorithms based on hyperchaotic systems and DNA coding, decoding and computing are highly complex and are not suitable for the application scenarios of high-efficiency image encryption. Therefore, this paper also studies an image encryption and compression algorithm based on chaotic systems and discrete cosine transform (DCT). Such algorithms can compress image data while ensuring image security, thereby improving the efficiency of image transmission. In view of the fact that the encryption process of the traditional chaotic DCT encryption algorithm is relatively simple, this paper introduces symbol encryption and stores the encrypted result as one-dimensional data. The simulation results show that the
improved algorithm has a key capacity of 1074 orders of magnitude. When the compression rate is lower than
64:10, the image after decryption has little difference with the original image on the visual effects. In addition, the compression matrix can be changed to obtain different compression rates according to actual needs, which can improve the image transmission efficiency.
Keywords: image encryption; chaotic system; DNA coding-decoding-computing; discrete cosine transform
目 录
混沌数字图像加密技术研究与仿真实现 1
摘 要 1
关键词:图像加密;混沌系统;DNA 编解码运算;离散余弦变换 1
Abstract 2
Keywords: image encryption; chaotic system; DNA coding-decoding-computing; discrete cosine transform 2
1 绪论 1 3
1.1 课题研究背景和意义 1 3
1.2 课题研究现状 1 3
1.3 本文主要研究内容及结构安排 2 3
2 混沌系统与 DNA 编码 3 3
2.1 混沌系统 3 3
2.1.1 混沌的特性 3 3
2.1.2 Logistic 映射 3 3
2.1.3 Chen 超混沌系统 3 3
2.2 DNA 编解码与运算 4 3
2.2.1 DNA 编码与解码规则 4 3
2.2.2 DNA 运算法则 5 3
3 基于混沌系统与 DNA 运算的图像加密系统 7 3
3.1 加密算法思想 7 3
3.2 加密算法具体步骤 8 3
3.3 解密算法具体步骤 10 3
3.4 实验仿真及性能分析 11 3
3.4.1 实验仿真结果 11 3
3.4.2 直方图分析 12 3
3.4.3 相邻位置数据值关联性 12 3
3.4.4 抗裁剪性能 16 3
3.4.5 抗噪声性能 18 3
3.4.6 图像质量评价 19 3
3.4.7 信息熵 20 3
3.4.8 密钥敏感性 21 3
3.4.9 密钥容量 23 3
4 基于混沌系统与 DCT 变换的图像压缩加密系统 24 3
4.1 加密算法结构 24 3
4.2 DCT 压缩加密算法具体步骤 24 3
4.3 DCT 解密解压算法步骤 26 3
4.4 实验仿真及性能分析 27 3
4.4.1 实验仿真结果 27 4
4.4.2 不同压缩比情况下的解密结果 28 4
4.4.3 密钥敏感性分析 29 4
4.4.4 密钥容量计算 29 4
5 总结与展望 30 4
5.1 总结 30 4
5.2 展望 31 4
主要参考文献 32 4
致谢 33 4
1 绪论 2
1.1 课题研究背景和意义 2
1.2 课题研究现状 3
1.3 本文主要研究内容及结构安排 5
2 混沌系统与 DNA 编码 6
2.1 混沌系统 6
2.1.1 混沌的特性 6
2.1.2 Logistic 映射 6
3.1.1 Chen 超混沌系统 6
(2.2) 7
2.2 DNA 编解码与运算 7
2.2.1 DNA 编码与解码规则 7
8 种编码。 8
表 2.1:DNA 编码解码方式 8
2.2.2 DNA 运算法则 8
表 2.2:DNA 编码方式 1 的加法运算法则 8
表 2.4:DNA 编码规则 4 的异或运算法则 9
3.1 加密算法思想 10
3.2 加密算法具体步骤 11
3.3 解密算法具体步骤 14
3.4 实验仿真及性能分析 15
3.4.1 实验仿真结果 15
3.4.2 直方图分析 16
3.4.3 相邻位置数据值关联性 16
𝑐𝑜𝑣(𝑥, 𝑦) 13
表 3.1:原始图像与密文图像相邻像素相关性对比 13
3.4.4 抗裁剪性能 16
3.4.5 抗噪声性能 18
3.4.6 图像质量评价 19
3.4.7 信息熵 20
表 3.2:原始图像与密文图像信息熵对比 21
3.4.8 密钥敏感性 21
3.4.9 密钥容量 23
4 基于混沌系统与 DCT 变换的图像压缩加密系统 24
4.1 加密算法结构 24
4.4 实验仿真及性能分析 27
4.4.1 实验仿真结果 27
4.4.2 不同压缩比情况下的解密结果 28
4.4.3 密钥敏感性分析 29
4.4.4 密钥容量计算 29
5 总结与展望 30
5.1 总结 30
5.2 展望 31
主要参考文献: 32
致 谢 33
部分代码:
%% 基于混沌系统与DNA编码的彩色数字图像解密系统
% @author:沈洋
% @date:2018.03.20
%-------------------------------------------------------------------------------------------------------%
clear;clc;
I=imread('../原始、加密、解密图片/加密后的lena.png','png'); %读取图像信息
I1=I(:,:,1); %R通道
I2=I(:,:,2); %G通道
I3=I(:,:,3); %B通道
[M,N]=size(I1); %将图像的行列赋值给M,N
t=4; %分块大小
SUM=M*N;
u=3.9999; %密钥1:μ
xx0=0.3883;
xx1=0.4134;
ppx=zeros(1,M+1000); %预分配内存
ppy=zeros(1,N+1000);
ppx(1)=xx0;
ppy(1)=xx1;
for i=1:M+999 %进行M+999次循环,共得到M+1000点(包括初值)ppx(i+1)=u*ppx(i)*(1-ppx(i));
end
for i=1:N+999 %进行M+999次循环,共得到M+1000点(包括初值)ppy(i+1)=u*ppy(i)*(1-ppy(i));
end
ppx=ppx(1001:length(ppx)); %去除前1000点,获得更好的随机性
ppy=ppy(1001:length(ppy));[~,Ux]=sort(ppx,'descend');
[~,Uy]=sort(ppy,'descend');for i=N:-1:1temp = I1(:,i);I1(:,i) = I1(:,Uy(i));I1(:,Uy(i)) = temp;temp = I2(:,i);I2(:,i) = I2(:,Uy(i));I2(:,Uy(i)) = temp;temp = I3(:,i);I3(:,i) = I3(:,Uy(i));I3(:,Uy(i)) = temp;
end
for i=M:-1:1temp = I1(i,:);I1(i,:) = I1(Ux(i),:);I1(Ux(i),:) = temp;temp = I2(i,:);I2(i,:) = I2(Ux(i),:);I2(Ux(i),:) = temp;temp = I3(i,:);I3(i,:) = I3(Ux(i),:);I3(Ux(i),:) = temp;
end
%% 2.产生Logistic混沌序列
% u=3.990000000000001; %密钥敏感性测试 10^-15
%u=3.99;%密钥:Logistic参数μ
% x0=0.7067000000000001; %密钥敏感性测试 10^-16
x0=0.5475; %密钥:Logistic初值x0
% x0=0.3462; %home图片
p=zeros(1,SUM+1000);
p(1)=x0;
for i=1:SUM+999 %进行SUM+999次循环,产生SUM+1000个数据p(i+1)=u*p(i)*(1-p(i));
end
p=p(1001:length(p));%% 3.将p序列变换到0~255范围内整数,转换成M*N的二维矩阵R
p=mod(round(p*10^4),256);
R=reshape(p,N,M)'; %转成M行N列%% 4.求解混沌方程
%求四个初值X0,Y0,Z0,H0
r=(M/t)*(N/t);
% X0=0.5008000000000001; %密钥敏感性测试
X0=0.4953;
Y0=0.4265;
Z0=0.6928;
H0=0.7803;
% X0=0.5056; %home图片
% Y0=0.505;
% Z0=0.4564;
% H0=0.3062;
A=chen_output(X0,Y0,Z0,H0,r);
X=A(:,1);
X=X(3002:length(X));
Y=A(:,2);
Y=Y(3002:length(Y));
Z=A(:,3);
Z=Z(3002:length(Z));
H=A(:,4);
H=H(3002:length(H));%% 5.DNA编码
%X,Y分别决定I和R的DNA编码方式,有8种,1~8
X=mod(round(X*10^4),8)+1;
Y=mod(round(Y*10^4),8)+1;
Z=mod(round(Z*10^4),4);
Z(Z==0)=4; %加减法互换
Z(Z==1)=0;
Z(Z==4)=1;
H=mod(round(H*10^4),8)+1;
e=N/t;
for i=r:-1:2Q1_R=DNA_bian(fenkuai(t,I1,i),H(i));Q1_G=DNA_bian(fenkuai(t,I2,i),H(i));Q1_B=DNA_bian(fenkuai(t,I3,i),H(i));Q1_last_R=DNA_bian(fenkuai(t,I1,i-1),H(i-1));Q1_last_G=DNA_bian(fenkuai(t,I2,i-1),H(i-1));Q1_last_B=DNA_bian(fenkuai(t,I3,i-1),H(i-1));Q2_R=DNA_yunsuan(Q1_R,Q1_last_R,Z(i)); %扩散前Q2_G=DNA_yunsuan(Q1_G,Q1_last_G,Z(i));Q2_B=DNA_yunsuan(Q1_B,Q1_last_B,Z(i));Q3=DNA_bian(fenkuai(t,R,i),Y(i));Q4_R=DNA_yunsuan(Q2_R,Q3,Z(i));Q4_G=DNA_yunsuan(Q2_G,Q3,Z(i));Q4_B=DNA_yunsuan(Q2_B,Q3,Z(i));xx=floor(i/e)+1;yy=mod(i,e);if yy==0xx=xx-1;yy=e;endI1((xx-1)*t+1:xx*t,(yy-1)*t+1:yy*t)=DNA_jie(Q4_R,X(i));I2((xx-1)*t+1:xx*t,(yy-1)*t+1:yy*t)=DNA_jie(Q4_G,X(i));I3((xx-1)*t+1:xx*t,(yy-1)*t+1:yy*t)=DNA_jie(Q4_B,X(i));
end
Q5_R=DNA_bian(fenkuai(t,I1,1),H(1));
Q5_G=DNA_bian(fenkuai(t,I2,1),H(1));
Q5_B=DNA_bian(fenkuai(t,I3,1),H(1));Q6=DNA_bian(fenkuai(t,R,1),Y(1));Q7_R=DNA_yunsuan(Q5_R,Q6,Z(1));
Q7_G=DNA_yunsuan(Q5_G,Q6,Z(1));
Q7_B=DNA_yunsuan(Q5_B,Q6,Z(1));I1(1:t,1:t)=DNA_jie(Q7_R,X(1));
I2(1:t,1:t)=DNA_jie(Q7_G,X(1));
I3(1:t,1:t)=DNA_jie(Q7_B,X(1));Q_jiemi(:,:,1)=uint8(I1);
Q_jiemi(:,:,2)=uint8(I2);
Q_jiemi(:,:,3)=uint8(I3);%% 6、去除加密时补的零
M1=0; %加密时补零的参数,M1=mod(M,t);作为密钥
N1=0; %加密时补零的参数,N1=mod(N,t);作为密钥
if M1~=0Q_jiemi=Q_jiemi(1:M-t+M1,:,:);
end
if N1~=0Q_jiemi=Q_jiemi(:,1:N-t+N1,:);
endfigure;imhist(Q_jiemi(:,:,1));
figure;imhist(Q_jiemi(:,:,2));
figure;imhist(Q_jiemi(:,:,3));%比较解密后的图与原图是否完全相同
%II=imread('../原始、加密、解密图片/lena.png','png');
%cha=sum(sum(sum(Q_jiemi-II))); %两幅图做差后求总和
%% 保存图片imwrite(Q_jiemi,'../原始、加密、解密图片/解密后的lena.png','png');
disp('您输入的解密密钥为:');
disp(['密钥1:μ=',num2str(u),' 密钥2:x0=',num2str(x0),' 密钥3:x(0)=',num2str(X0),' 密钥4:y(0)=',num2str(Y0),' 密钥5:z(0)=',num2str(Z0),]);
disp(['密钥6:h(0)=',num2str(H0),' 密钥7:M1=',num2str(M1),' 密钥8:N1=',num2str(N1),' 密钥9:xx0=',num2str(xx0),' 密钥10:xx1=',num2str(xx1)]);
disp('解密完成');
figure;imshow(Q_jiemi);
%title('解密后图片');