MD5的用法之加密
简单应用:public String md5(String toChapter) {
String str = "";
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(toChapter.getBytes());
byte[] buf = md.digest(toChapter.getBytes());
BigInteger bi = new BigInteger(buf);
str = bi.toString(36);// 36进制数的字符串形式
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return str;
}
调用:
System.out.println(high.md5("-3i6yl6rk0wpuvopdqpal6y8v9"));
System.out.println(high.md5("中文").equals(high.md5("中文")));
补充:综合编程 , 安全编程 ,