1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| import org.apache.commons.codec.digest.DigestUtils;
public class MD5Utils { public static String md5(String src) { return DigestUtils.md5Hex(src); }
private static final String salt = "1a2b3c4d";
public static String inputPassToFormPass(String inputPass) { String str = inputPass + salt; return md5(str); }
//编写主类进行测试 public static void main(String args[]) { String s = "aabbcc"; System.out.println("加密前:" + s); System.out.println("加密后:"+MD5Utils.inputPassToFormPass(s)); } }
|