peter
2025-11-26 566a1b9fda0276e2cc4a35f7ba322c0e599a2c84
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.nq.utils;
 
import java.math.BigInteger;
import java.security.MessageDigest;
 
public class Md5Utils {
    public static String getMD5(String str) throws Exception {
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            md.update(str.getBytes());
            return (new BigInteger(1, md.digest())).toString(16);
        } catch (Exception e) {
            throw new Exception();
        }
    }
 
 
    public static String md5_32(String plainText) throws Exception {
        String re_md5 = new String();
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            md.update(plainText.getBytes());
            byte[] b = md.digest();
 
            StringBuffer buf = new StringBuffer("");
            for (int offset = 0; offset < b.length; offset++) {
                int i = b[offset];
                if (i < 0)
                    i += 256;
                if (i < 16)
                    buf.append("0");
                buf.append(Integer.toHexString(i));
            }
 
            re_md5 = buf.toString();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return re_md5;
    }
 
 
    public static void main(String[] args) throws Exception {
        System.out.println(md5_32("SLPNXGC157080458540512750000http://serverback.comhttp://serverback.comea40b08d39a043b882ab197c6c9c7699"));
    }
}