Skip to content

Instantly share code, notes, and snippets.

@keyle
Created August 15, 2014 13:33
Show Gist options
  • Select an option

  • Save keyle/152ffa04cd2ff40cbad6 to your computer and use it in GitHub Desktop.

Select an option

Save keyle/152ffa04cd2ff40cbad6 to your computer and use it in GitHub Desktop.
String MD5 hash
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