justwait 发表于 2011-3-29 19:55:42

有懂java的没?帮个忙!

1.import java.io.UnsupportedEncodingException;
2.import java.security.MessageDigest;
3.import java.security.NoSuchAlgorithmException;
4.import java.util.HashMap;
5.import java.util.Map;
6.
7.
8.public class Util {
9.    private static Map<String, Integer> map = new HashMap<String, Integer>();
10.      
11.    private static int getIncByName(String keyName){
12.      if(map.size() == 0){
13.            map.put("97ba558178f22af9", 1);
14.            map.put("8a57faa3ff0c2cd0", 2);
15.            map.put("b05395426617a666", 3);
16.            map.put("8054b38ece415448", 4);
17.            map.put("5a0815d2500be4c3", 5);
18.            map.put("cb47e040c444bb13", 6);
19.            map.put("4f0b466d4e838204", 7);
20.            map.put("9bb033dd03a03a21", 8);
21.            map.put("a548d6aefbeb32e0", 9);
22.            map.put("c156d1c03531d5f6", 10);
23.      }
24.      if(map.containsKey(keyName)){
25.            int v = map.get(keyName);
26.            return v;
27.      }
28.      throw new RuntimeException("无法找到keyName:"+keyName);   
29.    }
30.      
31.    /**
32.   * 取到sig
33.   */
34.    public static String getSig(String key, String keyName){
35.      int inc = getIncByName(keyName);
36.         
37.      String _local2= Md5(key);
38.      System.out.println(_local2);
39.      _local2 = Md5(_local2);
40.      _local2 = _local2.substring(1, 7);
41.      _local2 = Md5(_local2);
42.      String p1 = _local2;
43.         
44.         
45.      String a = p1.substring(0, 6);
46.      int v = Integer.parseInt(a, 16);
47.      v = v + inc;
48.      System.out.println(v);
49.      a = Md5(v+"");
50.      return a;
51.    }
52.      
53.    public staticString Md5(String str){   
54.      MessageDigest messageDigest = null;   
55.            
56.      try {   
57.            messageDigest = MessageDigest.getInstance("MD5");   
58.         
59.            messageDigest.reset();   
60.         
61.            messageDigest.update(str.getBytes("UTF-8"));   
62.      } catch (NoSuchAlgorithmException e) {   
63.            System.out.println("NoSuchAlgorithmException caught!");   
64.            System.exit(-1);   
65.      } catch (UnsupportedEncodingException e) {   
66.            e.printStackTrace();   
67.      }   
68.         
69.      byte[] byteArray = messageDigest.digest();   
70.         
71.         
72.      StringBuffer md5StrBuff = new StringBuffer();   
73.         
74.      for (int i = 0; i < byteArray.length; i++) {               
75.            if (Integer.toHexString(0xFF & byteArray).length() == 1)   
76.                md5StrBuff.append("0").append(Integer.toHexString(0xFF & byteArray));   
77.            else   
78.                md5StrBuff.append(Integer.toHexString(0xFF & byteArray));   
79.      }   
80.         
81.      return md5StrBuff.toString();   
82.         
83.    }
84.}


这段java代码 改成au3 如何改啊?看不懂java

justwait 发表于 2011-3-29 20:20:05

上面那段基本都懂 主要就是后面加密那类的 好像不是纯md5啊 求解释

justwait 发表于 2011-3-30 06:39:36

顶起啊。。。

justwait 发表于 2011-3-30 08:25:08

或者有C 和java高人帮我写个dll也可以 万分着急 谢谢

justwait 发表于 2011-3-30 10:40:10

能做的兄弟pm我 可rmb酬谢

大绯狼 发表于 2011-3-30 10:55:17

取键值 然后MD5+字符运算 最后输出一个MD5值 不过有的java函数我不明白 就不献丑了
很简单的东西 懂JAVA的来随便写下吧

justwait 发表于 2011-3-30 18:05:50

是啊 有可以搞的兄弟pm啊 dll也可

justwait 发表于 2011-3-31 08:47:38

{:face (427):}
页: [1]
查看完整版本: 有懂java的没?帮个忙!