The problem is this line
secret() = StrSplit(secodes,"-")
By reassigning the secret array with the return of StrSplit you are changing it from an array of Bytes to an array of Strings which is what StrSplit returns.
I have had a private discussion with Erel about this sort of thing because allowing arrays to change type can cause hard to explain errors. I personally would rather that once an array was Dimmed it had to keep its type thereafter.
HexToBytes in my ByteConverter libarary
http://www.basic4ppc.com/forum/addit...r-library.html should do what you want.
EDIT
I should have looked a bit further as well. This line isn't doing what you think
secret(i)=bit.HexToDec(secret(i))
Code:
secret() = StrSplit(secodes,"-") ' array of strings - each of two hex characters
For i = 0 To ArrayLen(secret())-1
secret(i)=bit.HexToDec(secret(i)) ' each string now a string representation of the decimal value of the hex.
Next
I know that the help for HexToDec says it returns an Int32, it does but B4ppc converts it to a string to store it.