Question: Write a function in assembly language named encrypt which takes a pointer to a buffer containing some cleartext, and modifies the buffer to contain the

Write a function in assembly language named encrypt which takes a pointer to a buffer containing some cleartext, and modifies the buffer to contain the encrypted version of that text. The encryption scheme is to add a (wrap-around) displacement n to each alphabetic char where the letters of the alphabet are numbered A=1, B=2, etc. The same encoding is used for lower-case letters: a=1, b=2, etc. For example given the clear text AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz 0123456789 Hello, my boots are layered like an onion. !@#$%^&*()_-+={}[]\| <>,.?/~;:" and assuming for example n = 13, the result should be 1 NnOoPpQqRrSsTtUuVvWwXxYyZzAaBbCcDdEeFfGgHhIiJjKkLlMm 0123456789 Uryyb, zl obbgf ner ynlrerq yvxr na bavba. !@#$%^&*()_-+={}[]\| <>,.?/~;:" Note that only the alphabetic characters have changed, case has been preserved, and each alphabetic character has been displaced by 13, for instance a Z being character 26 becomes M (character 13), and a b (character 2) becomes o (character 15). Your code should accept any n from 0 to 25. Of course 0 means no change. If a value larger than 25 is provided, your program should replace the contents of the buffer with the string: XXXXX...XXX. The buffer pointer must be stored in R4 while the buffer size and rotate amount must be encoded in R3 as follows: size of the buffer must be stored in the bits 14:0 of R3, while the value of n must be stored in bits 19:15 of R3.

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 Databases Questions!