Can anyone know how to convert the MD5 to String. In my case I have saved the password in MD5 in database. I am trying to retr
I think that is the most elegant way to do that:
public String getMD5(String data) {
String result = null;
MessageDigest md;
try {
md = MessageDigest.getInstance("MD5");
md.update(data.getBytes(Charset.forName("UTF-8")));
result = String.format(Locale.ROOT, "%032x", new BigInteger(1, md.digest()));
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException(e);
}
return result;
}
`