Skip to content

Instantly share code, notes, and snippets.

View dlimpid's full-sized avatar
😄
Hello!

이성원 (Seongwon Lee) dlimpid

😄
Hello!
View GitHub Profile
@dlimpid
dlimpid / string-md5.kt
Created July 7, 2017 09:34
Get MD5 hash of the string (of length 32, with leading zeros) in Kotlin
import java.math.BigInteger
import java.security.MessageDigest
fun String.md5(): String {
val md = MessageDigest.getInstance("MD5")
return BigInteger(1, md.digest(toByteArray())).toString(16).padStart(32, '0')
}