Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Release (XOR) Encript - Decript C++

Newbie Spellweaver
Joined
May 23, 2012
Messages
73
Reaction score
42
//---------------------------------------------------------------------------

#pragma hdrstop

#include "XORCrypt.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
//---------------------------------------------------------------------------
AnsiString XOR_Crypt(AnsiString Input, AnsiString Key)
{
AnsiString Out;
for (int i=1,k=1; i<=Input.Length(); ++i,++k)
{
if( k>Key.Length() ) k=1;

int dig = Input ^ Key[k];
Out += IntToHex(dig,2);
}
return Out;
}
//---------------------------------------------------------------------------
AnsiString XOR_Encrypt(AnsiString Input, AnsiString Key)
{
AnsiString Out;
for (int i=1,k=1; i<=Input.Length(); i+=2,++k)
{
if( k>Key.Length() ) k=1;

int dig = StrToInt ( "0x"+Input.SubString(i,2));
Out += char(dig ^ Key[k]);
}
return Out;
}
//---------------------------------------------------------------------------


 
Back
Top