说明:
信息摘要算法,属于单向加密算法。
使用:
信息摘要算法,属于单向加密算法。
使用:
1.Java实现:
public class MD5Util {
public static void main(String args[]) {
try {
String password = "123456";
String md5Pwd = encrypt(password);
System.out.println("加密后:" + md5Pwd);
} catch (Exception e) {
e.printStackTrace();
}
}
public static String encrypt(String str) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(str.getBytes());
BigInteger bigInteger = new BigInteger(md.digest());
return bigInteger.toString(16);
}
}