VeeDub Posted June 1, 2006 Share Posted June 1, 2006 Hi, I am trying to perform some bit operations on 32 bit addresses, but I cannot get it to work. The issue I think is that the BitXOR function requires values rather than strings. If I try to supply a 32 bit number as a value directly: $x = BitXOR(4c250e81,9be548aa) Then I get a syntax error. But if I provide the values as strings, then I get a nonsense answer. At the moment the only way I can see to get around this is to convert the hexadecimal values to their integer equivalent - and then convert it back afterwards. Which I can do, but I wonder if I'm missing something really simple here. Thanks VW Link to comment Share on other sites More sharing options...
w0uter Posted June 1, 2006 Share Posted June 1, 2006 add '0x' My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
VeeDub Posted June 2, 2006 Author Share Posted June 2, 2006 add '0x'Thanks for that, I'm glad I asked.Cheers,VW Link to comment Share on other sites More sharing options...
VeeDub Posted June 2, 2006 Author Share Posted June 2, 2006 Sorry, I haven't got this quite worked out, another question. I don't understand why the following two examples produce different results: $x = BitXOR(0x4c250e81,0x9be548aa) MsgBox(0,"X",$x) $X = -675264981 $z = "9be548aa" $y = BinaryString($z) $x = bitxor(0x4c250e81,$y) MsgBox(0,"X",$x) $X = 1277497016 Thanks VW Link to comment Share on other sites More sharing options...
VeeDub Posted June 3, 2006 Author Share Posted June 3, 2006 OK, I have figured this out, for the second example to work it needs to be as follows:$z = "9be548aa" $y = Dec($z) $x = bitxor(0x4c250e81,$y) MsgBox(0,"X",$x)$X = -675264981Basically the binarystring function doesn't work the way that I expected it too. This thread explains more.CheersVW Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now