Reputation: 14330
I'm trying to generate MD5 of a string in my android code using kotlin..
val md5 = MessageDigest.getInstance("MD5")
val hash = md5.digest(queryToSign.toByteArray(Charset.defaultCharset())).toString()
But this gives me:
[B@118072
Any thoughts?
Upvotes: 6
Views: 3828
Reputation: 1
byteArrayOf(80,87,68).decodeToString()
= PWD
click here to see how it works
Upvotes: 0
Reputation: 14330
Solved it.. Use BigInteger
val md5 = MessageDigest.getInstance("MD5")
val hash = BigInteger(1, md5.digest(queryToSign.toByteArray(Charset.defaultCharset()))).toString(16)
Upvotes: 6