This is the XXTEA function ported to Monkey. EDIT: OK, simplistic string support is now given. It uses the databuffer to bypass encoding/decoding of strings.
Small example that i used for testing:
Strict
Import "xxtea.monkey"
Function Main:Int()
Local ar:Int[1024]
Local k:=[123, 456, 769, 123]
ar[15] = 12345
XXTea.btea(ar, (ar.Length - 1), k)
Print ar[15]
XXTea.btea(ar, - (ar.Length - 1), k)
Print ar[15]
Print XXTea.DecryptString(XXTea.EncryptString("Hello world, how are you ?", k), k)
Return 0
End
|