public static String generateMD5Code(String code)
{
String resultString = null;
try
{
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
byte[] bytes = code.getBytes();
byte[] results = messageDigest.digest(bytes);
StringBuilder stringBuilder = new StringBuilder();
for(byte result : results)
{
stringBuilder.append(String.format("%02x", result));
}
resultString = stringBuilder.toString();
}
catch(NoSuchAlgorithmException ex)
{
ex.printStackTrace();
}
return resultString;
}
MD5加密
最新推荐文章于 2024-09-11 16:36:24 发布