This function uses frequency analysis to attack and decode messages
encoded using a /substitution cipher/ which exchanges each letter of the
alphabet for another. Unlike the famous "Caesar Shift" cipher, which
"shifts" the letters of the alphabet along by a certain amount, giving
just 26 possible ciphers, this has no specific order, giving 26!
possibilities. The function is very unlikely to work first time but,
depending of the length of the text, highly likely to get the letters "T"
and "E" correct. From here the user may spot an error in the decoding,
such as "TQE" which is obviously "THE", and the function offers them the
chance to swap the offending letters as often as is required. After a few
simple cases, the encrypted message is generally broken.
It removes all punctuation and case from the original
text. The other m-file can be used to encode messages in the substitution cipher, using a random arrangement of letters and giving the user the cipher key as well as encoded message.
Dafydd Stephenson (2021). Substitution Cipher encoder and decoder (https://www.mathworks.com/matlabcentral/fileexchange/31522-substitution-cipher-encoder-and-decoder), MATLAB Central File Exchange. Retrieved .
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!