Skip to content

Instantly share code, notes, and snippets.

@mcatta
mcatta / convert-pass-md5
Created May 8, 2013 14:08
Android/Java convert String to MD5
public static String convertPassMd5(String pass) {
String password = null;
MessageDigest mdEnc;
try {
mdEnc = MessageDigest.getInstance("MD5");
mdEnc.update(pass.getBytes(), 0, pass.length());
pass = new BigInteger(1, mdEnc.digest()).toString(16);
while (pass.length() < 32) {
pass = "0" + pass;
}