Return MD5 from string

krisdouglas

Member
Licensed User
Longtime User
[howto] Return MD5 from string

Hello,

I am trying to return an MD5 from a string,

The expected result is something like c2eaa4c670cd4c1c537b2a2ae4fbeb5d from the string "ding".

However I am getting something completely different, I think I am having a bit of a moron moment.

I was wondering what the best practice was with regards to this.

Thank you.
 
Last edited:

krisdouglas

Member
Licensed User
Longtime User
OK, to answer my own question, the following is needed:

Libs:
ByteConverter
Encryption

B4X:
Dim md As MessageDigest
Dim ByteCon As ByteConverter
Dim passwordhash() As Byte

passwordhash = md.GetMessageDigest(p.GetBytes("UTF8"),"MD5")

dim md5string as String

md5string = ByteCon.HexFromBytes(passwordhash)

msgbox(md5string,"This is the MD5")
 
Last edited:
Upvote 0

socialnetis

Active Member
Licensed User
Longtime User
Hi, isn't the hash suppose to have numbers, and uppercase and lowercase letters?
I only get number and uppercase letters
 
Upvote 0
Top