Caesar cipher matlab code
古いコメントを表示
Can anyone write a very basic code for caesar cipher that shifts input characters by 5 place?
1 件のコメント
James Tursa
2022 年 8 月 25 日
What have you done so far? What specific problems are you having with your code?
採用された回答
その他の回答 (1 件)
cc5('HELLO')
cc5('ABCXYZ')
function out = cc5(in)
TT('A':'Z') = ['F':'Z', 'A':'E'];
out = TT(in);
end
2 件のコメント
Md. Atiqur Rahman
2022 年 8 月 27 日
編集済み: Walter Roberson
2022 年 8 月 27 日
Walter Roberson
2022 年 8 月 27 日
Your Plaintext is a vector of characters. Plaintext+Shift <= 90 would be a vector. When you if a vector, the result is considered true only if all of the values in the vector are non-zero. So your Plaintext+Shift <= 90 test would be true only if all of the characters where no more than 'U'
You should investigate logical indexing.
カテゴリ
ヘルプ センター および File Exchange で Encryption / Cryptography についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!