Skip to content

Instantly share code, notes, and snippets.

@waxzce
Created June 5, 2013 13:35
Show Gist options
  • Save waxzce/5713881 to your computer and use it in GitHub Desktop.
Save waxzce/5713881 to your computer and use it in GitHub Desktop.
package utils
object sha256 {
class StringSHAHelper(str: String) {
val md = java.security.MessageDigest.getInstance("SHA-256")
def sha_256 = (new sun.misc.BASE64Encoder).encode(md.digest(str.getBytes))
}
implicit def stringWrapper(string: String) = new StringSHAHelper(string)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment