Question
using x86 on 64 bit Objective Through this project, you will practice writing loops to process strings in assembly langauge. Background Atbash is a simple
using x86 on 64 bit
Objective
Through this project, you will practice writing loops to process strings in assembly langauge.
Background Atbash is a simple mono-alphabetic substitution cipher where every letter in a
string is substituted with its reverse. From Wikipedia:
Applying Atbash would simply mean taking the alphabet and mapping it to its reverse, so that the first letter becomes the last letter, the second letter becomes the second to last letter, and so on with rollover when Z gets mapped to A.
The transformation can be done using a lookup table, such as the following:
Since Atbash lacks any sort of a key, it barely has any sort of security For example, in the following silly joke, the punchline has been obscured by
Atbash: Why should you take a pencil to bed?
Gl wizd gsv xfigzrmh! Transforming the entire text via Atbash form, the answer to the joke is revealed:
Dsb hslfow blf gzpv z kvmxro gl yvw?To draw the curtains!
Atbash occasionally generates some English words from other English words, consider this:
Slim old tory torn over tilt zipHorn low glib glim levi grog ark
Although, the results may not be meaningful, they are certainly words in English!
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
ZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba
Assignment
Your assignment for this project is to write an assembly language program that computes the Atbash of an input. Your program may execute like this:
[jksfn@linux2 ~]$ ./atbash Enter string: abcdef Original: abcdef Convert: zyxwvu [adfnjksa@linux2 ~]$ ./atbash Enter string: AbCdEfGhI Original: AbCdEfGhI
Convert: ZyXwVuTsR [kjdsf@linux2 ~]$ ./atbash Enter string: NoPqRsTuV Original: NoPqRsTuV Convert: MlKjIhGfE [dfskj@linux2 ~]$ ./atbash Enter string: 1+1=Two Original: 1+1=Two Convert: 1+1=Gdl [dsafd@linux2 ~]$ ./atbash Enter string: retriever@umbc.edu Original: retriever@umbc.edu Convert: ivgirvevi@fnyx.vwf [dsfdsf@linux2 ~]$ ./atbash Enter string: 1 One 2 Two 3 Three 4 Four 5 Five 6 Six Original: 1 One 2 Two 3 Three 4 Four 5 Five 6 Six
Convert: 1 Lmv 2 Gdl 3 Gsivv 4 Ulfi 5 Urev 6 Hrc
[fvxvdf@linux2 ~]$ ./atbash Enter string: 'quotes!' Original: 'quotes!' Convert: 'jflgvh!' [dsdfdsf@linux2 ~]$ ./atbash Enter string: arithmetic+-%^&* Original: arithmetic+-%^&* Convert: zirgsnvgrx+-%^&* [dsfsdf@linux2 ~]$ ./atbash Enter string: Original: Convert:
Implementation Notes
-
A good starting point for your program is the toupper.asm program shown in class. It already queries the user for input and sets up a loop that looks at each character of the input. The source code for toupper.asm is available in the classs blackboard via the navigation pane, at:
Course Materials -> Course Related Code -> Misc
-
Your can assume that no more than 256 characters will ever be input to your program.
-
Remember, all characters input into the system are ASCII values. Refer to an ASCII table when determining how to implement your Atbash cipher.
-
Your code must be case-preserving: if the input is upper-case, then the corresponding output must be upper-case; if the input is lower-case, then the corresponding output must be lower-case, as in the following example (also above):
[sadvg@linux2 ~]$ ./atbash Enter string: AbCdEfGhI Original: AbCdEfGhI Convert: ZyXwVuTsR
-
Your code should ignore non-alphabetical characters as in the following example (also above):
[xczvxc @linux2 ~]$ ./atbash Enter string: arithmetic+-%^&* Original: arithmetic+-%^&* Convert: zirgsnvgrx+-%^&*
-
There are many ways to implement your Atbash cipher, but the two most obvious techniques are to use conditionals and arithmetic, or to use a lookup table. With conditionals and arithmetic, you would need to perform multiple checks on the input value, determine the difference from a lower bound (based on the case) and add 25. If using a lookup table, you would convert the character value input into an offset by subtracting the ASCII value for
a (if lowercase) or A (if uppercase). Then you would use that offset into a table (or in this case, a string), and put that value into the output instead of the original input. Your instructor recommends the lookup table technique (and the contents of your lookup table are provided above).
7. It may be helpful to write the code to perform the Atbash in a higher-level language of your choosing (C, C++, Java, Python, ...). This will help you understand the mechanics of your assembly language program. This is not required and you should NOT submit this if you choose to do it.
What to submit
Use the UNIX submit command on the GL system to turn in your project. You should submit the assembly language program. The class name for submit is. Include documentation for your project in the form of a readme text file. Optionally include a typescript file in case you were unsuccessful on any of the test cases provided, with the script file demonstrating the unsuccessful outcome. The UNIX command to do this should look something like:
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