Encrypting 8-bit ASCII in XOR
Posted: Wed May 12, 2010 9:23 am
This is for people who do not no anything about encryption so if u do no then there is no point in reading this. and no flaming plz.whew that's over now for the tutorial.
Encryption is a technique used to conseal data that is being sent from client to server. <--am using client/server example cause encryption is most commonly used in mmorpg games but they dont use XOR cause its easy to find the key as u will see later on.Mmorpg games in the 21st century use 128-bit keys instead of 8. Reason why a gaming company might want to conseal information between client-server is because of something called a Private Server.
A private server is created by duplicating the original game server. This is done by capturing packets sent between client-server and vice versa,then analysing the packets for the protocol i.e the encryption key. With good programming skills and a small team the server is reversed enginnered.btw private servers can make gaming companies loose a lot of profit.
Encryption is used in all walks of life, even the Government uses it. Forgive me for bein lazy but i will explain some stuff fully. Reason why i posted this tutorial is because when i started researching about encryption/decryption tutorials all i found were really hard ones which may seem intimidating to someone new to those kinda stuff.A good reason for learning encryption is because when u eventually make ur game you will want to protect the server from being reversed engineered.By knowing the basics u will find it easy comming up with hard to crack encryption/decryption routines. Just post what you dont understand.
When u first went to school the easiest maths u would have done is counting. (1,2,3,4,5)this way of counting is called the decimal counting system. But machines only have 2 state(on or off) so they cant use decimal. Instead they use something called binary which is zeros and ones.(01,10,00101 e.t.c)zero meaning off and 1 meaning on. Any decimal number can be expressed as binary e.g 5=101,15=1111,95=1011111 and so on.
That is over so now i will show how to encryp a string of text.
Lets take an example. You want to encrypt the string "Wiki" which in ASCII 8-bit is(01010111 01101001 01101011 01101001 ) using the key 11011011
This is how you do it.
ASCII stands for American Standard Code for Information Interchange .
Not going to go into details atm.
Btw try encrypting strings of text using ASCII table for the ASCII code for every letter then send it to ur mates.
It should be something bad or else it wount be fun.
My friends get paranoid
W i k i
01010111 01101001 01101011 01101001 <-- original data
11011011 11011011 11011011 11011011 <-- encryption key
-----------------------------------------------
10001100 10110010 10110000 10110010 <-- encrypted data
So you may be saying wtf is goin on here but if you have done technology studies or physics u will know that a XOR gate is similar to an OR gate but instead of getting a high output when both inputs are high you get a low output. An OR gate has 2 input and will only give a high(1) output when either one or the other inputs is high or both. But the XOR on the other hand only gives a high output when either one or the other inputs is high but not both. So if u have figured this out then lets continue, if not search on google.
Lets take the letter W as an example . The original ASCII code for it is 01010111. If our encryption key is 11011011 , when we put 01010111 on the top and our key on the bottom then we just use the XOR logic to get our encrypted data. If u still didnt get it or if u do understand and need help just pm me.
i will add more to this so plz feel free to leave comments.
Encryption is a technique used to conseal data that is being sent from client to server. <--am using client/server example cause encryption is most commonly used in mmorpg games but they dont use XOR cause its easy to find the key as u will see later on.Mmorpg games in the 21st century use 128-bit keys instead of 8. Reason why a gaming company might want to conseal information between client-server is because of something called a Private Server.
A private server is created by duplicating the original game server. This is done by capturing packets sent between client-server and vice versa,then analysing the packets for the protocol i.e the encryption key. With good programming skills and a small team the server is reversed enginnered.btw private servers can make gaming companies loose a lot of profit.
Encryption is used in all walks of life, even the Government uses it. Forgive me for bein lazy but i will explain some stuff fully. Reason why i posted this tutorial is because when i started researching about encryption/decryption tutorials all i found were really hard ones which may seem intimidating to someone new to those kinda stuff.A good reason for learning encryption is because when u eventually make ur game you will want to protect the server from being reversed engineered.By knowing the basics u will find it easy comming up with hard to crack encryption/decryption routines. Just post what you dont understand.
When u first went to school the easiest maths u would have done is counting. (1,2,3,4,5)this way of counting is called the decimal counting system. But machines only have 2 state(on or off) so they cant use decimal. Instead they use something called binary which is zeros and ones.(01,10,00101 e.t.c)zero meaning off and 1 meaning on. Any decimal number can be expressed as binary e.g 5=101,15=1111,95=1011111 and so on.
That is over so now i will show how to encryp a string of text.
Lets take an example. You want to encrypt the string "Wiki" which in ASCII 8-bit is(01010111 01101001 01101011 01101001 ) using the key 11011011
This is how you do it.
ASCII stands for American Standard Code for Information Interchange .
Not going to go into details atm.
Btw try encrypting strings of text using ASCII table for the ASCII code for every letter then send it to ur mates.
It should be something bad or else it wount be fun.
My friends get paranoid
W i k i
01010111 01101001 01101011 01101001 <-- original data
11011011 11011011 11011011 11011011 <-- encryption key
-----------------------------------------------
10001100 10110010 10110000 10110010 <-- encrypted data
So you may be saying wtf is goin on here but if you have done technology studies or physics u will know that a XOR gate is similar to an OR gate but instead of getting a high output when both inputs are high you get a low output. An OR gate has 2 input and will only give a high(1) output when either one or the other inputs is high or both. But the XOR on the other hand only gives a high output when either one or the other inputs is high but not both. So if u have figured this out then lets continue, if not search on google.
Lets take the letter W as an example . The original ASCII code for it is 01010111. If our encryption key is 11011011 , when we put 01010111 on the top and our key on the bottom then we just use the XOR logic to get our encrypted data. If u still didnt get it or if u do understand and need help just pm me.
i will add more to this so plz feel free to leave comments.