Encrypting 8-bit ASCII in XOR
Moderator: Coders of Rage
-
- Chaos Rift Newbie
- Posts: 9
- Joined: Wed May 12, 2010 8:32 am
- Current Project: TwelveSky2 Hacks
- Favorite Gaming Platforms: PC,PS3
- Programming Language of Choice: c#
- Contact:
Encrypting 8-bit ASCII in XOR
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.
Last edited by saluege on Wed May 12, 2010 6:30 pm, edited 3 times in total.
- programmerinprogress
- Chaos Rift Devotee
- Posts: 632
- Joined: Wed Oct 29, 2008 7:31 am
- Current Project: some crazy stuff, i'll tell soon :-)
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C++!
- Location: The UK
- Contact:
Re: Encrypting 8-bit ASCII in XOR
Possibly the wrong section, this should probably be in code snippets. (although I'm not sure, since there isn't really any code)
I didn't like your tone either, telling people to "go die" is hardly a good thing to say if you want people to take you seriously.
Spelling correctly would go a long way too, if you wish to convey your message to its fullest.
other than that, sound advice, not everyone knows how XOR ASCII characters I guess, and it could be useful for some people's projects, I once tried to make an XOR encryption program when I was bored, I also made it so you could feed a file in with the command line arguments then send it back out to another file you specified.
I didn't like your tone either, telling people to "go die" is hardly a good thing to say if you want people to take you seriously.
Spelling correctly would go a long way too, if you wish to convey your message to its fullest.
other than that, sound advice, not everyone knows how XOR ASCII characters I guess, and it could be useful for some people's projects, I once tried to make an XOR encryption program when I was bored, I also made it so you could feed a file in with the command line arguments then send it back out to another file you specified.
---------------------------------------------------------------------------------------
I think I can program pretty well, it's my compiler that needs convincing!
---------------------------------------------------------------------------------------
And now a joke to lighten to mood :D
I wander what programming language anakin skywalker used to program C3-PO's AI back on tatooine? my guess is Jawa :P
I think I can program pretty well, it's my compiler that needs convincing!
---------------------------------------------------------------------------------------
And now a joke to lighten to mood :D
I wander what programming language anakin skywalker used to program C3-PO's AI back on tatooine? my guess is Jawa :P
-
- Chaos Rift Newbie
- Posts: 9
- Joined: Wed May 12, 2010 8:32 am
- Current Project: TwelveSky2 Hacks
- Favorite Gaming Platforms: PC,PS3
- Programming Language of Choice: c#
- Contact:
Re: Encrypting 8-bit ASCII in XOR
k buddy will make it more reader friendly.soz about my spelling . english isnt my native language. but anyways will explain ASCII fully some other time. atm am coding.
- Bakkon
- Chaos Rift Junior
- Posts: 384
- Joined: Wed May 20, 2009 2:38 pm
- Programming Language of Choice: C++
- Location: Indiana
Re: Encrypting 8-bit ASCII in XOR
Good lord, I don't even know where to start or even if I should. If your intention is to be helpful, you're not doing a very good job of it.
The "opposite" of an OR gate is a NOR gate. Exclusive OR is basically 0 if the inputs are the same and 1 otherwise. (i.e if and only if OR)saluege wrote:if u have done technology studies or physics u will know that a XOR gate is the opposite of an OR gate
I'll give you a hint: start with two very large prime numbers.saluege wrote:am currently inventing my own encryption routine using 2 different keys for encryption and decryption.
Good luck with that.saluege wrote:and no flaming or else i will punch ur face in.
Last edited by Bakkon on Wed May 12, 2010 4:02 pm, edited 3 times in total.
- short
- ES Beta Backer
- Posts: 548
- Joined: Thu Apr 30, 2009 2:22 am
- Current Project: c++, c
- Favorite Gaming Platforms: SNES, PS2, SNES, SNES, PC NES
- Programming Language of Choice: c, c++
- Location: Oregon, US
Re: Encrypting 8-bit ASCII in XOR
must you be so condescending in your post?
My github repository contains the project I am currently working on,
link: https://github.com/bjadamson
link: https://github.com/bjadamson
- hurstshifter
- ES Beta Backer
- Posts: 713
- Joined: Mon Jun 08, 2009 8:33 pm
- Favorite Gaming Platforms: SNES
- Programming Language of Choice: C/++
- Location: Boston, MA
- Contact:
Re: Encrypting 8-bit ASCII in XOR
thisshort wrote:must you be so condescending in your post?
"Time is an illusion. Lunchtime, doubly so."
http://www.thenerdnight.com
http://www.thenerdnight.com
- GroundUpEngine
- Chaos Rift Devotee
- Posts: 835
- Joined: Sun Nov 08, 2009 2:01 pm
- Current Project: mixture
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C++
- Location: UK
Re: Encrypting 8-bit ASCII in XOR
PiP summed it up it one.
saluege wrote:and no flaming or else i will punch ur face in.
Just sayin.GroundUpEngine Profile wrote:Interests: Muay Thai
Re: Encrypting 8-bit ASCII in XOR
... Um... Wow... Thanks, I guess? but uh, I guess its a good tutorial, but uh, you might wanna 1.) get some of your facts straight (this actually wasn't too bad but there were a couple of instances) 2.) Don't be so narcissistic in your tutorials, it sounded to me you were trying to make it so you look superior to those you are trying to teach (this is better shown with a nice, well done, facts only just helping you out tutorial. You know, show that you have some knowledge and other people will appreciate that) 3.) well I would say spelling, but since English isn't your native language, it wasn't too bad... and finally I guess... I don't know go into some more detail on why this is helpful and why you'd need it, I mean you did give the MMO example but I mean you could probably show some more..
But anyways haven't seen you around before, so welcome to the forums :D
But anyways haven't seen you around before, so welcome to the forums :D
-
- Chaos Rift Newbie
- Posts: 9
- Joined: Wed May 12, 2010 8:32 am
- Current Project: TwelveSky2 Hacks
- Favorite Gaming Platforms: PC,PS3
- Programming Language of Choice: c#
- Contact:
Re: Encrypting 8-bit ASCII in XOR
i was kinda bored when writing it so i got carried away. And i got XOR(Exclusive OR) and NOR(OR with an inverter) mixed up .eatcomics wrote:... Um... Wow... Thanks, I guess? but uh, I guess its a good tutorial, but uh, you might wanna 1.) get some of your facts straight (this actually wasn't too bad but there were a couple of instances) 2.) Don't be so narcissistic in your tutorials, it sounded to me you were trying to make it so you look superior to those you are trying to teach (this is better shown with a nice, well done, facts only just helping you out tutorial. You know, show that you have some knowledge and other people will appreciate that) 3.) well I would say spelling, but since English isn't your native language, it wasn't too bad... and finally I guess... I don't know go into some more detail on why this is helpful and why you'd need it, I mean you did give the MMO example but I mean you could probably show some more..
But anyways haven't seen you around before, so welcome to the forums :D
Re: Encrypting 8-bit ASCII in XOR
You did that, and I think you had a bit that was shifted or something... IDK I may have just made a mistake but it still is a pretty good tutorial :D I hope to see more
-
- Chaos Rift Newbie
- Posts: 9
- Joined: Wed May 12, 2010 8:32 am
- Current Project: TwelveSky2 Hacks
- Favorite Gaming Platforms: PC,PS3
- Programming Language of Choice: c#
- Contact:
Re: Encrypting 8-bit ASCII in XOR
ty dudeeatcomics wrote:You did that, and I think you had a bit that was shifted or something... IDK I may have just made a mistake but it still is a pretty good tutorial :D I hope to see more