Hello, I have tried to use the normal procedures of Hill Cipher techniques in encrypting the Image. Please,assist me
close all; clear;clc; workspace;text = imread('lena.bmp');text = double(text);[m,n]=size(text);text=reshape(text,1,m*n);key = [2 3;1 4]; %key
kinverse= [6 15; 5 16];%inverse matrix
[ new_code,original_image ] = encrypt_decrypt( key,keyinverse,text );figure(1),imshow(new_code);figure(2),imshow(original_image);
my encryption decryption function is
function [ new_code,original_image ] = encrypt_decrypt( k,kinv, text )a=reshape(a,2,(length(text))/2); %convert to two rows
code=mod(k*(a),256);new_code=reshape(code,1,length(text)); %reshape to one row
new_code=uint8(new_code); new_code=reshape(new_code,m,n);text2=new_code;a =double(text2);text2=reshape(text2,1,m*n);b=reshape(a,2,length(text2)/2);msg=mod(k*(b),256);new_msg=reshape(msg,1,length(text2));original_image=uint8(new_msg); original_image=reshape(original_image,m,n);end
Best Answer