import java.security.MessageDigest;

public class md5crack{

//MD5密码算法
   //MD5算法
      public final static String MD5_orginal(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();
            MessageDigest mdInst = MessageDigest.getInstance("MD5");
            mdInst.update(btInput);
            byte[] md = mdInst.digest();
            int j = md.length;
            char str[] = new char[j * 2];
            int k = 0;
            for (int i = 0; i < j; i++) {
                byte byte0 = md[i];
                str[k++] = hexDigits[byte0 >>> 4 & 0xf];
                str[k++] = hexDigits[byte0 & 0xf];
            }
            return new String(str);
        }
        catch (Exception e) {
            // e.printStackTrace();
            return null;
        }
    }
   
   
    //添加干扰项后的md5算法
    public final static String MD5(String s){
     String tmp1 = MD5_orginal(s);  //将s进行md5加密
     String tmp2 = MD5_orginal("ldcmgs.com");//将ldcmgs.com进行加密
     String r = new String();
        StringBuffer sb = new StringBuffer(100);
       
        for(int i=0; i<32; i++){
         sb.append(tmp1.charAt(i));
         sb.append(tmp2.charAt(i));
        }
       
        r = sb.toString();
        r = r.substring(7,32)+"X"+r.substring(33,56);
       
        return r;
   }   

public static void main (String args[]){
     String name = "admin";
  System.out.println(MD5(name));
   }
}