The problem is with DecToHex, it doesn't always return two characters so the data is being truncated. You need something like this.
Code:
For i = 0 To ArrayLen(secret())-1
If secret(i)< 16 Then s = s & "0"
s = s & bit.DecToHex(secret(i))
Next
EDIT:- Typo in the code above corrected, was 15 now 16