I guess I had posted an older version of the .h file. Here's a new one.
This algorithm successfully encrypted, and decrypted a file called netscan.exe. That attachment here will contain the source. A CPP which is a UI, and an H, which is the algorithm above. Also is a compiled version, with Dev-C++. I'll have another post containing the netscan and it's encrypted version. I changed the extension of Archive.exe to a .ZIP so I could attach it here. Rename the file to Archive.exe, and extract everything.Code:#include <fstream.h> void encrypt(char *filein, char *fileout, long key, long key2); //encryption routine void decrypt(char *filein, char *fileout, long key, long key2); //decryption routine char ch; void encrypt(char *filein, char *fileout, long key, long key2) { ifstream in(filein, ios::binary); ofstream out(fileout, ios::trunc | ios::binary); srand(key); key = rand() % key2 + 3; srand(key2); key2 = rand(); while(!in.eof()) { in.get(ch); ch += key; ch += key2 % key; out.put(ch); } in.close(); out.close(); exit(0); } void decrypt(char *filein, char *fileout, long key, long key2) { ifstream in(filein, ios::binary); ofstream out(fileout, ios::trunc | ios::binary); srand(key); key = rand() % key2 + 3; srand(key2); key2 = rand(); while(!in.eof()) { in.get(ch); ch -= key2 % key; ch -= key; out.put(ch); } in.close(); out.close(); exit(0); }




Reply With Quote