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.
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
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. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
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
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