iOS Question md5 of a string

tufanv

Expert
Licensed User
Longtime User
Hello,

I tried to convert a b4a example to b4i but couldnt work it out. Can you help me convert a simple string to md5 ?

TY
 

JanPRO

Well-Known Member
Licensed User
Longtime User
Hi,

you can use the following sub:
B4X:
Sub GetMD5 (Text As String) As String
    Dim MD As MessageDigest
    Dim Data() As Byte =  MD.GetMessageDigest(Text.GetBytes("UTF8"),"MD5")
    Dim BC As ByteConverter
    Return BC.HexFromBytes(Data)
End Sub

Don't forget to reference to the iEncryption and iRandomAccessFile library ;)
 
Upvote 0
Top