Sub Process_Globals
Public Serial1 As Serial
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("appstart")
Dim encrypted() As Byte = EncryptDecrypt("abcdef", "d23,")
Log(encrypted)
Log(EncryptDecrypt(encrypted, "d23,"))
End Sub
Private Sub EncryptDecrypt(Text() As Byte, Pattern() As Byte) As Byte()
Dim res(Text.Length) As Byte
For i = 0 To Text.Length - 1
res(i) = Bit.Xor(Text(i), Pattern(i Mod Pattern.Length))
Next
Return res
End Sub