I have checked all this afternoon, can't figure out the reason.
Here is my test code :
B4X:
Dim key(9) As Byte
key=Array As Byte(-24,43,-53,67,78,82,91,245,218,190)
Dim mstr="dsfsdfsdfsdf"
Dim k As Int=0,j As Int=0
For i = 0 To key.Length-1
If key(i)<0 Then
Log("err" & " " & i & key(i))
key(i)=Bit.And(0xFF,key(i))
Log("c " & key(i))
End If
k = key(i) / mstr.Length
j = key(i) Mod mstr.Length
Log("k=" & k & "j=" & j & "i=" & i & "key(i)=" & key(i))
Next
As you see, I want to change the Key(i) always to be the Positive value, but failed ~
Any help is Welcome ,Thank you!
To be exactly, I want change a vb6 program to b4a ,then I found b4a value is signed ,someone say use 0xFF can change it
Then I get this result.
what's right way to change it to vb6 style byte ?
After all, I find the way to change the encrypt/decode program,
It's a Character encoding problem, I change the character to gb2312,
Use the int value replace origin byte variable, no negative, & 0xFF works right~
the word runs right ...
THX