رمز سزار|متلب

I share my academic life!

رمز سزار|متلب

یکی از روش های ساده برای رمز گذاشتن روی جملات ، رمز سزار هست . که برای درس جبر خطی توی محیط متلب پیادش کردم

 

clear all;close all;clc


% the message that should be encrypted
msg=input('Enter your Text: ','s')
X=double(msg)-65;

l=length(X)

if l<15
e=X(end)
while l<15
    X=[X,e]
    l=l+1
end

end


ex1 = reshape(X,3,5)





%  key

row=input('row')
column=input('column') 
for q=1:row 
    for w=1:column 
        K(q,w)=input('elements : ')
    end 
end
K=reshape(K,row,column)


d=det(K);
if(d==0)
    disp('The key matrix must be non-singular');
  return
end


c=K * ex1

 

Tags: , , , , , , , , ,