Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
Dim password As String = "123456"
Dim text As String = "top secret"
Dim b() As Byte = EncryptText(text, password)
Log(DecryptText(b, password))
End Sub
Sub EncryptText(text As String, password As String) As Byte()
#if b4a
Dim c As B4XCipher
#Else
Dim c As Cipher
#End If
Return c.Encrypt(text.GetBytes("utf8"), password)
End Sub
Sub DecryptText(EncryptedData() As Byte, password As String) As String
#if b4a
Dim c As B4XCipher
#Else
Dim c As Cipher
#End If
Dim b() As Byte = c.Decrypt(EncryptedData, password)
Return BytesToString(b, 0, b.Length, "UTF8")
End Sub