Created
May 8, 2013 14:08
-
-
Save mcatta/5540674 to your computer and use it in GitHub Desktop.
Android/Java convert String to MD5
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
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; | |
} | |
password = pass; | |
} catch (NoSuchAlgorithmException e1) { | |
e1.printStackTrace(); | |
} | |
return password; | |
} |
Thank you a lot :)))
thanks a lot :)))
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you =)