Question: Implement, in MIPS assembly language, an encryption/decryption program that meets the following requirements: Input Your program should prompt the user for two separate inputs from
Implement, in MIPS assembly language, an encryption/decryption program that meets the following requirements:
Input
Your program should prompt the user for two separate inputs from the keyboard, as follows:
The prompt: ENTER THE ENCRYPTION KEY (A NUMBER BETWEEN 1 and 15):
The user will input a number. We will assume the user is not an idiot, and actually enters an integer value. However, if the user is actually an idiot and enters a value greater than 15, we will use a bitmask of 0xF to force to the number to be less than 16. Store this somewhere safe, as it will be our encryption/decryption key.
The prompt: INPUT A MESSAGE OF NO MORE THAN 80 CHARACTERS. WHEN DONE, PRESS
The user will input a character string from the keyboard, terminating the message with the
Your program will store the message in an array you have allocated that is big enough to hold 80 characters.
One constraint: Once again, we assume the user is not a complete idiot and that the length of the message is indeed less than or equal to 80 characters.
Hint: You can use either SPIM system call 8 or 12, depending on how you wish to solve the problem
Algorithm
The encryption algorithm is as follows. Each ASCII code in the message will be transformed as follows: For each character in the string, perform the exclusive-OR on that character. This will encrypt a plaintext string. It will also decrypt a ciphertext string.
Output
Your program should output the encrypted or decrypted message to the screen. (SPIM system call 4 or 11.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
