Question: in at&t assembly: Implement a cryptographic encoder / decoder that will input a line of text and output an encoding of the text. The method

in at&t assembly: Implement a cryptographic encoder/decoder that will input a line of text and output an
encoding of the text. The method will be similar to Caesars cipher and ROT13system. The user will
provide a verb (encode or decode)and an integer key as a command line argument. This key will be
a decimal number. For each of the characters in the line of text to be encoded:
1
if it is between the space and the tilde (),use the formula c
=(((c 32)+key)mod 95)+32
to compute the encoded character
if it is less than the space, use the character as is.
if it is after the tilde, use the character as is.
To decode, follow this method:
if it is between space and the tilde (),use the formula c
=((((c 32)key)mod 95)+95)
mod 95+32to compute the encoded character
if it is less than space, use the character as is.
if it is after the tilde, use the character as is.
Here are some sample runs you should be able to produce.
$ echo "abcDEF" |./crypto encode 13
nopQRS
$ echo "abcDEF" |./crypto encode 91
]^_@AB
$ echo "Hello, world!" |./crypto encode 3771
+HOORnbZRUOGc
$ echo cde|./crypto decode 2
abc
$ echo Hello,world!|./crypto encode 2173|./crypto decode 2173
Hello, world!
In order to access the command line arguments, remember that stdlib is calling main with this signature:
int main(int argc, char *argv[])
To read the string, use fgets and not scanf("%s",..)since the latter will stop at the first white
space.
Save your program as crytpo.s.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!