@@ -0,0 +1,827 @@
+package com.lance.freemaker.utils;%0A%0Aimport java.nio.charset.Charset;%0Aimport java.security.MessageDigest;%0Aimport java.security.NoSuchAlgorithmException;%0A%0Apublic final class EncryptUtils %7B%0A%09%0A%09private EncryptUtils()%7B%0A%09%09%0A%09%7D%0A%09%0A%09/**%0A%09 * MD5%E5%8A%A0%E5%AF%86%0A%09 * @param password%0A%09 * @return%0A%09 */%0A%09public synchronized static String encryptMD5(String password)%7B%0A%09%09Charset utf8 = Charset.forName(%22UTF-8%22);%0A%09%09StringBuilder builder = new StringBuilder();%0A%09%09try %7B%0A%09%09%09MessageDigest md5 = MessageDigest.getInstance(%22MD5%22);%0A%09%09%09md5.update(password.getBytes(utf8));%0A%09%09%09byte%5B%5D b = md5.digest();%0A%09%09%09for (int i=0; i%3Cb.length; i++) %7B%0A%09%09%09%09String hex = Integer.toHexString(0xff & b%5Bi%5D);%0A%09%09%09 %09if(hex.length()==1) builder.append('0');%0A%09%09%09 %09builder.append(hex);%0A%09%09%09%7D%0A%09%09%7D catch (NoSuchAlgorithmException e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A%09%09return builder.toString();%0A%09%7D%0A%7D

add resource