有没有大佬帮我转一下,我的全部家当只有这么多了:JAVA的校验过程
[JavaScript] 纯文本查看 复制代码 private String stringMD5(String paramString)
{
try
{
Object localObject = MessageDigest.getInstance("MD5");
paramString = paramString.toCharArray();
int j = 0;
byte[] arrayOfByte = new byte[paramString.length];
int i = 0;
while (i < paramString.length)
{
arrayOfByte = ((byte)paramString);
i += 1;
}
paramString = ((MessageDigest)localObject).digest(arrayOfByte);
localObject = new StringBuffer();
i = j;
while (i < paramString.length)
{
j = paramString & 0xFF;
if (j < 16) {
((StringBuffer)localObject).append("0");
}
((StringBuffer)localObject).append(Integer.toHexString(j));
i += 1;
}
return ((StringBuffer)localObject).toString();
}
catch (Exception paramString)
{
System.out.println(paramString.toString());
paramString.printStackTrace();
}
return "";
}
public boolean isActiveSuccessed(String paramString1, String paramString2)
{
if ((paramString1 != null) && (paramString1.length() > 0))
{
if ((paramString2 != null) && (paramString2.length() > 0))
{
String str = stringMD5(paramString1).substring(1, 7).toUpperCase();
paramString1 = "";
int j;
for (int i = 0; i < str.length(); i = j)
{
j = i + 1;
int k = str.substring(i, j).charAt(0);
StringBuilder localStringBuilder = new StringBuilder();
localStringBuilder.append(paramString1);
localStringBuilder.append(k % 10 * (i + 2) % 10);
paramString1 = localStringBuilder.toString();
}
if (paramString2.equals(paramString1))
{
Log.i("EncryptionManager", "成功");
return true;
}
Log.i("EncryptionManager", "失败");
return false;
}
Log.i("EncryptionManager", "Code为空");
return false;
}
Log.i("EncryptionManager", "ID为空");
return false;
}
|