chuchu123123
chuchu123123
2017-12-04 04:06

请问这个hashCode是咋算的啊? 怎么拼接也不对哦。

  • hashcode

posttoken=af434dd07bca9f18488cb91cdc3acb3f&message=%25E5%2586%2599%25E7%259A%2584%25E4%25B8%258D%25E9%2594%2599&uid=1523682&method=reply&action=post&tid=2376784&type=terminal&ismob=1&attachment=

public void onClick(View paramView)
{
if (this.this$0.imm.isActive()) {
this.this$0.imm.hideSoftInputFromWindow(this.this$0.getCurrentFocus().getWindowToken(), 0);
}
PostActivityXin.access$102(this.this$0, Long.valueOf(System.currentTimeMillis() / 1000L));
if (Bimp.bmp.size() == 0)
{
paramView = this.this$0.message.getText().toString().trim();
if (paramView.isEmpty())
{
this.this$0.showDialog(2);
return;
}
this.this$0.fasong.setEnabled(false);
try
{
PostActivityXin.access$1100(this.this$0).put("posttoken", MD5HashUtil.hashCode(this.this$0.uid + "appTerminalPOSTReply" + "1" + paramView));
LogUtil.i("Tag", this.this$0.uid + "appTerminalPOSTReply" + "1" + paramView);
LogUtil.i("Tag", MD5HashUtil.hashCode(this.this$0.uid + "appTerminalPOSTReply" + "1" + para

下面是MD5HashUtil
public class MD5HashUtil
{
private static final String SECRET = "yuwyxiK6SR1CQueMNwFl4WEERJr4B3aQ";
private static final char[] hexChars = { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70 };
private static MD5HashUtil md5 = null;
private MessageDigest md = null;

private MD5HashUtil()
throws NoSuchAlgorithmException
{}

private byte[] calculateHash(byte[] paramArrayOfByte)
{
this.md.update(paramArrayOfByte, 0, paramArrayOfByte.length);
return this.md.digest();
}

public static MD5HashUtil getInstance()
throws NoSuchAlgorithmException
{
if (md5 == null) {
md5 = new MD5HashUtil();
}
return md5;
}

public static String getParams(List paramList)
{
Collections.sort(paramList, new MD5HashUtil.3());
StringBuffer localStringBuffer = new StringBuffer();
int i = 0;
if (i < paramList.size())
{
if (i == paramList.size() - 1) {
localStringBuffer.append(((SortEntity)paramList.get(i)).getKey() + "=" + ((SortEntity)paramList.get(i)).getValue());
}
for (;;)
{
i += 1;
break;
localStringBuffer.append(((SortEntity)paramList.get(i)).getKey() + "=" + ((SortEntity)paramList.get(i)).getValue() + "&");
}
}
Log.i("Tag", localStringBuffer.toString());
return localStringBuffer.toString();
}

public static String getSecretMD5(List paramList)
{
Collections.sort(paramList, new MD5HashUtil.1());
StringBuffer localStringBuffer = new StringBuffer();
int i = 0;
if (i < paramList.size())
{
if (i == paramList.size() - 1) {
if (!TextUtils.isEmpty(((SortEntity)paramList.get(i)).getValue())) {
localStringBuffer.append(((SortEntity)paramList.get(i)).getKey() + "=" + ((SortEntity)paramList.get(i)).getValue());
}
}
for (;;)
{
i += 1;
break;
if (!TextUtils.isEmpty(((SortEntity)paramList.get(i)).getValue())) {
localStringBuffer.append(((SortEntity)paramList.get(i)).getKey() + "=" + ((SortEntity)paramList.get(i)).getValue() + "&");
}
}
}
Log.i("Tag", localStringBuffer.toString());
try
{
paramList = hashCode(hashCode(localStringBuffer.toString().trim() + "yuwyxiK6SR1CQueMNwFl4WEERJr4B3aQ"));
return paramList;
}
catch (NoSuchAlgorithmException paramList)
{
paramList.printStackTrace();
}
return null;
}

public static String getSingleSecretMD5(List paramList)
{
Collections.sort(paramList, new MD5HashUtil.2());
StringBuffer localStringBuffer = new StringBuffer();
int i = 0;
if (i < paramList.size())
{
if (!TextUtils.isEmpty(((SortEntity)paramList.get(i)).getValue())) {
localStringBuffer.append(((SortEntity)paramList.get(i)).getKey() + ((SortEntity)paramList.get(i)).getValue());
}
for (;;)
{
i += 1;
break;
localStringBuffer.append(((SortEntity)paramList.get(i)).getKey());
}
}
Log.i("Tag", localStringBuffer.toString());
try
{
paramList = hashCode(localStringBuffer.toString().trim() + "871e32eb3f5c9852122c492ed39e148e");
return paramList;
}
catch (NoSuchAlgorithmException paramList)
{
paramList.printStackTrace();
}
return null;
}

public static String hashCode(String paramString)
throws NoSuchAlgorithmException
{
return getInstance().hashData(paramString.getBytes());
}

public static String hashCode(byte[] paramArrayOfByte)
throws NoSuchAlgorithmException
{
return getInstance().hashData(paramArrayOfByte);
}

public String hashData(byte[] paramArrayOfByte)
{
return hexStringFromBytes(calculateHash(paramArrayOfByte)).toLowerCase();
}

public String hexStringFromBytes(byte[] paramArrayOfByte)
{
String str = "";
int i = 0;
while (i < paramArrayOfByte.length)
{
int j = (paramArrayOfByte[i] & 0xFF) / 16;
int k = paramArrayOfByte[i];
str = str + hexChars[j] + hexChars[((k & 0xFF) % 16)];
i += 1;
}
return str;
}
}

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐

换一换