QuestionQuestion

Milestone #3: Hopping Around

Goal: Working program that accesses the input file data, correctly applies the 5 steps, and implements the random hop portion of the encryption including the 1 to 3 rounds.

Note: IF milestone #2 is not correct, this portion will not be successful either. So even if you failed to get #2 on time, you still must get it to work correctly in order to get full credit for #3.

Make SURE to remove that first encryption step in M#01 and M#02. You will be encrypting using the full keyfile at this point making that step unnecessary.

Name your zip file: “Team_00_Project_03.zip” where 00 is your team’s number.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

// DecryptData.cpp
//
// THis file uses the input data and key information to decrypt the input data
//

#include "Main.h"




//////////////////////////////////////////////////////////////////////////////////////////////////
// code to decrypt the data as specified by the project assignment
int decryptData_03(char *data, int dataLength)
{
int resulti = 0;
int hop_count = 0;
int index = 0;

gdebug1 = 0; // a couple of global variables that could be used for debugging
gdebug2 = 0; // also can have a breakpoint in C code

// You can not declare any local variables in C, but should use resulti to indicate any errors
// Set up the stack frame and assign variables in assembly if you need to do so
// access the parameters BEFORE setting up your own stack frame
// Also, you cannot use a lot of global variables - work with registers

__asm {

mov eax, gNumRounds // for round = #round - 1
loop0:

push eax
shl eax, 2 // round * 4
mov esi, gptrPasswordHash // put ADDRESS of gPasswordHash into esi (since unsigned char *gptrPasswordHash = gPasswordHash)
add esi, eax
xor edx, edx
mov dh, [esi]
mov dl, [esi + 1]
mov index, edx

// Determine hop_count
mov ebx, 0
mov bh, [esi + 2]
mov bl, [esi + 3]

// Check if 0
cmp ebx, 0
jne L1
mov ebx, 0xFFFF
L1:
mov hop_count, ebx


mov ebx, 0 // Start from first byte of data
mov ecx, dataLength // Pop the length of data
mov esi, gptrKey
Xor eax, eax
mov al, byte ptr[esi + edx] // access byte at position edx of key file
mov edi, data // Put ADDRESS of first data element into edi
loop1 :
xor edx, edx
mov dl, byte ptr[edi + ebx]

//ECABD

// E codetable swap
push eax
mov al, byte ptr[gDecodeTable + edx] // load dl-th value from gDecodeTable
mov dl, al
pop eax

// C Swap half nibbles
push eax
mov al, dl // copy dl to al
shl dl, 2 // shift dl left by 2 - now lower half nibbles moved to higher half nibbles position
and dl, 011001100b // clear lower half nibbles
shr al, 2 // shift al rightby 2 - now higher half nibbles moved to lower half nibbles position
and al, 000110011b // clear higher half nibbles
or dl, al // join the registers
pop eax...

By purchasing this solution you'll be able to access the following files:
Milestone3.zip.

$25.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Assembly Language Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats