Hi,
I am trying this code, just as posted on this forum.
It fails. I have attached a screenshot.
Thanks
I am trying this code, just as posted on this forum.
It fails. I have attached a screenshot.
Thanks
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim cifro As B4XCipher
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
End Sub
Sub Activity_Create(FirstTime As Boolean)
End Sub
Sub Encrypt(text As String, password As String) As Byte()
Dim c As B4XCipher
Return c.Encrypt(text.GetBytes("utf8"), password)
End Sub
Sub Decrypt(EncryptedData() As Byte, password As String) As String
Dim c As B4XCipher
Dim b() As Byte = c.Decrypt(EncryptedData, password)
Return BytesToString(b, 0, b.Length, "utf8")
End Sub
Dim EncryptedData() As Byte = Encrypt("confidential", "123456")
Log(Decrypt(EncryptedData, "123456"))
Attachments
Last edited: