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...
Dataset that can be used with the between subject design
: Create a new dataset that can be used with the between subject design. You will no longer need the variables CreativePre and CreativePost Test. Instead, you will have only one variable for the score on the creativity test.
|
Analyze and discuss the failure and apply the laws
: Analyze and discuss the failure and apply the laws given in the text showing clearly how the application of the laws might have lessened or even prevented the failure.
|
Closing case- china limits exports of rare earth materials
: Closing Case- China Limits Exports of Rare Earth Materials. Which group benefitted the most from China imposing an export quota on rare earth metals? Did it give the Chinese domestic manufacturers a significant cost advantage
|
The issue of the us government using technology to spy
: Create your blog on the issue of the US government using technology to spy on US citizens and/or foreign nations. Remember, your article must contain an author and a date AND be from the past 12 months.
|
Program demonstrates simple symmetric-key encryption
: 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
|
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..
|