public class MD5Util {
public static String getMD5Str(String str) {
byte[] digest = null;
try {
MessageDigest md5 = MessageDigest.getInstance("md5");
digest = md5.digest(str.getBytes("utf-8"));
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
//16是表示轉(zhuǎn)換為16進(jìn)制數(shù)
String md5Str = new BigInteger(1, digest).toString(16);
return md5Str;
}
}
歡迎 qq: 2669422676 微信:13717660329 交流