-
Folder Encryption
For about two days I've been trying to figure out how to make a C++ program encrypt a folder under the FAT 32 type. I still can't figure out how to do this!
I can easily encrypt files though.
My file type:
Code:
>Enter file name: file.txt
>Enter output file name: file2.txt
>Sucessfully encrypted!!
but when I try a folder:
Code:
>Enter file name: foldername
>Error! File dosn't exist!
>
>Enter file name:
How can I encrypt a folder?
-
Did you write this program? If not, you're probably going to need to get in touch with the person who did.
If you wrote the program, what API are you using to encrypt the files? Perhaps it is only capable of encrypting files. If that's the case, then your should probably pack the folder and its contents into a single archive (using tar, perhaps, if you're on a unix system) and then encrypt that archive.
-
Folder encryption is way more complex, becasue the program must encrypt every file in it too. Look at it as a DOS process, you have to go torught every file by hand. My guess would be the program can't encrypt folders.
-
hmm. I don't use an API. I do:
Code:
void crypt(string salt, string text, string& output)
{
int a = 0;
for(int i = 0; i < text.length(); i++)
{
for (a = 0; a < salt.length(); a++)
{
if (a > salt.length())
a = 0;
text[i] += salt[a];
}
}
output = text;
ofstream utput ("output.txt");
utput << output;
utput.close();
}
void decrypt(string salt, string text, string& output)
{
int a = 0;
for(int i = 0; i < text.length(); i++)
{
for (a = 0; a < salt.length(); a++)
{
if (a > salt.length())
a = 0;
text[i] -= salt[a];
}
}
output = text;
}
-
I used the Windows API for a similiar program I wrote. You'll need to rewrite your program to recursively navigate through subfolders.
-