Created
May 20, 2021 04:21
-
-
Save Jian-Min-Huang/370d9ae0eb388214cba9552934db2f2d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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