Question
MATLAB. Step-by-step solution with NEAT handwriting and supplementary explanations please. Thank you so much. Create a function called encrypt that accepts a string as input,
MATLAB. Step-by-step solution with NEAT handwriting and supplementary explanations please. Thank you so much.
Create a function called encrypt that accepts a string as input, & returns the encrypted string & the key as outputs.
The encryption algorithm is as follows:
- Generate a random integer between 1-127. This is the key (e.g. key= 10)
- Shift the ASCII code value of all characters in the string by an amount equal to the key plus the
index # of the character in the string (so the code of the 1st char in the string will be shifted by key + 1,
the second by key + 2, and so on).
- Before converting the code values back to char, use a -modulo arithmetic approach to ensure that all the
adjusted values are in the ASCII code range (1 to 127)if the new ASCII value is >=127, -127 to get the new value.
(Note: a standard clock is a modulo-12 device w respect to hrs.) The built-in mod func may be used to accomplish this.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started