Skip to content

Instantly share code, notes, and snippets.

@Jian-Min-Huang
Created May 20, 2021 04:21
Show Gist options
  • Save Jian-Min-Huang/370d9ae0eb388214cba9552934db2f2d to your computer and use it in GitHub Desktop.
Save Jian-Min-Huang/370d9ae0eb388214cba9552934db2f2d to your computer and use it in GitHub Desktop.
fun String.md5() =
MessageDigest.getInstance("MD5")
.also {
it.update(this.toByteArray(StandardCharsets.UTF_8))
}.run {
this.digest().toHexString()
}
println("abc".md5())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment