Program demonstrates simple symmetric-key encryption

Assignment Help Computer Engineering
Reference no: EM13850997

assembly language using visual studio 2010

This program demonstrates simple Symmetric-key Encryption using the XOR instruction with a multi-byte key entered by the user. Use this key to encrypt and decrypt the plain text as shown below (try ch06_08.exe):

C:\zdsite\fullcoll\fc241\files>ch06_11
Enter the plain text: This is a string.
Enter the encryption key: 12345
Cipher text: eZZG§XA?U§BFA][V?
Decrypted: This is a string.

C:\zdsite\fullcoll\fc241\files>ch06_11
Enter the plain text: This is a string.
Enter the encryption key: 1
Cipher text: eYXB?XB?P?BECX_V?

Decrypted: This is a string.

You can use the sample Encrypt.asm as a start point. With a multi-byte key, you have to modify the procedure TranslateBuffer. Also, modify InputTheString without directly reference to the buffer variable, to make it reusable and you can call it twice to receive the plain text and the multi-byte key like this:
.data
prompt1 BYTE "Enter the plain text: ",0
prompt2 BYTE "Enter the encryption key: ",0
sEncrypt BYTE "Cipher text: ",0
sDecrypt BYTE "Decrypted: ",0

keyStr BYTE BUFMAX+1 DUP(0)
keySize DWORD ?
buffer BYTE BUFMAX+1 DUP(0)
bufSize DWORD ?

.code
main11 PROC
mov edx,OFFSET prompt1 ; display buffer prompt
mov ebx,OFFSET buffer ; point to the buffer
call InputTheString
mov bufSize,eax ; save the buffer length

mov edx,OFFSET prompt2 ; display key prompt
mov ebx,OFFSET keyStr ; point to the key
call InputTheString
mov keySize,eax ; save the key length

A better alternative to using keySize is to keep checking the zero terminator in TranslateBuffer, since ReadString automatically adds a terminator to the end of keyStr.

As for TranslateBuffer PROC, the new logic could be similar to this:
Initialize ESI and EDI to point the message and key buffer memory
Make a loop for each byte in the message
Translate a message byte by XOR with a key byte
Update ESI for next char in message
Check if all key bytes used up?
If yes, reset EDI to point the key start byte
If no, Update EDI for next byte in key
Loop continuing
Return

Advanced discussion: A possible issue is display of the Cipher text that might result in some control chars, like zero, ODh, OAh, etc. One choice is to show an encoded char's ASCII code if it below or equal to a space (20h):
Enter plain text: LvAKabc
Enter your key: AAAAA22222
Cipher text: [0D]7[00][0A][20]PQ
Decrypted text: LvAKabc
Press any key to continue...

Reference no: EM13850997

Previous Q& A

  Design a modern network for a private high school

Design a Modern Network for a Private High School. The network is proposed to achieve the above objectives considering the school's following business and technical goals.

  Implementing a new performance appraisal system

Topic: An integrative approach to managing people issues arising from implementing a new performance appraisal system. Question: You are the team leader of an organisational and development unit within a human resources department of a large univer..

  Calculate the value of this estimate for the sample

What is the unbiased estimate of the difference in height between boys and girls? Provide a formula and check the unbiasedness. Calculate the value of this estimate for the given sample.

  How does the magnitude of electric force

How does the magnitude of electric force compare between a pair of charged particles when they are brought to half their original distance of separation? To one-quarter their original distance? To 4 times their original distance? (What law guides you..

  The football players at rutgers state university

During a workout, the football players at Rutgers State University ran up the stadium stairs at a steady pace in 48 s. The stairs are 90 m long and inclined at an angle of 31o. If a typical player has a mass of 90 kg, estimate the average power outpu..

  What is the direction of the centripetal force felt

What is the direction of the centripetal force felt by a car while taking a turn during a NASCAR race?

  What''s the largest diameter a spherical silver particle

What's the largest diameter a spherical silver particle can have for there to be no more than 1 billion electron energy states over a 1 eV interval at 2 eV?

  Explain how the selected computer crime victimizes someone

Explain how the selected computer crime victimizes someone. Evaluate how vulnerable or susceptible society is today, with respect to this computer crime.

  Will you reject or not reject the null hypothesis and why

Find the random variable X. Consider we are testing "paired samples" - What is the test statistic (t-value) ? Assume, the population mean of the differences

  Which a car can safely navigate such a turn

Consider again the problem of a car traveling along a banked turn. Sometimes roads have a "reversed" banking angle. That is, the road is tilted "away" from the center of curvature of the road. If the coefficient of static friction between the tires a..

Reviews

Write a Review

 

Similar Q& A

  Questiona bank has its head office in stoke it has two

questiona bank has its head office in stoke. it has two branches one in longton and other in burslem. each customer

  1 design a program that reads in a text file with drawing

1. design a program that reads in a text file with drawing commands and then outputs a bitmap with all the items drawn

  Questionsophie is development on using applocker to control

questionsophie is development on using applocker to control access to applications on a new network she has constructed

  Define three approaches to organizing programming teams

How does implementing a maintenance change differ from the new system development project.

  Why are most photographic images stored in a lossy format

Why are most photographic images stored in a lossy format

  Why computer''s activities is handling failure

why computer's activities is handling failure.

  Implementing the client program

Write down a code in the client program to perform the following: Declare an object player1 of type Player.

  Questionfor this project you will create a simplify credit

questionfor this project you will create a simplify credit card transaction management program.name your project

  Program in visual basic to calculate area of a triangle

Write down a program in the visual basic which determines the area of a triangle. If three sides a, b and c entered do not make a triangle transmit the message out to the screen that the data entered was invalid.

  Osi layered structure and different protocols

List and discuss major de-merits of the layered approach to protocols in scholarly detail.Explain why data network communication and distributed applications.

  Describe the most likely impediments to health care

predict the function of medical health records in 2030 providing specific examples to support your response.describe

  Develop a report using word-processing software in that

develop a report using word-processing software. in that report address the followinga. identify the elements that you

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd