Simple Xor Encryption help

This is a discussion on Simple Xor Encryption help within the Windows Programming forums, part of the Platform Specific Boards category; Hello, I am having trouble understanding the following Xor enryption method written in C:
Code:
void gamespyxor(u_char *data, int len) ...

I would like to get PHP code or VB code that would convert whatever string of data I want using the method above. The person who wrote that code hasn't been able to explain it very well to me, and takes a long time to answer my questions, so I have come here for help with it. He did say the following though:

It's very very simple, XORing is the base for any encryption algorithm.
Each byte of the string must be XORed with "gamespy"

So I am trying to get PHP or VB to replicate the code above, and XOR any piece of text or string I want by the term 'gamespy'. However I just can't figure out exactly how to do it, or seem to understand what is really going on (in easy terms). I have been playing around with XOR functions all day in VB and php, and no matter what I do I cant get my strings to convert into what they should be. Here are some before/after examples of what SHOULD be happening when I convert a string. These types of strings are the ones I will be working with:

No worries though, no important data is being encrypted here, I am only doing this because the particular server I am working with requires text to first be XORd by the term "gamespy" or it will not communicate with a client. It also sends its replies encrypted this way, so I will have to learn how to encode/decode anything string I need to.

Hope that explains my question, thank you very much for the help! Post if you need more information.

PHP has done miracles to me, too.
If I need something that doesn't necessarily need to be a program and can be on a web site, I use PHP.
I've used it to make converters, encrypters, decrypters, calculators and other such things.

I would say that PHP is sooo easy to use and that makes it a great tool. Also it 's code is not ugly.

> I then made the string to be XORd in your guys' code the same thing: \\, and the result was ( and not ; like it should be.
Paste what you did to get the bad result (actual commands and output, not a description).

As far as I'm concerned, the fact that the round trip gets you back to where you're starting shows that the algorithm is basically working. The only thing which can change the expected return characters are
- the algorithm you posted is basically wrong
- the key you specified is wrong

Also, '\\' in C and PHP is a single character - look at the output in my previous post.

If we could get that code to XOR it the way my previous post mentioned (instead of all the characters by g as in this example), we'd have it solved! So we just need to get it to go through each character and XOR it by 'gamespy' like so:

> I then made the string to be XORd in your guys' code the same thing: \\, and the result was ( and not ; like it should be.
Paste what you did to get the bad result (actual commands and output, not a description).

As far as I'm concerned, the fact that the round trip gets you back to where you're starting shows that the algorithm is basically working. The only thing which can change the expected return characters are
- the algorithm you posted is basically wrong
- the key you specified is wrong

Also, '\\' in C and PHP is a single character - look at the output in my previous post.

Sure the algorithm works fine, but its not the correct form that the server wants. Read my post more carefully and you will see what I am looking for.

The method you posted does not do it correctly. Sure it works, but its not what I need. The code:

.. outputs a long XORd string as it should. But the first character of this XORd string should be ; and not ( as it outputs. Why? Because '\\' ^ 'g' = ;

Why g? Because it's the first character of gamespy, and \\ is the first character in the string. If it cant even start out by XORing the first character of the string correctly, why in the world do you think the code is correct?

Do it for yourself, write the code: echo '\\' ^ 'g'; and tell me if you get ; or (

I thank you for the help Salem, but calling the method correct and trying to defend it does not help me. It's not like I'm not trying to argue with you about it, I just want to get this figured out.