Your task is to write a C program which performs encryption and decryption of a message using the…

Your task is to write a C program which performs encryption and decryption of a message using the…
Your task is to write a C program which performs encryption and decryption of a message using the substitution cipher algorithm. Write a C program which performs encryption and decryption using the substitution cipher algorithm. Your program must be fully automated (ie: it does not take any interactive user input) and either encrypt or decrypt depending on the files which exist in the program’s directory. If message.txt exists your program should read that file, encrypt the contents, and write the output to ciphertext.txt. If ciphertext.txt exists your program should decrypt the contents and write the output to message.txt. If both files exist your program should default to encrypting message.txt. If neither message.txt or ciphertext.txt exist your program should print an error and exit. The key is to be read from key.txt. This file should contain all 26 letters of the alphabet in UPPER CASE and listed in a random order. Your program should print an appropriate error and exit if any of the following conditions are met: • key.txt does not exist • The key contains repeated letters • The key does not contain every letter • The key contains characters which aren’t letters (eg: numbers, spaces, etc) This tasks requires you to check the return value of fopen() when attempting to open files. If a file does not exist then fopen() will return NULL. Your program should be able to read both UPPER and lower-case letters but the output should be in UPPER CASE only. In other words, your program needs to convert all letters in the input to upper case before they are processed. Any character which is not a letter should be copied from input to output without modification. All input and output data is to be encoded with the ASCII standard. If an input byte is outside of the ranges [65, 90] and [97, 122] then it can be copied to the output without modification. If an input byte is in the lower case range, [97, 122], then you should subtract 32 from its value to make it an upper case letter prior to encryption. Your program must contain and use the following functions: void encrypt(char *ciphertext, char *message, char *key); void decrypt(char *ciphertext, char *message, char *key); This implies that your program must read the entire input file and key into different strings and then pass these strings as arguments to the above functions. The encrypt() function should read from message and write to ciphertext and, likewise, decrypt() should read from ciphertext and write to message. In order to do this note the following: • C allows you to declare an array with a length given as a variable, eg: int len = 128; char str[len]; • The length of a file can be found by opening it, using fseek() with the SEEK END argument, and then using ftell() to find the current value of the position indicator. You can then use fseek() or rewind() to start reading from the beginning of the file. See the fseek() documentation for details. *ciphertext: QMJK JK KZWP KPHNPQ WPKKDVP! JK QMJK DAZQMPN SJAP BNZW QMP KPHNPQ WPKKDVP? *key: DGHLPBVMJIOSWAZXCNKQFERTYU Apr 08 2022 02:05 PM

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
The price is based on these factors:
Academic level
Number of pages
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
Open chat
You can contact our live agent via WhatsApp! Via + 1 (409) 205-8984

Feel free to ask questions, clarifications, or discounts available when placing an order.

Order your essay today and save 30% with the discount code GURUH