用Java自帶的MD5加密
阿新 • • 發佈:2019-02-13
package test.md5;
import java.security.MessageDigest;
public class MD5Util { public final static String MD5(String s) { char hexDigits[]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
try { byte[] btInput = s.getBytes(); // 獲得MD5摘要演算法的 MessageDigest 物件
public static void main(String[] args) { System.out.println(MD5Util.MD5("20121221")); System.out.println(MD5Util.MD5("加密")); }}