Last active
June 9, 2017 06:46
-
-
Save axtstar/57cd2417fedfec16dd527e6bcdf399ec to your computer and use it in GitHub Desktop.
make SHA-256 digest and BASE64 encode on scala
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
def getSha256MD(input:String) = { | |
val md = java.security.MessageDigest.getInstance("SHA-256") | |
val ha = new sun.misc.BASE64Encoder().encode(md.digest(input.getBytes)) | |
ha | |
} | |
val input = "input" | |
getSha256MD(input) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment