Created
August 15, 2014 13:33
-
-
Save keyle/152ffa04cd2ff40cbad6 to your computer and use it in GitHub Desktop.
String MD5 hash
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 | |
| import java.security.MessageDigest | |
| class Hash { | |
| static String md5(String s) { | |
| MessageDigest md5 = MessageDigest.getInstance("MD5"); | |
| md5.update(s.getBytes()); | |
| BigInteger hash = new BigInteger(1, md5.digest()); | |
| return hash.toString(16); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment