[MPGH]Flengo (03-04-2012),OBrozz (12-08-2011),SNIPdetta (12-08-2011)
Here is a simple XOR encryption class:
Now an example of how to use.Code:class XOR{ protected: char key[256]; public: XOR(){ key="fjsldjf84937fd7f6s876df52396tegulhghs87f53f8w987r8970w987erSDFJDFLJSGHHEIHWOHGKDFGSLGDKHSLKDGH"; } char* xorStr(char *string){ const static int len = strlen(string); char* temp = new char(len); for(int i = 0; i < len+1;i++) temp[i] = string[i]^key[i]; return temp; } };
First you create an object of the XOR class:
Then to encrypt a string and save it to a variable, you would do:Code:XOR* xor = new XOR();
The same function would decrypt the encrypted string, so to get it back, you would do:Code:char* x=xor->xorStr("lol");
You can use this to encrypt strings in a hack, or anywhere elseCode:char* orig=xor->xorStr(x);
Last edited by Saltine; 12-08-2011 at 05:06 PM.
Oh no! Vortex is gay!
[MPGH]Flengo (03-04-2012),OBrozz (12-08-2011),SNIPdetta (12-08-2011)
You realize people can view the "lol" string when you call xorStr
Create a separate app to generate encrypted strings, and decrypt them in your actual program...?
Oh no! Vortex is gay!
its not really encrypting if we can still see the string...
commando: You're probably the best non-coder coder I know LOL
Code:#ifndef _XOR_H #define _XOR_H template <int XORSTART, int BUFLEN, int XREFKILLER> class XorStr { private: XorStr(); public: char s[ BUFLEN ]; XorStr( const char * xs ); ~XorStr() { for ( int i = 0; i < BUFLEN; i++ ) s[ i ]=0; } }; template <int XORSTART, int BUFLEN, int XREFKILLER> XorStr<XORSTART,BUFLEN,XREFKILLER>::XorStr( const char * xs ) { int xvalue = XORSTART; int i = 0; for ( ; i < ( BUFLEN - 1 ); i++ ) { s[ i ] = xs[ i - XREFKILLER ] ^ xvalue; xvalue += 1; xvalue %= 256; } s[ BUFLEN - 1 ] = 0; } #endif
its different from the other one i saw
What a pointless use of templates lol.
[at]Thread:
I'm not really sure why you need to make this a class; it doesn't contain any instance-specific info. Would make a lot more sense as a single function, with a param to set a dynamic key. Also, as soon as someone tries to encrypt a string with more chars than the "key", it's going to break. Not sure why the length of the string is static either
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
When you encrypt the string "127.0.0.1" you still see the PUSH to the 127.0.0.1.
If you edit it to "127.0.0.2", the program would encrypt 127.0.0.2.
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)