Caesar cipher matlab code
26 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Md. Atiqur Rahman
el 25 de Ag. de 2022
Comentada: Walter Roberson
el 31 de Ag. de 2022
Can anyone write a very basic code for caesar cipher that shifts input characters by 5 place?
1 comentario
James Tursa
el 25 de Ag. de 2022
What have you done so far? What specific problems are you having with your code?
Respuesta aceptada
Md. Atiqur Rahman
el 27 de Ag. de 2022
Editada: Walter Roberson
el 28 de Ag. de 2022
10 comentarios
Walter Roberson
el 31 de Ag. de 2022
Output(i) = char(Output(i));
Why are you doing that redundant operation? Yes, you convert to char but you store it in the same array so it would convert back to the same data type.
Output(Output<=58)=32;
Why are you mixing logical indexing of the entire array inside a loop?
Más respuestas (1)
Walter Roberson
el 25 de Ag. de 2022
cc5('HELLO')
cc5('ABCXYZ')
function out = cc5(in)
TT('A':'Z') = ['F':'Z', 'A':'E'];
out = TT(in);
end
2 comentarios
Md. Atiqur Rahman
el 27 de Ag. de 2022
Editada: Walter Roberson
el 27 de Ag. de 2022
Walter Roberson
el 27 de Ag. de 2022
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.
Ver también
Categorías
Más información sobre Encryption / Cryptography en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!