|
7楼
发表于 2015-8-26 23:05:03
|
只看该作者
北京市北京市

public static String a(String paramString)
{
MessageDigest localMessageDigest = null;
StringBuffer localStringBuffer;
try
{
localMessageDigest = MessageDigest.getInstance("MD5");
localMessageDigest.reset();
localMessageDigest.update(paramString.getBytes("UTF-8"));
arrayOfByte = localMessageDigest.digest();
localStringBuffer = new StringBuffer();
for (i = 0; ; i++)
{
if (i >= arrayOfByte.length)
break label137;
if (Integer.toHexString(0xFF & arrayOfByte).length() != 1)
break;
localStringBuffer.append("0").append(Integer.toHexString(0xFF & arrayOfByte));
}
}
catch (NoSuchAlgorithmException localNoSuchAlgorithmException)
{
while (true)
{
System.out.println("NoSuchAlgorithmException caught!");
System.exit(-1);
}
}
catch (UnsupportedEncodingException localUnsupportedEncodingException)
{
while (true)
{
byte[] arrayOfByte;
int i;
localUnsupportedEncodingException.printStackTrace();
continue;
localStringBuffer.append(Integer.toHexString(0xFF & arrayOfByte));
}
}
label137: return localStringBuffer.toString().toUpperCase();
}
算法是这一段 |
|