stegoimage.zip

  • cbse
    了解作者
  • matlab
    开发工具
  • 336KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 0
    下载次数
  • 2021-02-25 14:06
    上传日期
nevunobieonwa ubuwef heu e
stegoimage.zip
  • stegoimage
  • sec_en_img.png
    292.4KB
  • Image_to_Text_Decryption.fig
    40.7KB
  • Image_to_Text_Decryption.m
    8.1KB
内容介绍
function varargout = Image_to_Text_Decryption(varargin) % IMAGE_TO_TEXT_DECRYPTION MATLAB code for Image_to_Text_Decryption.fig % IMAGE_TO_TEXT_DECRYPTION, by itself, creates a new IMAGE_TO_TEXT_DECRYPTION or raises the existing % singleton*. % % H = IMAGE_TO_TEXT_DECRYPTION returns the handle to a new IMAGE_TO_TEXT_DECRYPTION or the handle to % the existing singleton*. % % IMAGE_TO_TEXT_DECRYPTION('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in IMAGE_TO_TEXT_DECRYPTION.M with the given input arguments. % % IMAGE_TO_TEXT_DECRYPTION('Property','Value',...) creates a new IMAGE_TO_TEXT_DECRYPTION or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before Image_to_Text_Decryption_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to Image_to_Text_Decryption_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 Image_to_Text_Decryption % Last Modified by GUIDE v2.5 20-Feb-2021 02:12:04 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @Image_to_Text_Decryption_OpeningFcn, ... 'gui_OutputFcn', @Image_to_Text_Decryption_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT % --- Executes just before Image_to_Text_Decryption is made visible. function Image_to_Text_Decryption_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 Image_to_Text_Decryption (see VARARGIN) % Choose default command line output for Image_to_Text_Decryption handles.output = hObject; % Update handles structure guidata(hObject, handles); movegui(gcf,'center') % UIWAIT makes Image_to_Text_Decryption wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = Image_to_Text_Decryption_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 select_encrypted_image_btn. function select_encrypted_image_btn_Callback(hObject, eventdata, handles) [filename,path] = uigetfile('*.png;*.jpg','Select Stego Image'); if isequal(filename,0) else stego_image = imread(strcat(path,filename)); axes(handles.stego_img_axes); resized_img = imresize(stego_image,[400,400]); imshow(resized_img); end % --- Executes on button press in do_first_decryption_msg_btn. function do_first_decryption_msg_btn_Callback(hObject, eventdata, handles) greenRecover_Callback(hObject, eventdata, handles) % --- Executes on button press in do_second_decryption_msg_btn. function do_second_decryption_msg_btn_Callback(hObject, eventdata, handles) choice = get(handles.algo_popup, 'Value'); if choice==1 msgbox('Please select algorithm','Error'); elseif choice==2 imageToTextDecryption_LSB(hObject, eventdata, handles) else play_fair_method_decryption(hObject, eventdata, handles) end function greenRecover_Callback(hObject, eventdata, handles) recoveredImage = zeros(400); size = length(recoveredImage); stego_img = getimage(handles.stego_img_axes); for p = 1:size for q = 1:size if(mod(stego_img(p,q,2),2) == 1) recoveredImage(p,q) = 1; else recoveredImage(p,q) = 0; end end end recoveredImage = expand(recoveredImage); axes(handles.decrypted_gray_axes); imshow(recoveredImage); %--------------Encryption image to text LSB algorithm--------------- function imageToTextDecryption_LSB(hObject, eventdata, handles) load('data.mat'); input_image = getimage(handles.stego_img_axes); % Get height and width for traversing through the image height = size(input_image, 1); width = size(input_image, 2); % Number of characters of the hidden text chars = msgLength; % Number of bits in the message message_length = chars * 8; % counter to keep track of number of bits extracted counter = 1; % Traverse through the image for i = 1 : height for j = 1 : width % If more bits remain to be extracted if (counter <= message_length) % Store the LSB of the pixel in extracted_bits extracted_bits(counter, 1) = mod(double(input_image(i, j)), 2); % Increment the counter counter = counter + 1; end end end % Powers of 2 to get the ASCII value from binary binValues = [ 128 64 32 16 8 4 2 1 ]; % Get all the bits in 8 columned table % Each row is the bits of the character % in the hidden text binMatrix = reshape(extracted_bits, 8,(message_length/8)); % Convert the extracted bits to characters % by multiplying with powers of 2 textString = char(binValues*binMatrix); % Print the hidden text set(handles.decrypted_msg_txt, 'String', textString); pause(5); set(handles.decrypted_msg_txt, 'String', ''); %-----------------Play Fair decryption --------------- function play_fair_method_decryption(hObject, eventdata, handles) key = 12; stego_img = getimage(handles.stego_img_axes); B = stego_img(:,:,1); [piclngth pichght] = size(B); % Choose the top page. dim1 = piclngth-2; dim2 = pichght-3; keyb = key(end:-1:1); rows = cumsum(double(key)); columns = cumsum(double(keyb)); A = zeros(dim1,dim2); % This matrix houses the hiding points. A = crtmtrx(A,rows,columns,dim1,dim2,key); idx = find(A==1); msgmat = zeros(1000,7); for vv = 1:1000 % This is the decoder. for uu = 1:7 if rem(B(idx(uu+7*(vv-1))),2)==1 msgmat(vv,uu) = 1; end end end msg = char(bin2dec(num2str(msgmat)))'; set(handles.decrypted_msg_txt, 'String', msg); pause(5); set(handles.decrypted_msg_txt, 'String', ''); % --- Executes on selection change in algo_popup. function algo_popup_Callback(hObject, eventdata, handles) % hObject handle to algo_popup (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = cellstr(get(hObject,'String')) returns algo_popup contents as cell array % contents{get(hObject,'Value')} returns selected item from algo_popup % --- Executes during object creation, after setting all properties. function algo_popup_CreateFcn(hObject, eventdata, handles) % hObject handle to algo_popup (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB
评论
    相关推荐
    • AES.rar
      new algo for sec for lifi with matlab
    • AES.zip
      AES的开源代码,并附有详细注释,适合新人学习
    • AES.zip
      通过verilog来实现aes算法的加密和解密
    • AES.rar
      实现加解密操作,实现基本的aes加解密操作,采用C语言实现aes方式的加解密
    • AES.zip
      对字符进行加解密,实现在C++情况下的字符加解密过程
    • AES源码
      AES算法实现的源码,对密码感兴趣的可以看看
    • 基于verilog hdl的AES加密
      包括源码在内完整的quartus2工程都在压缩包内,可以直接再quartus2中运行
    • AES.rar
      用C实现了AES简单加解密,平台:VS2010
    • AES.rar
      Aes算法加密解密,包含过程详解。。。。。。
    • AES.rar
      AES-128加密流程可以使用如下伪代码表示