JustAnswer > Programming
Ask A Question|Register|Login|Help
JustAnswer

Programming

Ask a Programming Question, Get an Answer ASAP!

Have your own Programming question?

4 Programmers are Online Now
characters left:
Not a Programming Question?
Bookmark and Share

Question

I need to write a simple program in C++ that encrypts and then decrypts a user provided file. I need to ask the user for input/output files, generate a random key, and then xor it with the user's file. I need to process the data in bytes, so all reading and writing of files must use the char type. I also have to use functions for the encrypt/decrypt portion and use a while loop for the xor. Please help!!!

Submitted: 148 days and 4 hours ago.
Category: Programming
Value: $22
Status: AWAITING EXPERT REPLY
+
Read More

Optional Information



Already Tried:
This is what I have so far (not sure if it is correct though):
#include <fstream>
#include <cstdlib>
#include <iostream>
#include <string>


using namespace std;




void encrypt ();
void decrypt ();

void main ()
{
char choice;
cout << "Do you want to encrypt or decrypt?" << endl;
cout << "Enter E for encrypt or D for decrypt:    ";
cin >> choice;

if (choice =='E')
    encrypt ();
else
    decrypt ();
}             & nbsp;                                           //good to this point

void encrypt ()
{
     ifstream sourceFile;
    ofstream encryptFile;
    string userFile;
    string tempFile;
    char randKey = rand();

    cout << "Please enter the name of the file you wish to encrypt: ";               //source1--need to check if exists
     cin >> userFile;
    sourceFile.open(userFile.c_str());
     cout << "Enter the name of the file you wish to store your encrypted file in: ";
     cin >> tempFile;
    &nb sp;encryptFile.open(tempFile.c_str());                                        //good to this point
     encryptFile << randKey;

     while (randKey ^ userFile)
     
     
}

                

void decrypt ()
{}

+
Read More

Related Programming Questions

  • i try to get internet Exlorer
  • my system keeps bringing up this messg every time i log in
  • http://www.mediafire.com/?4o1irizhhmw here I need help with
  • http://www.mediafire.com/?4o1irizhhmw need help with visual
  • which frame work is good for java programming
  • write a windows application, in visual basic express 2008,
  • I am trying to format a formula for my spreadsheet and I nee...
  • I am formulating E11 in my spreadsheet. I want to take the



Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.
Question List | Become an Expert | Terms of Service | Security & Privacy | About Us
© 2003-2009 JustAnswer Corp.