Do you need this or any other assignment done for you from scratch?
We have qualified writers to help you.
We assure you a quality paper that is 100% free from plagiarism and AI.
You can choose either format of your choice ( Apa, Mla, Havard, Chicago, or any other)
NB: We do not resell your papers. Upon ordering, we do an original paper exclusively for you.
NB: All your data is kept safe from the public.
Notes about the encryption algorithmsFor the XOR cipher, for each character in t
Notes about the encryption algorithmsFor the XOR cipher, for each character in the unencrypted message, you should perform an exclusive or with a character in the key. For character i in the original string, the character to perform the exclusive or with is key[i % length_of_key]. Note that decrypting the XOR cipher uses the exact same steps as encrypting it!
For the Caesar cipher, for each letter in the unencrypted message, you should change its ascii value something different. Here’s a hint:
char base = isupper(text[i]) ? ‘A’ : ‘a’;
text[i] = (text[i] – base + key) % 26 + baseAnd if text[i] is less than base, add 26 to it to make sure it’s alphabetic. (Numbers won’t be encrypted.)
Notes about the programYour program should accept three command line arguments.
The name of a file to be encrypted
An int key to be used by the Caesar cipher
A single-word string to be used by the XOR cipher
If there are not three command line arguments, your program should display this error message and exit:
Usage: lab06 filename caesar_key xor_keyIf the file to be encrypted doesn’t exist, your program should display this error message and exit:
The file to be encrypted doesn’t exist.If the caesar_key argument isn’t an int, your program should display this error message and exit:
The caesar_key must be an int.If all of the command line arguments are correct, your program should work in this way:
Open the file whose name was supplied on the command line and read the contents into a string.
Encrypt that string using an XOR cipher with the xor_key.
Write the encrypted string out to a file whose name is that of the unencrypted file with _XOR appended to it.
Display a message to the terminal that you successfully wrote the encrypted file. You can see the correct format below.
Decrypt the string so you get back the original one.
Encrypt the string using a Caesar cipher with the caesar_key.
Write the encrypted string out to a file whose name is that of the unencrypted file with _CAESAR appended to it.
Display a message to the terminal that you successfully wrote the encrypted file. You can see the correct format below.
Your program must compile with no errors or warnings, and must pass all style checks in order to be submitted. In additional, it must pass all of the tests in CODE so I suggest that you focus on writing a program that does that before actually digging into the encryption.
To check if your program is working correctly, if you download the file hobbit.txt Download hobbit.txtand run your program with these command line arguments
hobbit.txt 23 bilbothen the two encrypted files from your program should be identical to these:
hobbit.txt_XOR_correct
hobbit.txt_CAESAR_correct
You can use the diff command to see if your output agrees. And the output of your program should be:
Successfully wrote hobbit.txt_XOR.
Successfully wrote hobbit.txt_CAESAR.
Do you need this or any other assignment done for you from scratch?
We have qualified writers to help you.
We assure you a quality paper that is 100% free from plagiarism and AI.
You can choose either format of your choice ( Apa, Mla, Havard, Chicago, or any other)
NB: We do not resell your papers. Upon ordering, we do an original paper exclusively for you.
NB: All your data is kept safe from the public.
Place this order or similar order and get an amazing discount. USE Discount code “GET20” for 20% discount