【图像加密】基于低对称密码算法实现图像加密解密附matlab代码

简介: 【图像加密】基于低对称密码算法实现图像加密解密附matlab代码

✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

更多Matlab仿真内容点击👇

智能优化算法       神经网络预测       雷达通信      无线传感器        电力系统

信号处理              图像处理               路径规划       元胞自动机        无人机

⛄ 内容介绍

Since devices in the Wireless Sensor Network (WSN) are usually small in size, resource constraint is one of the critical issues that needs to be taken into consideration. In this paper, a low-complexity symmetric cryptographic algorithm, denoted as Secure Force (SF), is proposed. It is developed based on the Feistel structure, and the encryption part can be implemented by using a simple architecture that only consists of basic mathematical operations (AND, OR, XOR, XNOR, shifting, swapping). This can help to reduce the burden on encoder, because the more complex key expansion process is only carried out at the decoder. Besides confusion and diffusion of data, different substitution and permutation techniques are also included to complex the cipher. The proposed algorithm is also compared to several existing algorithms in terms of architecture, flexibility, and security.

⛄ 部分代码


% Performance Evaluation of Secure Force Symmetric Key Algorithm

% CCIS Springer 2015


%% Citation 2

% Ebrahim, Mansoor, and Chai Wai Chong.

% "Secure Force: A low-complexity cryptographic algorithm for Wireless Sensor Network (WSN)." Control System, Computing and Engi-neering (ICCSCE), 2013 IEEE International Conference on. IEEE, 2013.


clc

clear all

close all

tic

addpath subFunctions

% Data=imread('images\cameraman.tif');

% Data=imread('images\rice.tif');

% Data=imread('images\Lena.jpg');

% Data=imread('images\football.jpg');

Data=imread('images\onion.png');

% Data=imread('images\ORLFace.jpg');

[row,col,dim]=size(Data);

if (dim>1)

Data=rgb2gray(Data); % convert into grayscale if input image is a color image

end


%% Scalling and Convertion to binary

% Scalling to convert image into array of 8-pixels; each pixel is of 8 bits

% therefore 8 pixel will be equals to 64 bit of data

[Data,padding]=Scalling(Data,8);

Data_binary=convert2bin(Data);


%% Key Selection and Expansion

% Input the key in the form of 133457799bbcdff1

hex_key = '133457799bbcdff1';

[bin_key] = Hex2Bin( hex_key );

[K1,K2,K3,K4,K5]=SF_Key_Gen(bin_key);


%% Encryption and Decryption

orignal_msg=[];

 encrypt_msg=[];

 decrypt_msg=[];

for i=1:size(Data_binary,1)

   orignal=Data_binary(i,:);

   tic

   [cipher]=SF_Encrypt(orignal,K1,K2,K3,K4,K5);

   encryption_time(i)=toc;

   [plaintext]=SF_Decryption(cipher,K1,K2,K3,K4,K5);

 encrypt_msg(:,i)=Binary2Dec(cipher);

 decrypt_msg(:,i)=Binary2Dec(plaintext);

end


if (padding~=0)

   Data=reshape(Data,[size(Data,1)*size(Data,2) 1]);

   Data=Data(1:end-padding);

   encrypt_msg=reshape(encrypt_msg,[size(encrypt_msg,1)*size(encrypt_msg,2) 1]);

   encrypt_msg=encrypt_msg(1:end-padding);

   decrypt_msg=reshape(decrypt_msg,[size(decrypt_msg,1)*size(decrypt_msg,2) 1]);

   decrypt_msg=decrypt_msg(1:end-padding);

end


%% Converting the Vectors into Images

Orignal=uint8(reshape(Data,[row,col]));

Encrypted=uint8(reshape(encrypt_msg,[row,col]));

Decrypted=uint8(reshape(decrypt_msg,[row,col]));

figure

subplot(1,3,1)

imshow(Orignal)

title('Orignal')

subplot(1,3,2)

imshow(Encrypted)

title('Encrypted')

subplot(1,3,3)

imshow(Decrypted)

title('Decrypted')

figure

subplot(2,1,1)

imhist(Orignal);

subplot(2,1,2)

imhist(Encrypted);

display('Done');

toc


%% Calculating the Encrypted and Orignal image's Entropy

Y=(imhist(Encrypted)+0.00001)/(row*col);

Y=-sum(Y.*log2(Y));

X=(imhist(Orignal)+0.00001)/(row*col);

X=-sum(X.*log2(X));

Re=[X Y]

⛄ 运行结果

⛄ 参考文献

Secure Force: A low-complexity cryptographic algorithm for Wireless Sensor Network (WSN)." Control System, Computing and Engi-neering (ICCSCE), 2013 IEEE International Conference on. IEEE, 2013.

⛳️ 代码获取关注我

❤️部分理论引用网络文献,若有侵权联系博主删除
❤️ 关注我领取海量matlab电子书和数学建模资料

🍅 仿真咨询

1.卷积神经网络(CNN)、LSTM、支持向量机(SVM)、最小二乘支持向量机(LSSVM)、极限学习机(ELM)、核极限学习机(KELM)、BP、RBF、宽度学习、DBN、RF、RBF、DELM实现风电预测、光伏预测、电池寿命预测、辐射源识别、交通流预测、负荷预测、股价预测、PM2.5浓度预测、电池健康状态预测、水体光学参数反演、NLOS信号识别、地铁停车精准预测、变压器故障诊断
2.图像识别、图像分割、图像检测、图像隐藏、图像配准、图像拼接、图像融合、图像增强、图像压缩感知
3.旅行商问题(TSP)、车辆路径问题(VRP、MVRP、CVRP、VRPTW等)、无人机三维路径规划、无人机协同、无人机编队、机器人路径规划、栅格地图路径规划、多式联运运输问题、车辆协同无人机路径规划
4.无人机路径规划、无人机控制、无人机编队、无人机协同、无人机任务分配
5.传感器部署优化、通信协议优化、路由优化、目标定位
6.信号识别、信号加密、信号去噪、信号增强、雷达信号处理、信号水印嵌入提取、肌电信号、脑电信号
7.生产调度、经济调度、装配线调度、充电优化、车间调度、发车优化、水库调度、三维装箱、物流选址、货位优化
8.微电网优化、无功优化、配电网重构、储能配置
9.元胞自动机交通流 人群疏散 病毒扩散 晶体生长


相关文章
|
9月前
|
机器学习/深度学习 算法 机器人
【水下图像增强融合算法】基于融合的水下图像与视频增强研究(Matlab代码实现)
【水下图像增强融合算法】基于融合的水下图像与视频增强研究(Matlab代码实现)
781 0
|
9月前
|
机器学习/深度学习 算法 机器人
使用哈里斯角Harris和SIFT算法来实现局部特征匹配(Matlab代码实现)
使用哈里斯角Harris和SIFT算法来实现局部特征匹配(Matlab代码实现)
398 8
|
9月前
|
机器学习/深度学习 算法 自动驾驶
基于导向滤波的暗通道去雾算法在灰度与彩色图像可见度复原中的研究(Matlab代码实现)
基于导向滤波的暗通道去雾算法在灰度与彩色图像可见度复原中的研究(Matlab代码实现)
463 8
|
9月前
|
机器学习/深度学习 数据采集 负载均衡
结合多种启发式解码方法的混合多目标进化算法,用于解决带工人约束的混合流水车间调度问题(Matlab代码实现)
结合多种启发式解码方法的混合多目标进化算法,用于解决带工人约束的混合流水车间调度问题(Matlab代码实现)
422 0
|
9月前
|
机器学习/深度学习 人工智能 算法
【基于TTNRBO优化DBN回归预测】基于瞬态三角牛顿-拉夫逊优化算法(TTNRBO)优化深度信念网络(DBN)数据回归预测研究(Matlab代码实现)
【基于TTNRBO优化DBN回归预测】基于瞬态三角牛顿-拉夫逊优化算法(TTNRBO)优化深度信念网络(DBN)数据回归预测研究(Matlab代码实现)
359 0
|
9月前
|
算法 定位技术 计算机视觉
【水下图像增强】基于波长补偿与去雾的水下图像增强研究(Matlab代码实现)
【水下图像增强】基于波长补偿与去雾的水下图像增强研究(Matlab代码实现)
1097 0
|
9月前
|
算法 机器人 计算机视觉
【图像处理】水下图像增强的颜色平衡与融合技术研究(Matlab代码实现)
【图像处理】水下图像增强的颜色平衡与融合技术研究(Matlab代码实现)
294 0
|
9月前
|
新能源 Java Go
【EI复现】参与调峰的储能系统配置方案及经济性分析(Matlab代码实现)
【EI复现】参与调峰的储能系统配置方案及经济性分析(Matlab代码实现)
292 0
|
9月前
|
机器学习/深度学习 编解码 算法
基于OFDM技术的水下声学通信多径信道图像传输研究(Matlab代码实现)
基于OFDM技术的水下声学通信多径信道图像传输研究(Matlab代码实现)
394 8
|
9月前
|
机器学习/深度学习 数据采集 测试技术
基于CEEMDAN-VMD-BiLSTM的多变量输入单步时序预测研究(Matlab代码实现)
基于CEEMDAN-VMD-BiLSTM的多变量输入单步时序预测研究(Matlab代码实现)
349 8