Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iterator>
- #include <string.h>
- /*
- ---------------------------------------------------------------------
- Base Creator: ???? (If you find who did make the base I improved upon
- let me know!)
- ---------------------------------------------------------------------
- Creator: TheClashingFritz
- ---------------------------------------------------------------------
- This is my test obfuscation program.
- Ideally i'd also include some AES in here but
- this is meant to be executable on http://ideone.com.
- Check it out if you want. It's a pretty cool site.
- */
- using namespace std;
- void gen_random(char *s, const int len) {
- for (int i = 0; i < len; ++i) {
- int randomChar = rand()%(26+26+10);
- if (randomChar < 26) {
- s[i] = 'a' + randomChar;
- } else if (randomChar < 26+26) {
- s[i] = 'A' + randomChar - 26;
- } else {
- s[i] = '0' + randomChar - 26 - 26;
- }
- }
- s[len] = 0;
- }
- int main() {
- // The first 2 real key chunks with the other fake 2 attached to the end.
- string keyChunks[4] = {"EKdhtXMmr18n2", "8eMlGn7CPKsht", "1zjuSa7tcY8PB", "NdmKxIvFGNG6L"};
- //Create our first part from the real chunks.
- string keyPart1 = *new string(keyChunks[0]) + *new string(keyChunks[1]);
- //The last 2 key chunks with the fakes attached before them.
- keyChunks[0] = "5HDUmxiXiknwz";
- keyChunks[1] = "fncXGg4NB8fOJ";
- keyChunks[2] = "aKbhtZn718n2h";
- keyChunks[3] = "ZMnMlGn7C18nL";
- //Create our second part from the real chunks.
- string keyPart2 = *new string(keyChunks[2]) + *new string(keyChunks[3]);
- //Create our actual key!.
- string originalKey = *new string(keyPart1) + *new string(keyPart2);
- //Clean the key parts.
- keyPart1 = "TENFl8Zqu6k7QVrZALs7zJ9CNMYdN01t8xAOjGcdnrUQIryv";
- keyPart2 = "vhaMT0RPqShJy9q12nWXCz1QPFuHDaElmpAsM82jCT7Bx0ZV";
- char *keyArray = new char[originalKey.length()];
- memcpy(keyArray, originalKey.c_str(), originalKey.length());
- int size = *new int(originalKey.length());
- //Clean the original key.
- originalKey = "UfZNKqWi16jze4pFYEPqykkL9LTYeWaSYwUZWoPNMEkZpJiK";
- //Time to do some cleanup!
- string FillerText = "NULL";
- keyChunks[0] = *new string(FillerText);
- keyChunks[1] = *new string(FillerText);
- keyChunks[2] = *new string(FillerText);
- keyChunks[3] = *new string(FillerText);
- //Back to obfuscating then solving the key we go!
- char *key1 = new char[size];
- char *key2 = new char[size];
- char *resultKey = new char[size];
- gen_random(key1, size);
- for (int temp = 0; temp < size; temp++){
- key2[temp] = keyArray[temp] ^ key1[temp];
- }
- for (int temp = 0; temp < size; temp++){
- resultKey[temp] = key1[temp] ^ key2[temp];
- }
- //This overwrites the Key Array then we free the overwritten memory with delete[]. (Because it's an array!)
- for (int temp = 0; temp < size; temp++){
- keyArray[temp] = 'n';
- }
- delete[] keyArray;
- //Output our results!
- cout<<"Key1 Values\n";
- for (int temp = 0; temp < size; temp++){
- cout << key1[temp];
- }
- cout<<"\n\nKey2 Values\n";
- for (int temp = 0; temp < size; temp++){
- cout << key2[temp];
- }
- cout<<"\n\nResult Values\n";
- for (int temp = 0; temp < size; temp++){
- cout << resultKey[temp];
- }
- // Now let's cleanup our result arrays!
- //Techinally key1 and key2 could be ANY size however we'll clean
- //the key size just in case.
- for (int temp = 0; temp < size; temp++){
- key1[temp] = 'n';
- }
- delete[] key1;
- for (int temp = 0; temp < size; temp++){
- key2[temp] = 'n';
- }
- delete[] key2;
- //This is the one that matters most when cleaning. It's the actual result!
- for (int temp = 0; temp < size; temp++){
- resultKey[temp] = 'n';
- }
- delete[] resultKey;
- //Set the size just so people won't know the size from memory if viewed from when after we're finished.
- size = 0;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement