M
Mark
can someone tell me why the following encrypts a file
ok, but does'nt work back the other way when you run
it on a encrypted file, like its designed to.
It decrypts some of input ok, but it seems to finish
early.
{
char c;
unsigned int count=0;
unsigned int keysize=0;
key = argv[1];
keysize = key.size();
filename = argv[2];
fileOut = argv[3];
input = new ifstream(filename.c_str());
output = new ofstream(fileOut.c_str());
input->get(c);
while ( (!input->eof()))
{
char charOut;
charOut = c^key[count];
count++;
*output << charOut;
if ( count > keysize )
{
count = 0;
}
input->get(c);
}
input->close();
output->close();
delete input;
delete output;
return 0;
}
ok, but does'nt work back the other way when you run
it on a encrypted file, like its designed to.
It decrypts some of input ok, but it seems to finish
early.
{
char c;
unsigned int count=0;
unsigned int keysize=0;
key = argv[1];
keysize = key.size();
filename = argv[2];
fileOut = argv[3];
input = new ifstream(filename.c_str());
output = new ofstream(fileOut.c_str());
input->get(c);
while ( (!input->eof()))
{
char charOut;
charOut = c^key[count];
count++;
*output << charOut;
if ( count > keysize )
{
count = 0;
}
input->get(c);
}
input->close();
output->close();
delete input;
delete output;
return 0;
}