Question

In: Computer Science

Hi, (C programming) I am looking to write a program that will encrypt a text file...

Hi,

(C programming)

I am looking to write a program that will encrypt a text file automatically once program has opened, and have the option to decrypt it in a menu in my program.

I have multiple text files that I need to encrypt, and would like if the program could encrypt all of them at once.

I would also only like to decrypt the a text file once the name has been entered into a scanf function.

Solutions

Expert Solution

Encrypt/Decrypt Files in Linux using Ccrypt

Ccrypt is a command line tool for encryption and decryption of data. Ccrypt is based on the Rijndael cipher, the same cipher used in the AES standard. On the other hand, in the AES standard, a 128-bit block size is used, whereas ccrypt uses a 256-bit block size. Ccrypt commonly uses the .cpt file extension for encrypted files.

  • It is a lightweight tool, the installation and use of this tool is pretty easy.
  • It is designed to overcome the shortcomings of standard unix crypt utility.

Installation

sudo apt-get install ccrypt // in ubuntu

Ccript

  • -e, –encrypt :Encrypt. This is the default mode. If filename arguments are given, encrypt the files and append the suffix .cpt to their names. Otherwise, run as a filter.
  • -d, –decrypt: Decrypt. If filename arguments are given, decrypt the files and strip the suffix .cpt from the filenames, if present. Otherwise, run as a filter.
  • -c, –cat: Decrypt one or more files to standard output. If no filename arguments are given, decrypt as a filter. Implies -l.
  • -x, –keychange: Change the key of encrypted data. In this mode, ccrypt prompts for two passwords: the old one and the new one. If filename arguments are given, modify the files. Otherwise, run as a filter.
  • -u, –unixcrypt: Simulate the old unix crypt command. Note: the cipher used by unix crypt has been broken and is not secure. Please use this option only to decrypt existing files. If filename arguments are given, decrypt the files to stdout. Otherwise, run as a filter. Note that for the unix crypt format, there is no easy way to detect whether a given key matches or not; thus, for safety, this mode does not overwrite files.

Encrypting files with Ccrypt

In order to encrypt file using this tool, use following syntax:

ccrypt filename

To encrypt a file : impfile

ccrypt impfile

Decrypt file with Ccrypt

Now in order to decrypt an already encrypted file, command syntax is:

ccrypt –d encryptedfilename

Related Solutions

Hi, I am trying to write a php file which control the text size, color and...
Hi, I am trying to write a php file which control the text size, color and the parameters of a registration page. My code is not working, the registration page always stay in the default color. Could I get some help ? My code is below. display file <?php session_start() ?> <!DOCTYPE html> <html> <head>    <meta charset="UTF-8">    <title>User display window</title>    <style>        .center { text-align:center}        </style>    </head> <body>    <fieldset>        <legend...
In C Programming Language Write a program to output to a text log file a new...
In C Programming Language Write a program to output to a text log file a new line starting with day time date followed by the message "SUCCESSFUL". Please screenshot the results.
Programming Language C++ Encrypt a text file using Caesar Cipher. Perform the following operations: Read the...
Programming Language C++ Encrypt a text file using Caesar Cipher. Perform the following operations: Read the console input and create a file. ['$' character denotes end of content in file.] Close the file after creation. Now encrypt the text file using Caesar Cipher (Use key value as 5). Display the contents of the updated file. #include <iostream> using namespace std; int main() { // write code here }
C++ programming question Write a program that will read input from a text file called "theNumbers.txt"...
C++ programming question Write a program that will read input from a text file called "theNumbers.txt" (you will have to provide your own when debugging). The text file that is to be opened is formatted a certain way, namely, there is always one integer, one character (representing an operation), another integer, and then a new line character, with spaces between each item. A sample text file is provided below. theNumbers.txt 144 + 26 3 * 18 88 / 4 22...
In C++ Write a program that contains a function, encrypt(Cypher) that encrypts the below text and...
In C++ Write a program that contains a function, encrypt(Cypher) that encrypts the below text and a second function, decrypt(Cypher),  that decrypts the encrypted message back to normal.  Cypher is the string which contain the plain or cypher texts.  Demonstrate that the encrypted message that you created is correctly decrypted.  For this problem you need to input “All Gaul is …” into a string Cypher.   Julius Caesar was one of the earliest persons to employ cryptology in history.  All his correspondence from his campaigns to...
Write a C++ program to create a text file. Your file should contain the following text:...
Write a C++ program to create a text file. Your file should contain the following text: Batch files are text files created by programmer. The file is written in notepad. Creating a text file and writing to it by using fstream: to write to a file, you need to open thew file as write mode. To do so, include a header filr to your program. Create an object of type fsrteam. Open the file as write mode. Reading from a...
Write a C program that Reads a text file(any file)  and writes it to a binary file....
Write a C program that Reads a text file(any file)  and writes it to a binary file. Reads the binary file and converts it to a text file.
Hi, I am working on an assignment in C-Programming language dealing with LInked lists, in the...
Hi, I am working on an assignment in C-Programming language dealing with LInked lists, in the code there is instructions on where to write the code. I do not know how to write Linked Lists. Has to be in the C-language, Any help is greatly appreciated   //agelink.c //maintains list of agents //uses linked list #include <stdio.h> #include <stdlib.h> #define TRUE 1 void listall(void); void newname(void); void delink(void); void memexit(void); void wfile(void); /********************************************************************* this is the structure to hold a agent...
Write a java program: Write a program that creates a text file. Write to the file...
Write a java program: Write a program that creates a text file. Write to the file three lines each line having a person's name. In the same program Append to the file one line of  'Kean University'.  In the same program then Read the file and print the four lines without lines between.
In C++, write a program that reads data from a text file. Include in this program...
In C++, write a program that reads data from a text file. Include in this program functions that calculate the mean and the standard deviation. Make sure that the only global variables are the actual data points, the mean, the standard deviation, and the number of data entered. All other variables must be local to the function. At the top of the program make sure you use functional prototypes instead of writing each function before the main function... ALL LINES...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT