Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Creating the assembly language file Your code should use STDIN and STDOUT for input and output. (This is the default.) Use redirection on the command
Creating the assembly language file Your code should use STDIN and STDOUT for input and output. (This is the default.) Use redirection on the command line to read from a file and write to a file. Your code should open a file, read it character by character and save it into an array. When you get to the end of the file you should encode the contents of the array with a Vigenere cipher using the keyword CRYPTOGRAM, then print it out. Maintain the distinction between upper-case and lower-case letters, and do not modify non-alphabetic characters. This is not very good for the security of your message, but the result will look neater. This program should use glibc functions. In addition to printf(). you may need get char() and putchar(). Assume that the input file contains just ASCII text Don't worry about what happens with non-text files. Once the encoder is working, build a decoder by duplicating the code and changing the addition to a subtraction. If you use printf() to output the array, remember that a null termination is required on a string. There are really two different parts to this problem. One is how to do I/O, the second is how to do the encoding. Solve one problem at a time. Start with how to do I/O. getchar() and putchar() are described on slide 19 of Lecture 8B. The first version of the code you should write should just output the text without changing it. Remember that when passing a character on the stack, it has to be extended to 32 bits. The return value will be in EAX. This is how you can tell when you're at the end of the input file. The input text should be stored in an array. This is an essential requirement for the solution Make sure it is clear in your comments where this happens. Once you've got that figured out. you can do the encoding part. To make sure you don't mess up the part that you already have figured out. you could implement the encoding as a function call. Obviously the function will take a character as an input and return a character. Since you're writing your own function, you can pass the character in a register rather than using the standard function interface. Note that the encoding only changes the values 'a' through 'z' and 'A' through 'Z'. All other characters remain unchanged. The algorithm as described assumes that the letters are represented as the numbers 0 through 25, but of course the ASCII code doesn't work exactly that way
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