Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › MultiPlayer Game Hacks & Cheats › Combat Arms Hacks & Cheats › Combat Arms Hack Coding / Programming / Source Code › XOR Encryption Class

XOR Encryption Class

Posts 1–15 of 20 · Page 1 of 2
Saltine
Saltine
XOR Encryption Class
Here is a simple XOR encryption class:
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;
	}
};
Now an example of how to use.
First you create an object of the XOR class:
Code:
XOR* xor = new XOR();
Then to encrypt a string and save it to a variable, you would do:
Code:
char* x=xor->xorStr("lol");
The same function would decrypt the encrypted string, so to get it back, you would do:
Code:
char* orig=xor->xorStr(x);
You can use this to encrypt strings in a hack, or anywhere else
#1 · edited 14y ago · 14y ago
RE
Refrain
You realize people can view the "lol" string when you call xorStr
#2 · 14y ago
Saltine
Saltine
Create a separate app to generate encrypted strings, and decrypt them in your actual program...?
#3 · 14y ago
supercarz1991
supercarz1991
its not really encrypting if we can still see the string...
#4 · 14y ago
Saltine
Saltine
Quote Originally Posted by supercarz1991 View Post
its not really encrypting if we can still see the string...
Read the post directly above yours...
#5 · 14y ago
RE
Refrain
Quote Originally Posted by Saltine View Post
Create a separate app to generate encrypted strings, and decrypt them in your actual program...?
There lies the problem, you can't do that with the class you posted
#6 · 14y ago
Saltine
Saltine
Quote Originally Posted by Refrain View Post
There lies the problem, you can't do that with the class you posted
I realize that now, with my random key generation, I shall fix it, now.
Edit: fixed
#7 · edited 14y ago · 14y ago
AVGN
[MPGH]AVGN
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
#8 · 14y ago
RE
Refrain
Quote Originally Posted by Saltine View Post

I realize that now, with my random key generation, I shall fix it, now.
Edit: fixed
You can still find the key that you're using to encrypt the strings
#9 · 14y ago
IS
ISmokeWeedAmICoolNow
nice memory leak.
#10 · 14y ago
Jason
Jason
Quote Originally Posted by AVGN View Post
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
#11 · 14y ago
derh.acker
derh.acker
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.
#12 · 14y ago
IS
ISmokeWeedAmICoolNow
Quote Originally Posted by Jason View Post


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
it cant be a single function. it has to store the unencrypted string somehow and clean it up later.
#13 · 14y ago
Jason
Jason
Quote Originally Posted by ISmokeWeedAmICoolNow View Post
it cant be a single function. it has to store the unencrypted string somehow and clean it up later.
Of course you're right! Functions can't return data, how stupid of me.
#14 · 14y ago
IS
ISmokeWeedAmICoolNow
Quote Originally Posted by Jason View Post


Of course you're right! Functions can't return data, how stupid of me.
what are you going to return? maybe a class?
#15 · 14y ago
Posts 1–15 of 20 · Page 1 of 2

Post a Reply

Similar Threads

  • [Tutorial]Change class without respawnBy vir2000 in Game Hacking Tutorials
    0Last post 20y ago
  • Guild Wars New ClassesBy Chronologix in General Gaming
    24Last post 20y ago
  • Encryption on FilesBy HolyFate in Gunz General
    15Last post 20y ago
  • Heavy Weapons Class mine bug. I had no idea.By NukeAssault in General Gaming
    2Last post 20y ago
  • what it's like to have religion classBy ace76543 in Spammers Corner
    7Last post 19y ago

Tags for this Thread

None