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
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