C# converting string to hex and XOR on Hex numbers

Posted by Scott's Oasys on Stack Overflow See other posts from Stack Overflow or by Scott's Oasys
Published on 2010-06-17T15:18:41Z Indexed on 2010/06/17 15:23 UTC
Read the original article Hit count: 615

Filed under:

Im tring to do an XOR on 2 hex numbers to create a unique hex number

ex. 7F4 ^ 65D which would equal 1A9

I understand how the XOR should work but every time I try to convert the string hex number:

string hex1 = "7F4";
int hexInt = Convert.ToInt32(hex1, 16);

I end up with a number: 2036

How do I keep the integrity of the hex number so I can do an XOR on the 2 hex numbers?

© Stack Overflow or respective owner

Related posts about c#