decryption text using hill cipher

9 ビュー (過去 30 日間)
noora Hani
noora Hani 2021 年 2 月 28 日
コメント済み: Walter Roberson 2021 年 2 月 28 日
hi what is the wrong in program , why inverse of key equal zero
clc;
clear all;
close all;
k=[17 17 5; 21 18 21;2 2 19];
c=input('enter theciphertext','s');
c=upper(c);
x=length(c);
d=mod(det(k),26);
a=[1 3 5 7 9 11 15 17 19 21 23 25];
b=[1 9 21 15 3 19 7 23 11 5 17 25];
s=0;
for i=1:12
if a(i)==d;
s=i;
end
end
id=b(s);
adj=round(inv(k)*d);
adj=mod(adj,26);
ik=mod(adj*id,26);
for i=1:3:x
r=double(c(i:i+2))'-65;
p(i:i+2)=mod(ik*r,26);
end
p=char(p+97);
  1 件のコメント
Walter Roberson
Walter Roberson 2021 年 2 月 28 日
what is a sample input and expected output?

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeEncryption / Cryptography についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by