David Hawkins Active Member Licensed User Longtime User Jun 20, 2023 #1 Hi I am using the following code to encrypt a password so that it can be compared to a saved password in a database Code: Sub EncryptText(sPassword As String, passcode As String) As Byte() Dim c As B4XCipher Return c.Encrypt(sPassword.GetBytes("utf8"), passcode) End Sub and whilst the encryption is working OK the encrypted string is never the same so it can't be compared to that saved in the database, is there an encryption library which will enable me to use it in both B4A and B4I? without the encrypted string changing I hope I have made that clear Regards David
Hi I am using the following code to encrypt a password so that it can be compared to a saved password in a database Code: Sub EncryptText(sPassword As String, passcode As String) As Byte() Dim c As B4XCipher Return c.Encrypt(sPassword.GetBytes("utf8"), passcode) End Sub and whilst the encryption is working OK the encrypted string is never the same so it can't be compared to that saved in the database, is there an encryption library which will enable me to use it in both B4A and B4I? without the encrypted string changing I hope I have made that clear Regards David
aeric Expert Licensed User Longtime User Jun 21, 2023 #2 https://www.b4x.com/android/forum/pages/results/?query=B4X+AES Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jun 21, 2023 #3 David Hawkins said: Hi I am using the following code to encrypt a password so that it can be compared to a saved password in a database Click to expand... Why? Best practice is to store the hash of the password + salt. This way the original password can never be revealed. You can calculate the hash with the Encryption library in B4A / B4J and iEncryption in B4i. Upvote 0
David Hawkins said: Hi I am using the following code to encrypt a password so that it can be compared to a saved password in a database Click to expand... Why? Best practice is to store the hash of the password + salt. This way the original password can never be revealed. You can calculate the hash with the Encryption library in B4A / B4J and iEncryption in B4i.
David Hawkins Active Member Licensed User Longtime User Jun 21, 2023 #4 Hi Erel I will give it a try. Regards David Upvote 0