Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create the ultimate encryption programusing assembly language. The program will ask the user for a message and a key, and will use that key to

Create the ultimate encryption programusing assembly language. The program will ask the user for a message and a key, and will use that key to encrypt the message, then again to revive the original message. Part 1 encrypt.asm This part of the program will input two strings, with appropriate prompts. The program will then take, character by character, the original message and the key and apply the Vigenre cipher [1] (algorithm for encryption) to it. To collect a single byte from memory, try something like the following: mov dl, [rax] In the above example, dl is an 8bit register (actually, the low order 8 bits of the 64bit register rdx). Similarly, there are al, bl, cl (and even ah, bh, ch, and dh). The Vigenre cipher is a relatively old idea. It takes a key of any size, which is a series of letters (e.g. a word). The key is used repeatedly so that each character in the plaintext has a corresponding letter from the key. For example, here is the matchup for the key OPENSESAME and the message MEETUSATTWELVEOCLOCKSHARP: Key: OPENSESAMEOPENSESAMEOPENS Plaintext: MEETUSATTWELVEOCLOCKSHARP Note: Duplicating the key so that it is the same length as the message is one of the trickiest parts of this program. Create a sufficiently large string variable for the result (e.g. duplicatedKey), copy the letters from key until you get to the nullterminator (a character equal to zero). Keep a count of how many characters have been copied, and stop when that count reaches the message length. Whenever you get to the end of the key, go back to the first character. The letter O above the M in the leftmost column in the above example means that your algorithm will apply a CaesarO shift. This is a fancy way of saying that you will add 14 to the ASCII value for M (with wraparound if the value goes beyond Z). A full table of the shifts is given in the table below. For example, in the leftmost column in the above example, the result would be the ASCII value of M + 14, which would be A (due to wraparound). Letter Shift Letter Shift Letter Shift A 0 J 9 S 18 B 1 K 10 T 19 C 2 L 11 U 20 D 3 M 12 V 21 E 4 N 13 W 22 F 5 O 14 X 23 G 6 P 15 Y 24 H 7 Q 16 Z 25 I 8 R 17 Hint: Instead of a 26part if/elseif/else statement, a much better way is to subtract the value of 'A' from whichever letter you have in the key to get the shift value. The complete example, along with its ciphertext is given below: Key: OPENSESAMEOPENSESAMEOPENS Plaintext: MEETUSATTWELVEOCLOCKSHARP Ciphertext: ATIGMWSTFASAZRGGDOOOGWEEH After collecting the key and the plaintext from the user, your program will output the ciphertext to the console. Note: You can limit the length of these strings to 100 characters in your program, and you do not have to handle the case when the user types more than 100 characters. You can also limit the string to only uppercase letters (as shown in the examples), to make the logic simpler. If there are no spaces, that also means that you can use scanf(%s, str) to enter the string(s). Sample Output Enter the message: MEETUSATTWELVEOCLOCKSHARP Enter the key: OPENSESAME Encrypted message: ATIGMWSTFASAZRGGDOOOGWEEH decrypt.asm This program will do the opposite of encrypt.asm. It will apply the Vigenre cipher in reverse. It will subtract the offset from the ciphertext characters, producing the plaintext. Sample Output Enter the encrypted message: ATIGMWSTFASAZRGGDOOOGWEEH Enter the key: OPENSESAME Decrypted message: MEETUSATTWELVEOCLOCKSHARP Note: For the purposes of this assignment, you can limit the strings to 50 characters (51, including the null byte). Part 2 For this part, you can create any assembly language program that you like. Suggested ideas include (but are not limited to): A number guessing game A question/answer program that collects statistics on yes/no answers A program that sorts a list of numbers, entered by the user, and outputs them 2 A program that implements binary search on an already sorted list, entered by the userv

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Information Quality Dimensions, Principles And Techniques

Authors: Carlo Batini, Monica Scannapieco

1st Edition

3319241060, 9783319241067

More Books

Students also viewed these Databases questions

Question

Why is it important to match sources and methods of recruitment?

Answered: 1 week ago

Question

What is linear transformation? Define with example

Answered: 1 week ago