logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

CMPE102: Fall 2021 Program #4: You are responsible to write an assembly function for an encryption library. This function will encrypt or decrypt a string of characters.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

First copy/rename encrypt_sample.cpp to encrypt.cpp

MacOS Terminal: gcc -fdeclspec -c encrypt.cpp gcc -shared -o libencrypt.so encrypt.o gcc -L. -o p4 p4.cpp -lencrypt Windows Command Prompt: gcc -c encrypt.cpp gcc -shared -o libencrypt.dll encrypt.o gcc -L. -o p4.exe p4.cpp -lencrypt

The first command compile encrypt.cpp into encrypt.o; the second command "link" encrypt.o into shared lib libencrypt.so; the third command compile/link p4.cpp into p4; To run the program (will take either 2 or 4 parameters): Mac - ./p4 "Frank Butt" 0 OR ./p4 "Frank Butt" 0 1 5 Windows - p4 "Frank Butt" 0R p4 "Frank Butt" 0 1 5

 

 

CMPE102: Fall 2021

Program #4: Encryption Library 

 

 

Description:

 

You are responsible to write an assembly function for an encryption library.  This function will encrypt or decrypt a string of characters.  It will use a simple ciphertext algorithm which do character shifting. This function will use the C function signature but everything within this function should be assembly code using the ASM block similar to the assembly example shown in class.  This function should be built into a separate shared library (e.g. DLL).  p4.cpp will contain the calling function and should not be modified.

 

Program Specification:

 

long s_encrypt (char *src, char* dest, long en_flag);

 

  src – the original string

 

  dest – the output string

 

  en_flag – 0 for encryption and 1 for decryption

 

This function returns the # of characters being changed in the string.  If no change, it should return zero.

 

Additional Information:

 

- We only apply the change algorithm for (‘A’..‘Z’ to ‘a’..’z’).  Other characters are left unchanged.

- All the alpha characters will toggle between upper and lower case.

- The input and output string are displayed on the screen.

- You MUST have detailed comments within the _asm block for your algorithm.

- We will use a separate header file (key.h) for the default character shifting algorithm attributes.

- In key.h, you have 2 global variables within the DLL which can be updated via set/get functions. 

long direction  = 0;  /* 0 means forward, 1 means backward */

      long shiftcount = 2;  /* number of character to shift */

Program Checklist:

 

You must submit files named encrypt.cpp and readme.p4 file.  The rest of the files must be left unchanged or your program will fail our tests. 

 

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

555 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

562 Answers

Hire Me
expert
Husnain SaeedComputer science

880 Answers

Hire Me
expert
Atharva PatilComputer science

562 Answers

Hire Me

Get Free Quote!

415 Experts Online