【图像加密】基于ECC进行卫星图像加密的MATLAB 代码
✅作者简介热爱科研的Matlab仿真开发者擅长毕业设计辅导、数学建模、数据处理、程序设计科研仿真。完整代码获取 定制创新 论文复现点击Matlab科研工作室 关注我领取海量matlab电子书和数学建模资料个人信条做科研博学之、审问之、慎思之、明辨之、笃行之是为博学慎思明辨笃行。 内容介绍一、引言卫星图像包含大量敏感信息如地理地貌、军事设施分布等对其进行有效加密至关重要。椭圆曲线密码体制ECC以其高安全性、低计算量和小密钥尺寸等优势在卫星图像加密领域展现出良好的应用前景。本文将深入探讨基于 ECC 的卫星图像加密方法。二、椭圆曲线密码体制ECC基础椭圆曲线定义三、基于 ECC 的卫星图像加密方案设计图像预处理图像分块将卫星图像按一定规则划分为多个小块如 8×8 像素的子块。这样做既便于对图像进行并行处理提高加密效率又能降低单个错误对整幅图像的影响。像素值转换将每个子块的像素值从 RGB 颜色空间转换到灰度空间得到灰度值矩阵。这简化了后续加密计算同时灰度图像能有效保留图像的主要信息。基于 ECC 的加密流程密钥协商发送方和接收方通过 ECC 密钥交换协议如 Diffie - Hellman 密钥交换的椭圆曲线版本协商出共享密钥 K。此共享密钥将用于后续的图像加密操作确保通信双方使用相同的密钥进行加密和解密。加密运算对于每个图像子块的灰度值矩阵将其元素视为椭圆曲线上的点或点的坐标分量。利用协商得到的共享密钥 K结合 ECC 加密算法对这些点进行加密。例如将每个点 P 与共享密钥对应的点 K 进行椭圆曲线加法运算 P′PK得到加密后的点 P′从而实现对图像子块的加密。密文重组将加密后的各个图像子块按照原图像的布局重新组合形成加密后的卫星图像。⛳️ 运行结果 部分代码function [Enc_Msg]Encryption_1(img)a5376; % A constant value selected using ECC Equation. 4*a^327*b^2~0.b2438; % A constant value selected using ECC Equation.p123457; % A prime numberload maptab % A maping table is generated using a, b and p. i.e. (y^2)mod p(x^3a*xb)mod pdisp(the original image);figure,imshow(img);disp(for encryption an image please enter the keys);Kinput(Enter the random key); % Select any random Integer defined by senderNbinput(Enter the Private key); % Selected Recievers private key.G[2225, 75856]; % choose any one Base Point on Eliptical curve.Pbptmulti_mod(G,Nb,a,p); %Public key of RecieverEKptmulti_mod(Pb,K,a,p); %Encryption key% KGptmulti_mod(G,K,a,p); % This key is transmitted with image for B to decrypt the image[rows, coln]size(img); % size of image.mm(0:255); % Intensity matix is used to find the number of repeatation of the particular intensity value.encryp[]; % encrypted image is stored.jj0;hhhwaitbar(0,Wait while encrypting the image...);%% Encryption Processfor i1:rowsfor j1:colnintimg(i,j); % Intensity of pixel.[r,c,v]find(mmint); % find the repeatation of intensity and updated .if v1colc(end); % Intesity positionif col482 % total mapping is 482. and above which mapping is repeated again from first position.mm(r(1),2:end)0;[r,c,v]find(mmint);colc(end);endrowr(1);endQmaptab(row,colc(end):colc(end)1); % ECC points for the particular pixel value mapped from the tableRPtadd_mod(Q,EK,a,p); % point addition using encryption key.[r1,c1,v1]find(maptabR(1));for ii1:length(r1) % pixel intensity is calculated for the new point from the mapping table[r2,c2,v2]find(maptab(r1(ii),c1(ii)1)R(2));if v21break;endendif isempty(r1)||isempty(r2)ii1;r1(ii)150;endencryp(i,j)r1(ii)-1; % New pixel intesity after encryptionmm(row,col1)int; % Intensity matrix is updated i.e old intensity is added hereEnc_Msg(i,jj1:jj2)R; % Encrypted point for the original pixel value.jjj*2;endwaitbar(i/coln)endclose(hhh)img2uint8(reshape(encryp,size(img)));figure,imshow(img2);end 参考文献更多免费数学建模和仿真教程关注领取