Skip to content

Instantly share code, notes, and snippets.

@arjones
Forked from stonegao/gist:1044641
Created September 24, 2011 14:01
Show Gist options
  • Save arjones/1239358 to your computer and use it in GitHub Desktop.
Save arjones/1239358 to your computer and use it in GitHub Desktop.
MD5 in scala
object MD5 {
def hash(s: String) = {
val m = java.security.MessageDigest.getInstance("MD5")
val b = s.getBytes("UTF-8")
m.update(b, 0, b.length)
new java.math.BigInteger(1, m.digest()).toString(16)
}
}
@parallelepiped
Copy link

Worked for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment