Does anyone know how to convert MD5 to String . In my case, I saved the password in MD5 in the database. I am trying to recover a password and display it in a string for editing purposes.
This is what I did to convert the string to encryption format:
public static String encrypt(String source) {
String md5 = null;
try {
MessageDigest mdEnc = MessageDigest.getInstance("MD5");
mdEnc.update(source.getBytes(), 0, source.length());
md5 = new BigInteger(1, mdEnc.digest()).toString(16);
}
catch (Exception ex) {
return null;
}
return md5;
}
I do not know how to convert the encryption format to a string for editing a password.
source
share