日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

【AES图像加解密】基于AES图像加解密算法的MATLAB仿真

發布時間:2025/4/5 编程问答 12 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【AES图像加解密】基于AES图像加解密算法的MATLAB仿真 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1.軟件版本

matlab2013b

2.本算法理論知識

算法的基本流程如下所示:

SubBytes

?S-Box

ShiftRows

Mix Columns

AddRoundKey

?3.核心代碼

function varargout = main(varargin) % MAIN MATLAB code for main.fig % MAIN, by itself, creates a new MAIN or raises the existing % singleton*. % % H = MAIN returns the handle to a new MAIN or the handle to % the existing singleton*. % % MAIN('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in MAIN.M with the given input arguments. % % MAIN('Property','Value',...) creates a new MAIN or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before main_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to main_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % See also: GUIDE, GUIDATA, GUIHANDLES% Edit the above text to modify the response to help main% Last Modified by GUIDE v2.5 28-May-2012 22:27:15% Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ...'gui_Singleton', gui_Singleton, ...'gui_OpeningFcn', @main_OpeningFcn, ...'gui_OutputFcn', @main_OutputFcn, ...'gui_LayoutFcn', [] , ...'gui_Callback', []); if nargin && ischar(varargin{1})gui_State.gui_Callback = str2func(varargin{1}); endif nargout[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); elsegui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT% --- Executes just before main is made visible. function main_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to main (see VARARGIN)% Choose default command line output for main handles.output = hObject;% Update handles structure guidata(hObject, handles);% UIWAIT makes main wait for user response (see UIRESUME) % uiwait(handles.figure1);% --- Outputs from this function are returned to the command line. function varargout = main_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)% Get default command line output from handles structure varargout{1} = handles.output;% --- Executes on button press in pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global Image_RGB;[FileName,PathName] = uigetfile('*.*','選擇圖像'); FullPathName = [PathName,'\',FileName]; Image_RGB = rgb2gray(imread(FullPathName)); Image_RGB = imresize(Image_RGB,[128,128]); axes(handles.axes1); imshow(Image_RGB); % --- Executes on button press in pushbutton2. function pushbutton2_Callback(hObject, eventdata, handles) % hObject handle to pushbutton2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global Image_RGB; global SBOX; global invSBOX; global w; global polys; global invpolys; global images_AES;[rr,cc] = size(Image_RGB); %對RGB三個通道分別進行加密處理 for i = 1:rr/16for j = 1:ccM_data2{i,j} = Image_RGB(16*(i-1)+1:16*i , j,1);end end%設置密鑰 key_hex = {'00' '01' '02' '03' '04' '05' '06' '07' '08' '09' '0a' '0b' '0c' '0d' '0e' '0f'}; %AES初始化[SBOX,invSBOX,w,polys,invpolys] = func_AES_parameter(key_hex); %加密處理 for i = 1:rr/16for j = 1:ccimages_AES{i,j} = func_AES(double(M_data2{i,j}),w,SBOX,polys,1);end end%顯示加密后的圖像 for i = 1:rr/16for j = 1:cctmp = (images_AES{i,j})';iamges_aes(16*(i-1)+1:16*i,j) = double(tmp);end end axes(handles.axes2); imshow(iamges_aes,[]);% --- Executes on button press in pushbutton3. function pushbutton3_Callback(hObject, eventdata, handles) % hObject handle to pushbutton3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global Image_RGB; global SBOX; global invSBOX; global w; global polys; global invpolys; global images_AES;[rr,cc] = size(Image_RGB); %解密處理 for i = 1:rr/16for j = 1:ccimages_deAES{i,j} = func_invAES(images_AES{i,j},w,invSBOX,invpolys,1);end end %顯示解密后的圖像 for i = 1:rr/16for j = 1:cctmp = (images_deAES{i,j})';iamges_deaes(16*(i-1)+1:16*i,j) = double(tmp);end endaxes(handles.axes3); imshow(iamges_deaes,[]);% --- Executes on button press in pushbutton4. function pushbutton4_Callback(hObject, eventdata, handles) % hObject handle to pushbutton4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) clc; clear; close all;

4.操作步驟與仿真結論

AES界面如下所示:

AES加密如下所示:

AES解密如下所示:

5.參考文獻

AES的理論主要依據參考文獻,

?A29-01

6.完整源碼獲得方式

方式1:微信或者QQ聯系博主

方式2:訂閱MATLAB/FPGA教程,免費獲得教程案例以及任意2份完整源碼

總結

以上是生活随笔為你收集整理的【AES图像加解密】基于AES图像加解密算法的MATLAB仿真的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。