public static String convertToMD5(String input) throws Exception {
String md5 = null;
if (null == input)
return null;
try {
// Create MessageDigest object for MD5
MessageDigest digest = MessageDigest.getInstance("MD5");
// Update input string in message digest
digest.update(input.getBytes(), 0, input.length());
// Converts message digest value in base 16 (hex)
md5 = new BigInteger(1, digest.digest()).toString(16);
} catch (NoSuchAlgorithmException e) {
throw e;
}
return md5;
}
使用以下代码对字符串进行加密,我想解码MD5加密以获得普通字符串?你能帮忙吗?