Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


XOR based encryption .

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
benlue
Moderator
Reputation: 0

Joined: 09 Oct 2006
Posts: 2142

PostPosted: Sun Mar 18, 2007 5:35 am    Post subject: XOR based encryption . Reply with quote

Well since i have to go on a 5 day camp with my school , i thought that i would leave another tutorial .
Note ! :: This is just simple .


The XOR gate (also known as the Exclusive-OR gate) simply looks for two bits and will return one. It performs very much like an OR gate only it does not allow for both bits to be active. (Only the first or second gate can be active for it to return true, otherwise it will return false).

Now, let's take the binary string 1110001100101 - This string can be the binary equivalent to any character(s); what is relevant though is that you understand the importance at a binary level.

Well now that we have something to encrypt, let's generate a key. 101 will be the key in this example. This key can be the binary equivalent from a character or string, same deal as above.

Now with this, all we have to do is XOR the string to encrypt with the key and we get the encrypted string. Since the key is not as long as the string we wish to encrypt we will be required to cycle the key.

Code:
String to encrypt: 1110001100101
Encryption Key:    1011011011011
----------------------------------------------
Encrypted String:  0101010111110


Now we have an encrypted string safe for storage or transfer (encrypted with a 3bit encryption key).

Next, to decrypt the data all we have to do is reXOR the encrypted string with the same encryption key:

Code:
String to decrypt: 0101010111110
Encryption Key:    1011011011011
----------------------------------------------
Decrypted String:  1110001100101


The original string has been recovered and is now good for use again.

However, should a false key be used for the decryption, the data remains encrypted.

Code:
String to decrypt  0101010111110
Encryption Key:    1010101010101
----------------------------------------------
Decrypted String:  1111111101011    Not perfect .


TCP and UDP connections do not work like this unfortunately. Transmitting the key as clear text over the internet is just as bad as not having the data encrypted and if that is the intent, then you may as well not bother encrypting to begin with.

Writing the keys directly into the program also poses a problem, that if there exists more then one copy of the server / client, then they can easily be used to decrypt the other's data since they both contain the same key. While on the other hand, writing individual keys into each client, and then all of those keys into the server requires that the user identify itself in clear text, and also causes the problem that each key has to be encoded. For a subscription service, one could even use an account number as their key, though it may not take a whole lot for a hacker to realize this and, knowing a user's account number, exploit it.

One of the systems developed to overcome this situation is the dual key encryption, which is a commonly used system for PGP based encryption as some of you may already know.

It works by generating two keys, more commonly the public key and the private key. The public key would be sent to a person to encrypt the data, and after that it's no longer used, and the private key remains the only one capable of decrypting the data.

Both server and client generate the two keys and exchange public keys (since they cannot be used to decrypt). They then commonly send a challenge - a random string for the other end to return encrypted where the originating end then decrypts and verifies.

Dual key encryption requires a fair deal of explanation and will be explained in a later article, likely over the Christmas break when I have some more time off from school and work.

Though there are many small ways to help protect your keys and your data through data shifting, or even XORing the encryption key against another preset value or a second key, ultimately 1 XOR is enough in many cases where extremely sensitive information is not being broadcast.

Code:
char * EncDecString( char * InputString, char * Key ){
  char *strptr = InputString;
  char *keyptr = Key;

  for( int i=0; i < strlen( InputString ); i++ ){
    xor( strptr, kryptr );
    strptr++; keyptr++;
  }

  return InputString;
}



Done ? I won't be commenting .
Wish me a good trip . Razz
Back to top
View user's profile Send private message
Oxijen
Expert Cheater
Reputation: 0

Joined: 07 May 2020
Posts: 163
Location: On The Moon

PostPosted: Thu Feb 04, 2021 1:52 pm    Post subject: Reply with quote

bro, i guess i am not late, a nice trip Razz
_________________
I can see you Hitler
Especially When I am On the Moon!!
You are Right now in cheat engine forum Wink
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8516
Location: 127.0.0.1

PostPosted: Thu Feb 04, 2021 2:21 pm    Post subject: Reply with quote

Please do not bump 14 year old topics for no reason..
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites