Solve first in C++ than design and implement a MIPS program in MARS MIPS simulator, that...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Solve first in C++ than design and implement a MIPS program in MARS MIPS simulator, that performs primitive encryption and decryption of text using simple columnar transposition. Text is assumed to be in ASCII, using 1 byte per character. With this algorithm, the unencrypted text (known as the plaintext) is written horizontally onto a grid of fixed width, and the encrypted text (known as the ciphertext) is read off vertically. Decryption is a matter of writing the ciphertext vertically onto a grid of identical width and then reading the plaintext off horizontally. The grid height is equal to the number of letters divided by the number of columns. The grid width, i.e. the number of columns, is a parameter to this algorithm and represents the secret shared between the two people communicating securely. As an example, if the plaintext is "ATTACKATDAWN" and the grid width of 4, it is written as follows: A с D T K T A A T A W N Reading it vertically will yield the ciphertext "ACDTKATAWATN". To decrypt it, it will have to be written vertically into the same grid (height = 12/4= 3) and read horizontally, to come up with the original plaintext. The above example assumes that the length of 12 characters is an exact multiple of 4, so that a rectangle is perfectly formed. If this is not the case during encryption, the remaining empty cells are filled with random text called "padding". For this task you will use underscores "_" as padding characters. During decryption, the ciphertext length is always an exact multiple of the grid width, otherwise it is considered an error. For example, using the same plaintext as above and a grid width of 5, the grid will be: A T K T W T A N A D с A This will produce the ciphertext "AKWTANTT_AD_CA_". The MIPS program should ask as input the string to encrypt or decrypt, the operation to perform (encryption or decryption), and finally the grid width to use. Then it will print the resulting ciphertext or plaintext, depending on the operation. Make any necessary validation of inputs and print error messages if inputs are invalid (such as negative grid width). Solve first in C++ than design and implement a MIPS program in MARS MIPS simulator, that performs primitive encryption and decryption of text using simple columnar transposition. Text is assumed to be in ASCII, using 1 byte per character. With this algorithm, the unencrypted text (known as the plaintext) is written horizontally onto a grid of fixed width, and the encrypted text (known as the ciphertext) is read off vertically. Decryption is a matter of writing the ciphertext vertically onto a grid of identical width and then reading the plaintext off horizontally. The grid height is equal to the number of letters divided by the number of columns. The grid width, i.e. the number of columns, is a parameter to this algorithm and represents the secret shared between the two people communicating securely. As an example, if the plaintext is "ATTACKATDAWN" and the grid width of 4, it is written as follows: A с D T K T A A T A W N Reading it vertically will yield the ciphertext "ACDTKATAWATN". To decrypt it, it will have to be written vertically into the same grid (height = 12/4= 3) and read horizontally, to come up with the original plaintext. The above example assumes that the length of 12 characters is an exact multiple of 4, so that a rectangle is perfectly formed. If this is not the case during encryption, the remaining empty cells are filled with random text called "padding". For this task you will use underscores "_" as padding characters. During decryption, the ciphertext length is always an exact multiple of the grid width, otherwise it is considered an error. For example, using the same plaintext as above and a grid width of 5, the grid will be: A T K T W T A N A D с A This will produce the ciphertext "AKWTANTT_AD_CA_". The MIPS program should ask as input the string to encrypt or decrypt, the operation to perform (encryption or decryption), and finally the grid width to use. Then it will print the resulting ciphertext or plaintext, depending on the operation. Make any necessary validation of inputs and print error messages if inputs are invalid (such as negative grid width).
Expert Answer:
Answer rating: 100% (QA)
include using namespace std int main string plainText ATTACKATDAWN int grid1 4 grid2 5 val 0 TextS... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
In an experiment, (a) Which variable is assumed to be the causal variable? (b) Which variable is assumed to be caused? (c) Which variable does the researcher manipulate? (d) Which variable occurs...
-
The 1200 KVA, 2,100 V synchronous motor is assumed to be a salient-pole machine with reactance Xdqrn= 1.9 ohm/phase and X= 1.6 ohm/phase. Neglecting all losses, find the maximum mechanical 3-phase...
-
The market portfolio is assumed to be composed of four securities. Their covariances with the market and their proportions follow. Given these data, calculate the market portfolio's standard...
-
Prove that the curves y 2 = 4x and x 2 = 4y divide the by of the squre bounded by x = 0, x = 4, y = 4 and y = 0 into three equal parts.
-
What are the phenotypes and genotypes for the ABO blood groups? If both parents are type AB blood, what are the possible genotypes and phenotypes for their children, including the expected...
-
Who should be responsible for products that do not meet minimum health standards? The owners/operators? Or the workers? Was there something in the employers actions and attitude that drove the...
-
A large company has the opportunity to select one of seven projects-A, B, C, D, E, F, G-or choose the null (donothing) alternative. Each project requires a single initial investment as shown in the...
-
Near the end of 2013, the management of Dimsdale Sports Co., a merchandising company, prepared the following estimated balance sheet for December 31, 2013. To prepare a master budget for January,...
-
Kevin made two investments over the past two years. His first investment wasabaseball card thatcost$50.00,whichhe sold three months later for$55.00.The second wasashare of stockinastart-upcompany....
-
Recall a time when you were involved in a group similar to the Bayside City Tire Companya time when a decision had to be made. What were some of the rules that influenced the process of decision...
-
2. Consider the CCAPM. Let r be the interest rate at which an investor borrows. Assume the investor chooses (co, 01,...,0K) such that K Co + 1 T, AOk = y 1+ k=1 where y is initial wealth. (10) a....
-
A project has 3 years of profits of: 25,000, 35,000 and 15,000. The initial investment was 95,000 (with a disposal value of 5,000). What is the Accounting Rate of Return (ARR) on the project?
-
Sometimes requesting payment or responding to patient inquiries about financial matters can be uncomfortable. Which qualities best describe customer service to you? Cite some examples of how you...
-
(a) What power contact lens is needed to correct the vision of a person who has a near point of 78.0 cm and allows him to see objects 25.0 cm away? (b) If this person has a normal 8.00 % ability to...
-
A new manufacturing plant costs $5,500,000 to build. Operating and maintenance costs are estimated to be $41,000 per year, and a salvage value of 25% of the initial cost is expected. The units the...
-
ina owns a hostel in a large town. She bought a copy machine for $1,700, which has a life expectancy of 40,000 units. In the first year, Tina and her staff copied 800 units. In the second year, they...
-
Please explain which Excel formula you used, the reason behind your choice, and include Excel tables in the solution. An American baseball outfielder s $ 3 2 5 million contract with a baseball firm...
-
Data 9.2 on page 540 introduces the dataset Cereal, which includes information on the number of grams of fiber in a serving for 30 different breakfast cereals. The cereals come from three different...
-
Suppose that a message has been encrypted using DES in counter mode. One bit of cipher text in block C i is accidentally transformed from a 0 to a 1 during transmission. How much plain text will be...
-
While IP addresses are tried to specific networks, Ethernet addresses are not. Can you think of a good reason why they are not?
-
Alice wants to send a message to Bob using SHA-1 hashes. She consults with you regarding the appropriate signature algorithm to be used. What would you suggest?
-
For the pediatrician presented in Example 1, find the probability that a randomly selected three-year-old girl is between 35 and 40 inches tall, inclusive. That is, find P(35 X 40). By-Hand...
-
Find the value of z 0.10 . Approach We wish to find the z-value such that the area under the standard normal curve to the right of the z-value is 0.10.
-
The heights of a pediatricians three-year-old females are approximately normally distributed, with mean 38.72 inches and standard deviation 3.17 inches. Find the height of a three-year-old female at...
Study smarter with the SolutionInn App