Generate MD5 Hash using Kotlin

MessageDigest class

package app

import java.math.BigInteger
import java.security.MessageDigest

fun main()
{
    val text = "Hello"
    val crypt = MessageDigest.getInstance("MD5");
    crypt.update(text.toByteArray());
    val digest = BigInteger(1, crypt.digest()).toString(16)

    println(digest)
}

Leave a Comment

Cancel reply

Your email address will not be published.