💥💥💞💞欢迎来到本博客❤️❤️💥💥
🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。
⛳️座右铭:行百里者,半于九十。
📋📋📋本文目录如下:🎁🎁🎁
目录
⛳️赠与读者
👨💻做科研,涉及到一个深在的思想系统,需要科研者逻辑缜密,踏实认真,但是不能只是努力,很多时候借力比努力更重要,然后还要有仰望星空的创新点和启发点。当哲学课上老师问你什么是科学,什么是电的时候,不要觉得这些问题搞笑。哲学是科学之母,哲学就是追究终极问题,寻找那些不言自明只有小孩子会问的但是你却回答不出来的问题。建议读者按目录次序逐一浏览,免得骤然跌入幽暗的迷宫找不到来时的路,它不足为你揭示全部问题的答案,但若能让人胸中升起一朵朵疑云,也未尝不会酿成晚霞斑斓的别一番景致,万一它居然给你带来了一场精神世界的苦雨,那就借机洗刷一下原来存放在那儿的“躺平”上的尘埃吧。
或许,雨过云收,神驰的天地更清朗.......🔎🔎🔎
💥1 概述
一、研究背景与意义
随着信息技术的飞速发展,数字图像作为信息的重要载体,其安全性问题日益凸显。传统的图像加密方法,如对称密码算法和差分传输技术等,存在密钥空间小、安全性不足等问题,已难以满足当前的安全需求。因此,研究新的图像加密算法,提高图像加密的安全性和抗攻击能力,具有重要的现实意义。
二、相关技术基础
- DNA计算:DNA计算具有天然的并行性和信息冗余性,适用于图像加密中的信息编码和混淆。通过构建DNA序列与二进制序列之间的映射关系,可以将图像的二进制序列转化为DNA序列进行存储和传输,从而增强信息的保密性和隐蔽性。DNA编码运算包括DNA序列的编码、解码以及基于DNA序列的运算等。
- 混沌系统:混沌系统是一类具有不可预测性和高度敏感性的非线性动力系统,适用于图像加密。其随机性可以生成具有高度复杂性和随机性的序列,这些序列可以作为加密密钥,增加加密算法的随机性和不可预测性。同时,混沌系统对初始条件极为敏感,即使初始条件有微小的变化,也会导致系统行为的巨大差异。这一特性使得混沌系统能够生成大量不同的密钥,从而增加加密算法的安全性。
- 哈希函数:哈希函数是一种将任意长度的数据映射为固定长度数据的函数。在图像加密中,哈希函数可以用于生成图像的哈希值,作为图像的唯一标识。同时,哈希函数也可以用于更新混沌系统的初值和控制参数,使得混沌序列具有更好的随机性。
三、混合模型设计
-
加密算法设计:
- 首先,利用混沌系统生成伪随机密钥流,控制置乱和扩散过程中DNA操作的节点和长度。
- 然后,对编码后的图像使用DNA操作进行置乱和扩散,如DNA剪切、插入、连接等操作。
- 同时,引入哈希函数生成图像的哈希值,用于更新混沌系统的初值和控制参数,进一步增加密钥的复杂性和随机性。
-
解密算法设计:
- 解密过程是加密过程的逆过程。首先,使用相同的哈希函数和混沌系统生成解密所需的密钥和参数。
- 然后,对加密后的图像进行逆DNA操作,如逆剪切、逆插入、逆连接等,以恢复原始图像的像素值。
- 最后,对恢复后的图像进行必要的后处理,如去噪、增强等,以提高图像的质量。
四、实验验证与性能分析
- 实验设置:选择标准的图像数据集进行实验,包括灰度图像和彩色图像。同时,设置不同的加密轮数和像素块大小,以观察算法的性能变化。
- 安全性分析:通过仿真实验,分析算法对穷举攻击、统计攻击及差分攻击的抵抗能力。同时,计算算法的密钥空间,以评估其安全性。
- 性能评估:计算加密前后图像的熵值、像素相关性等指标,以评估算法的加密效果。同时,比较算法与其他图像加密算法的加密速度和解密速度,以评估其实时性。
五、结论与展望
本研究设计了一种基于DNA计算、混沌系统和哈希函数混合模型的图像加密算法。通过实验验证,该算法在图像熵、像素相关性和图像复杂性等方面表现出较好的性能。同时,该算法具有较高的安全性和实用性,可广泛应用于数字图像通信、医学图像处理、军事保密通信等领域。未来,可以进一步研究该算法在其他领域的应用,以扩展其实际应用价值。
📚2 运行结果
部分代码:
%********** Decryption **********
tic
KeyDecimal = HashtoDecimal(KeyHex,HashPlainImage);
KeyFeature = ExtractKeyFeature(KeyDecimal);
KeyImage = KeyDNA5HyperchaoticSystem(M,N,KeyDecimal,KeyFeature);
DecImg=Decryption(EncImg,KeyImage,KeyDecimal,KeyFeature,M,N);
tDec=toc;
fprintf('\nDecryption Time = %f',tDec);
figure('Name','Plain, Cipher and Decrypted Image')
subplot(2,3,1),imshow(uint8(PlainImg)), title('Plain Image');
subplot(2,3,2),imshow(uint8(EncImg)), title('Cipher Image');
subplot(2,3,3),imshow(uint8(DecImg)), title('Decrypted Image');
subplot(2,3,4),imhist(uint8(PlainImg)), title('Histogram of Plain Image');
subplot(2,3,5),imhist(uint8(EncImg)), title('Histogram of Cipher Image');
subplot(2,3,6),imhist(uint8(DecImg)), title('Histogram of Decrypted Image');
%********** Test Parameter **********
DifPlainDec=sum(uint8(PlainImg(:))-uint8(DecImg(:)));
fprintf('\nPlainImage - DecryptedImage = %d',DifPlainDec);
PlainImg_Entropy = Entropy(PlainImg,N);
fprintf('\nPlainImage Entropy = %f',PlainImg_Entropy);
EncImg_Entropy = Entropy(EncImg,N);
fprintf('\nCipherImage Entropy = %f',EncImg_Entropy);
fprintf('\nCorrelation Coefficient:\n');
CC=AdjancyCorrPixelRand(PlainImg,EncImg);
disp(CC);
%% ****************************************************************************
% Test NPCR and UACI for 1 bit change in Plain Image
fprintf('\nTest NPCR and UACI for 1 bit change in Plain Image...')
PlainImg1bit=PlainImg;
PlainImg1bit=double(PlainImg1bit);
pos1=1+floor(rand(1)*M);
pos2=1+floor(rand(1)*M);
pos3=1+floor(rand(1)*M);
pos4=1+floor(rand(1)*M);
fprintf('\nBefore change 1 bit of PlainImage at location (%d,%d) = %d',pos1,pos2,PlainImg1bit(pos1,pos2));
PlainImg1bit(pos1,pos2) =mod(PlainImg1bit(pos1,pos2)+1,255);
fprintf('\nAfter change 1 bit of PlainImage at location (%d,%d) = %d',pos1,pos2,PlainImg1bit(pos1,pos2));
HashPlainImage1bit = HashSumRowSumCol(PlainImg1bit,KeyHex);
KeyDecimal1bit = HashtoDecimal(KeyHex,HashPlainImage1bit);
KeyFeature1bit = ExtractKeyFeature(KeyDecimal1bit);
KeyImage1bit = KeyDNA5HyperchaoticSystem(M,N,KeyDecimal1bit,KeyFeature1bit);
EncImg1bit=Encryption(PlainImg1bit,KeyImage1bit,KeyDecimal1bit,KeyFeature1bit,M,N);
DecImg1bit=Decryption(EncImg1bit,KeyImage1bit,KeyDecimal1bit,KeyFeature1bit,M,N);
[npcr1, uaci1]= NPCR_UACI(uint8(EncImg),uint8(EncImg1bit));
fprintf('\nNPCR = %f UACI=%f \n',npcr1, uaci1);
% show
figure('Name','NPCR and UACI for 1 bit change in Plain Image ')
subplot(2,3,1),imshow(uint8(PlainImg1bit)), title('Plain Image 1 bit');
subplot(2,3,2),imshow(uint8(EncImg1bit)), title('Chiper Image 1 bit');
subplot(2,3,3),imshow(uint8(DecImg1bit)), title('Decryped Image 1 bit');
subplot(2,3,4),imhist(uint8(PlainImg1bit)), title('Histogram of Plain Image 1 bit');
subplot(2,3,5),imhist(uint8(EncImg1bit)), title('Histogram of Chiper Image 1 bit');
subplot(2,3,6),imhist(uint8(DecImg1bit)), title('Histogram of Decryped Image 1 bit');
%%
% Test NPCR and UACI for 2 bit change in Plain Image
fprintf('\nTest NPCR and UACI for 2 bit change in Plain Image...')
PlainImg2bit=PlainImg;
PlainImg2bit=double(PlainImg2bit);
fprintf('\nBefore change 2 bit of PlainImage at location (%d,%d) = %d',pos1,pos2,PlainImg2bit(pos1,pos2));
fprintf('\nAfter change 2 bit of PlainImage at location (%d,%d) = %d',pos3,pos4,PlainImg2bit(pos3,pos4));
PlainImg2bit(pos1,pos2) =mod(PlainImg2bit(pos1,pos2)+1,255);
PlainImg2bit(pos3,pos4) = mod(PlainImg1bit(pos3,pos4)-1,255);
fprintf('\nAfter change 2 bit of PlainImage at location (%d,%d) = %d',pos1,pos2,PlainImg2bit(pos1,pos2));
fprintf('\nAfter change 2 bit of PlainImage at location (%d,%d) = %d',pos3,pos4,PlainImg2bit(pos3,pos4));
HashPlainImage2bit = HashSumRowSumCol(PlainImg2bit,KeyHex);
KeyDecimal2bit = HashtoDecimal(KeyHex,HashPlainImage2bit);
KeyFeature2bit = ExtractKeyFeature(KeyDecimal2bit);
KeyImage2bit = KeyDNA5HyperchaoticSystem(M,N,KeyDecimal2bit,KeyFeature2bit);
EncImg2bit=Encryption(PlainImg2bit,KeyImage2bit,KeyDecimal2bit,KeyFeature2bit,M,N);
DecImg2bit=Decryption(EncImg2bit,KeyImage2bit,KeyDecimal2bit,KeyFeature2bit,M,N);
[npcr2, uaci2]= NPCR_UACI(uint8(EncImg),uint8(EncImg2bit));
fprintf('\nNPCR = %f UACI=%f \n',npcr2, uaci2);
% show
figure('Name','NPCR and UACI for 2 bit change in Plain Image ')
subplot(2,3,1),imshow(uint8(PlainImg2bit)), title('Plain Image 2 bit');
subplot(2,3,2),imshow(uint8(EncImg2bit)), title('Chiper Image 2 bit');
subplot(2,3,3),imshow(uint8(DecImg2bit)), title('Decryped Image 2 bit');
subplot(2,3,4),imhist(uint8(PlainImg2bit)), title('Histogram of Plain Image 2 bit');
subplot(2,3,5),imhist(uint8(EncImg2bit)), title('Histogram of Chiper Image 2 bit');
subplot(2,3,6),imhist(uint8(DecImg2bit)), title('Histogram of Decryped Image 2 bit');
%% Cropping attack
fprintf('\nCropping attack...')
EncImgCrop=EncImg;
if Crop==2
EncImgCrop(1:512, 1:256)=0;
elseif Crop==4
EncImgCrop(1:256, 1:256)=0;
elseif Crop==16
EncImgCrop(1:128, 1:128)=0;
end
DecImgCrop=Decryption(EncImgCrop,KeyImage,KeyDecimal,KeyFeature,M,N);
PSNRCrop=psnr(uint8(DecImgCrop),uint8(PlainImg));
fprintf('\nCrop=1/%d, PSNR of cropped cipher image = %f \n',Crop,PSNRCrop);
figure('Name','Cropping attack and Noise attack ')
subplot(2,2,1), imshow(uint8(EncImgCrop)), title('Cropted Chiper Image ');
subplot(2,2,2), imshow(uint8(DecImgCrop)), title('Decryped Cropted Image ');
%% Salt and pepper noise attack
fprintf('\nSalt and pepper noise attack...')
EncImgNoise=double(imnoise(uint8(EncImg),'salt & pepper',NoiseLevel));
DecImgNoise=Decryption(EncImgNoise,KeyImage,KeyDecimal,KeyFeature,M,N);
PSNRnosie=psnr(uint8(DecImgNoise),uint8(PlainImg));
fprintf('\nNoise Level = %f, PSNR of nosiy cipher image = %f \n',NoiseLevel,PSNRnosie);
subplot(2,2,3), imshow(uint8(EncImgNoise)), title('Noisy Chiper Image ');
subplot(2,2,4), imshow(uint8(DecImgNoise)), title('Decryped noisy Image ');
🎉3 参考文献
文章中一些内容引自网络,会注明出处或引用为参考文献,难免有未尽之处,如有不妥,请随时联系删除。(文章内容仅供参考,具体效果以运行结果为准)
[1]粟风永,徐江峰.基于Hash函数和多混沌系统的图像加密算法[J].计算机工程与设计, 2010(1):4.
[2]朱凯歌,武相军,任广龙.基于DNA动态编码和混沌系统的彩色图像无损加密算法[J].计算机应用研究, 2020(S02):230-233.
[3]杨志琴.基于混沌和DNA编码的图像加密研究[D].中央民族大学,2023.
🌈4 Matlab代码实现
资料获取,更多粉丝福利,MATLAB|Simulink|Python资源获取