Created
June 5, 2013 13:35
-
-
Save waxzce/5713881 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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