Hi,
for a project, I have to calculate a checksum that would be the XOR of every individual ascci character.
For example -> (string) "12".
-> Character 1 = Ascii 0x31 = binary 110001
-> Character 2 = Ascii 0x32 = binary 110010
0x31 XOR 0x32 = 0x003 (according to my windows calculator)
110001 XOR 110010 = 000011 (= 0x003) - this is also correct, since the last 2 digits are uneven resulting in binary value 1
But I can't seem to get this programmed in vb.net. I think there's a conversion somewhere, but I can't get it right... (I read the string "12" from a textbox)
I tried this:
The messagebox returns "63", but I have no idea how this is achieved. Can I convert this to the hexadecimal value?
The StrToHex("1") returns "31" so, the conversion seems correct.
After this, I can try a for each block to cycle through each character from the textbox... Hope someone can help me with this issue...
for a project, I have to calculate a checksum that would be the XOR of every individual ascci character.
For example -> (string) "12".
-> Character 1 = Ascii 0x31 = binary 110001
-> Character 2 = Ascii 0x32 = binary 110010
0x31 XOR 0x32 = 0x003 (according to my windows calculator)
110001 XOR 110010 = 000011 (= 0x003) - this is also correct, since the last 2 digits are uneven resulting in binary value 1
But I can't seem to get this programmed in vb.net. I think there's a conversion somewhere, but I can't get it right... (I read the string "12" from a textbox)
I tried this:
VB.NET:
Dim result As String
result = StrToHex("1") Xor StrToHex("2")
MsgBox(result)
The StrToHex("1") returns "31" so, the conversion seems correct.
After this, I can try a for each block to cycle through each character from the textbox... Hope someone can help me with this issue...