Question
I'm completely new to assembly language, and I was just wondering what the working programing code would be to for this program below. Write a
I'm completely new to assembly language, and I was just wondering what the working programing code would be to for this program below.
Write a NASM 8086 program which will encrypt/decrypt a message.
It will do this by reading key and then using an exclusive OR operation to encrypt that character with the key.
Each character will then be pushed on the stack, keeping count of the number of characters in the message.
The end of the message will be indicated when the user presses the enter key.
At that point, the encrypted message will be popped off the stack, and displayed, character by character.
(Note: a key value of 0 will simply display the string in reverse.)
This problem can be solved by implementing the following algorithm:
repeat
prompt the user to enter a number between 0 and 31
enter an unsigned base 10 number from the keyboard and make it the key
until the key is between 0 and 31
initialize counter to 0
prompt user to enter the message
read a character from the keyboard
while character is not the CR character do
char <-- char XOR key
push char on the stack
increment the counter
endwhile
print a CR/LF pair
for counter times do
pop char off the stack
display it
endfor
Note that if you enter the cyphertext with the same key used to encrypt it, you should get the original plaintext back.
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