Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB without using built in caesar function 5. (Substitution Cipher) A substitution cipher is a more complicated way to encrypt text than a Caesar cipher.

MATLAB

without using built in caesar function

image text in transcribed

5. (Substitution Cipher) A substitution cipher is a more complicated way to encrypt text than a Caesar cipher. The basic version of a substitution cipher converts each given character in a message by permuting the letters of the alphabet based on a fixed permutation. The permutation itself can be simply viewed as a permutation of the numbers 1 through 26. Any permutation of these numbers can easily be represented by vector of length 26 consisting of the integers from 1 to 26, each appearing exactly once. For instance, the vector [2, 3, 4, 5, 26, 1] represents the permutation that converts 1 to 2, 2 to 3, ..., 25 to 26, and 26 to 1. For this problem, you should write two separate functions: the first handles the con- version of just a single character while the second works on a string of length 3. . subs_char Function: Input Variables: a single character to be converted using the substitution cypher a permutation (as described above) to be used in the encryption Output variables: a single character of encrypted text subs_cipher Function: Input Variables: a length 3 string of lower case letters representing a short plain text message a permutation (as described above) to be used in the encryption Output variables: a length 3 string representing the results of the encryption . Hint: For the subs_char function, you'll need to convert the character to a number between 1 and 26 and use this as an index in the permutation vector. A possible sample case is: >> cchar = subs_char('a', [2:26, 1]) cchar = b >> ctext = subs_cipher('abc', [ 5, 7, 1, 2:4, 6, 8:26 ]) ctext = ega >> ctext = subs_cipher('abc', randperm (26)) ctext = gts

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

More Books

Students also viewed these Databases questions

Question

What are Fringe Benefits ? List out some.

Answered: 1 week ago