February 1st, 2000, 05:02 PM
I'm a newbie to php3 and wanted to convert an asp-site to php3. Therefore I need a bitwise XOR command. I just could find logical XOR and bitwise AND and OR but not bitwise XOR. I know that some mathematicians will laugh about that, but it's a long time ago where I had calculated with this stuff (at least I think it is possible to combine the other bitwise operators, but I don't know how to).
Please help, thanks in advance.
February 2nd, 2000, 08:15 PM
The caret (^) character is the bitwise exclusive-or operator:
11 ^ 13 == 6
(11 is binary 1011
13 is binary 1101
06 is binary 0110)
PS - I'm so curious: Why do you need this? When I described these operators in my book, I stated that they were rarely used in PHP. You're making me look bad
[This message has been edited by scollo (edited February 02, 2000).]
February 3rd, 2000, 05:51 AM
Thank you very much Christopher,
I need bitwise XOR for an decryption engine which I have developed about a year ago. With a good friend we had programmed a small advertising game called "PHYSIKUS DriveIn" ("www.physikus.de", section "DriveIn"). It's a quite funny game with which you can win something. The cryption engine was embedded into VisualBasic and will now be ported to C++ for better performance. With this engine we have encoded the hiscore of the game into an alphanumerical code using a multiple shifting XOR sieve. There are several arrays with secret numbers as XOR sieves which have to be run through by the hiscore. It's a little bit like DES (of course less secure). I had no experience in dynamic web programming that time so we outsourced the online decryption engine to another company which programmed it in ASP. Today we want to make more of these games but don't want to use ASP any more (other companies always take more than i will take for myself...) That's why I want to use PHP for it.
Well, I made the same experience. I have bought the only two books on PHP which where ever published here in Germany. But both ones, written from different auhtors, doesn't include bitwise XOR even in their reference. One of these books has even 732 pages without the reference part. With reference this book counts over 1000 pages. So I never thought it could be possible that this huge tome could miss anything... But before that I could never imagine to use bitwise XOR, too. It's really not difficult programming but anything else but everyday usage of a programming language.
So after all I don't think I'm really making you looking bad At least you have mentioned bitwise XOR in contrast to the German books I have bought. Perhaps you can tell me where I can buy your book?
February 3rd, 2000, 12:03 PM
I checked out physikus.de. It looks great. Why don't I get to do the fun projects like that? Vielleicht muss ich wieder nach deutschland umziehen.
This is the sort of shameless self-promotion that I never thought I would do, but judging from my email, most of the DevShed Discussion Forum people already seem to know about my book anyway. So here you go:
Professional PHP Programming
If you like the "independent" bookstore thing, you can try http://www.codysbooks.com/ and do a search for "scollo". Or you can find it at the publisher's site: http://www.wrox.com/Consumer/Store/D...SBN=1861002963
I hope you enjoy it.