Reputation: 1
Could somebody explain to me, why if input string from textbox is decimal 21 (&H32 &H31
) it returns me 63 instead of 3
Thanks in advance.
Here is my code:
Dim BCCXOR As Integer = &H0
For i As Integer = 0 To TextBox1.TextLength - 1
BCCXOR = (BCCXOR) Xor Hex(Strings.Asc(TextBox1.Text.Substring(i, 1).ToString()))
Next
Label1.Text = BCCXOR
Upvotes: 0
Views: 61
Reputation: 102
Because you are asking him to use the ascii value.
The code below actually uses the number
Dim BCCXOR As Integer = &H0
For i As Integer = 0 To TextBox1.TextLength - 1
BCCXOR = (BCCXOR) Xor Hex(Cint(TextBox1.Text.Substring(i, 1).ToString()))
Next
Label1.Text = BCCXOR
Upvotes: 1