2
3 import java.security.MessageDigest;
4
5 public class MD5Encoder {
6
7 public static String encode(String string)
throws Exception {
8 byte[] hash = MessageDigest.getInstance("MD5").digest(string.getBytes("UTF-8"
));
9 StringBuilder hex =
new StringBuilder(hash.length * 2
);
10 for (
byte b : hash) {
11 if ((b & 0xFF) < 0x10
) {
12 hex.append("0"
);
13 }
14 hex.append(Integer.toHexString(b & 0xFF
));
15 }
16 return hex.toString();
17 }
18 }
转载于:https://www.cnblogs.com/wangying222/p/5585294.html
相关资源:各显卡算力对照表!