package com.hupu.monitor.net;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class b {
private static MessageDigest a;
private static StringBuilder b;
static {
try {
a = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException noSuchAlgorithmException) {}
b = new StringBuilder();
}
public static String a(String paramString) {
a.reset();
a.update(paramString.getBytes());
byte[] arrayOfByte = a.digest();
StringBuilder stringBuilder = b;
byte b1 = 0;
stringBuilder.setLength(0);
while (b1 < arrayOfByte.length) {
byte b2 = arrayOfByte[b1] & 0xFF;
if (b2 < 16)
b.append(‘0‘);
b.append(Integer.toHexString(b2));
b1++;
}
return b.toString();
}
}
原文:https://www.cnblogs.com/php-no-2/p/11667216.html